Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix label collisions across sources by combining tiles from different sources #1042

Closed
ansis opened this issue Mar 2, 2015 · 13 comments
Closed
Assignees

Comments

@ansis
Copy link
Contributor

ansis commented Mar 2, 2015

We don't avoid collisions of labels from different sources. Labels from geojson overlap with labels from vector tiles. We should fix this.

I think we need to combine tiles from different sources. It would wait until both the geojson and vectortile tiles are loaded and do placement on them together. Nothing from the geojson tile would be rendered until the vector tile has loaded. From the rendering perspective, you wouldn't have a separate tile from each source. You would have a single tile with the data from all the sources.

The relationship between the tile pyramid and sources would be inverted. There would be only one pyramid requesting tiles. Each requested tile would then request the data from all the sources. Or something like that.

For example:

  • tile pyramid requests tile 0/0/0
  • tile object 0/0/0 is created and it requests vectortile 0/0/0 and geojson 0/0/0
  • it waits until both the vectortile and geojson have loaded
  • it does placement on all the layers from all sources together
  • tile object 0/0/0 is marked as loaded and contains the buffers for both vectortile and geojson layers

Raster tiles would still be completely separate for now.

other notes

@mourner @jfirebaugh @kkaefer

@jfirebaugh
Copy link
Contributor

👍 -- I'm on board with this approach, which I've been calling "client-side compositing".

I think eventually we will need to support multiple vector tile sources. The easiest way for someone to throw together a basemap + tiled overlay will be to use one of our default styles and then add their own VT data layer on the fly.

@mourner
Copy link
Member

mourner commented Mar 2, 2015

I was thinking of doing the same thing, so 👍.

@kkaefer
Copy link
Contributor

kkaefer commented Mar 3, 2015

This sounds like a reasonable approach.

@musicformellons
Copy link

I would like to combine two vector tiles sources (from different servers) to use with mapbox-gl-js. This seems indeed a sensible approach. This is not possible I understand at the moment? Any idea on when this will be implemented? Thanks!

@ansis
Copy link
Contributor Author

ansis commented Oct 23, 2015

@musicformellons yeah, this isn't possible at the moment and we're not sure when it will be. This issue will be updated as we make progress on it

@pixelyunicorn
Copy link

👍 I am running into the same issue (bike share geojson under mapbox vector tile), it would be nice to see this implemented

image

@lucaswoj
Copy link
Contributor

A workaround, if you're using mapbox:// vector tile sources, is to use server-side source compositing.

For example, if you set the source URL to

mapbox://mapbox.mapbox-streets-v6,mapbox.mapbox-terrain-v2

You will get a single source that is a composite of mapbox streets and mapbox terrain. This allows for proper label collision.

@ansis
Copy link
Contributor Author

ansis commented Feb 1, 2016

GeoJSON tiles are all created in a single worker. Vector tiles are loaded across all the workers. Placement needs to be done together in the same work. We'll need to move some data between workers (worker1 --> main thread --> worker2). What gets moved? all the raw geometries? just enough to do placement? can it be moved in a transferrable array? could geojsonvt produce actual pbf vector tiles?

How do we handle sources with different max zooms? If we have only one vectortile source we can just match the geojson sources with it, but if we have multiple vectortile sources this gets complicated.

Do we want to also implement automatic serverside compositing for mapbox sources? How big is the benefit of downloading a single composited tile vs three separate ones?

@lucaswoj
Copy link
Contributor

lucaswoj commented Feb 1, 2016

Do we want to also implement automatic serverside compositing for mapbox sources? How big is the benefit of downloading a single composited tile vs three separate ones?

I think this already exists!

EDIT depending on your definition of automatic -- just realized you probably mean "even if compositing is not explicitly specified in the stylesheet"

@mourner
Copy link
Member

mourner commented Feb 1, 2016

can it be moved in a transferrable array? could geojsonvt produce actual pbf vector tiles?

We could reencode to pbf, e.g. https://github.com/anandthakker/vt-pbf does this. Or we could explore my geobuf idea from #1504 #1979.

@andrewharvey
Copy link
Collaborator

A workaround, if you're using mapbox:// vector tile sources, is to use server-side source compositing.

👍 Thanks for posting that, work's a charm.

@mollymerp
Copy link
Contributor

🆕 ✏️ 👉 #2703

@lucaswoj lucaswoj changed the title fix label collisions across sources by combining tiles from different sources Fix label collisions across sources by combining tiles from different sources Jul 28, 2016
@lucaswoj
Copy link
Contributor

Replaced by #2703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants