-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Problematic polygon labeling density #5583
Comments
To my knowledge polygons are cut into parts during vector tile creation and are not "recombined" during rendering. So you get a number of separate polygons all of which follow their own labelling. This is why you're getting so many labels. |
@tomass I think there is some "recombining" going on - if you use "buffer" while generating tile, mapbox-gl-js "knows" the geometry overlaps into next tile and joins them - at least that is what I can see in building layer - building style has "shadows" which are drawn correctly even for buildings cut in half on tile boundary (and if you disable buffer, shadow is in fact drawn in the middle of building because mapbox-gl-js doesnt know about overlap). |
When you have buffer, client draws "full" tile (with buffer) and then cut's of the buffer part. This is how you get correct buildings, this is how you get correct polygon outlines, this is how you do not get gaps for roads on tile boundaries even if you use rounded corners. But those are still "separate" geometries. In other words you do not need to actually merge geometries to get the correct result for those particular cases. |
Just as an aside I use https://github.com/andrewharvey/geojson-polygon-labels to generate a new point label source from a polygon layer. |
yes @tomass is correct:
labeling polygons that span tile boundaries is a challenge, and one that Mapbox solves by including a separate 'marine label' layer in our vector tiles which assigns point and linestring locations to label bodies of water instead of using the polygon (pole of inaccessibility) as the label anchor (which finds the optimal label placement point per tile not per polygon). We currently do not have a way of re-assembling polygons across tile boundaries in order to place labels, so I suggest using geojson like @andrewharvey suggests or adding a new layer to your vector tiles. |
Closing as not actionable for now. But note that we're currently researching ways to recover full features across tiles, but that will require a major VT spec revision and is not feasible short term. |
@andrewharvey can you give me how to fix this using https://github.com/andrewharvey/geojson-polygon-labels ? |
@andrewharvey can you give me too how to fix this with geojson polylabel, I have a tiles source |
Too many duplicates, see mapbox/mapbox-gl-js#5583 (comment)
I am trying mapbox-gl-js (v0.40.1) with some proprietary data (not OSM) and there is one thing which seems quite problematic - no way to control labeling density of polygons, especially near tile edges it seems. Example (red lines are approx tile boundaries):
![image](https://user-images.githubusercontent.com/7676825/32319305-67772b2e-bfba-11e7-94cf-e0db9f351daa.png)
Basically, I dont see any way to control density of the water labels here. My layer style is
symbol-spacing
works only forsymbol-placement = line
(which place labels on boundaries of polygons) and I cant use some bigtext-padding
, because collision detecion is "global" (between all layers) so in urban areas (with lots of street names, road shields, place names etc.) water labels are never shown.It would be super usefull to have something similar to
symbol-spacing
for polygons, or maybe option to have separate collision detection per layer (for chosen layer)?The text was updated successfully, but these errors were encountered: