-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Road name label density badly calculated based on text-size #6464
Comments
Can you please set up a minimal reproducible test case so that we could diagnose the issue? Also, you might want to set |
Hmm, this looks not related to Mapbox GL — more likely an issue with how Mapbox Streets generalizes road labels on lower zoom levels. cc @ajashton |
I am not sure what "generalizes labels means", but I have same behavior without Mapbox Studio, with my own data, tileset and style where all streets have name attribute, but only 1 in entire tile is displayed. |
@watbywbarif That is indeed confusing behavior! The reason the seemingly-unrelated mapbox-gl-js/src/symbol/symbol_layout.js Line 93 in 866ab7b
The reason we use zoom level 18 regardless of the actual zoom of the tile you're showing is that we want the "anchors" for road labels to show up in similar places as you move between zoom levels, even if the size of the text is changing. There's some discussion of this behavior as "case (4)" at #5683 (comment). In short, we think we should remove the behavior or change it, because it doesn't seem to work that well. I suspect the reason you're seeing labels drop may be that this "max angle" check is failing: mapbox-gl-js/src/symbol/get_anchors.js Lines 96 to 98 in 866ab7b
The The upshot of all this is that a promising workaround in your case may be to try setting /cc @nickidlugash @ansis |
On the other hand, it's also possible that the labels are getting filtered out because there doesn't appear to be enough space for even a single label in the middle of the line: mapbox-gl-js/src/symbol/get_anchors.js Lines 87 to 92 in 866ab7b
If that's the case, change You could do something really crazy like adjust your zoom stops so the text is small (e.g. 10 point) at exactly zoom 18, but larger at zoom 17.99 and zoom 18.01. Then you could hook the map's zoom events to make it so that the map never actually rendered exactly zoom 18. But hopefully it doesn't come to that, because that's a crazy hack. 🤔 |
@ChrisLoer Is there some way to force the symbol layout engine to generate anchors for lines where the length of line is slightly smaller than the label (perhaps by using negative text-padding)? It would be useful to create a style similar to what the current waze application uses ('Rexford Way, 'Mansfield Dr', 'Princes Anne Dr' etc in the attached screenshot ). |
@mb12 unfortunately, no: the relevant code is |
I did play with One solution which I was thinking is to use fixed Now I can play and hack, but maybe there is some good solution for future versions. |
v0.44.1 @ Chrome 65 @ Windows 10:
Steps to Trigger Behavior
Expected Behavior
with:
Actual Behavior
Now i only change this:
And result is this:
How is this possible on zoom level 12, especially with stop [ 14, 10 ]?
And even better how does stop [ 19, 10 ], fixes this problem?
This is simplified example but this effect destroys map quality in certain areas of the globe where there are less POIs and other labels.
The text was updated successfully, but these errors were encountered: