-
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
Fix bug causing symbols to be clipped when many are rendered #2907
Comments
Would be awesome to have a fix for this! |
Thanks for reporting this issue @AndyMoreland -- could you please post a link to the |
The style I'm using is: http://23.239.25.88/repro.json The sprite file is: http://23.239.25.88/sprite.json and http://23.239.25.88/sprite.png |
I've made a slightly simpler repro here: http://jsfiddle.net/Lqgnyna3/4/ The problem seems to be caused by large numbers of labels. |
Even simpler repro: http://jsfiddle.net/Lqgnyna3/5/ |
There are two places that we fork on
I've ruled out 1. as a source of the bug by hardcoding More investigation is needed to determine if grid index could be the source of the bug. I'm especially interested to see if there are any places where this number of symbols could cause an integer overflow in grid index. |
If it helps, I've updated my initial repro up above to remove the extremely large |
@AndyMoreland @Que3216 You're experiencing 2 issues:
For now, modifying the code I referenced above should solve your rendering artifacts.
|
@mollymerp I made the change that you suggested (against v0.22.1), but it caused:
which seemed to break the rendering. |
Hm. I might have built my fork wrong. It does seem to work now! Thanks. |
In case anyone else comes here, I believe that link which is now dead was pointing to this: [removed, see below] |
@bhison I think the code you're seeking has moved here: https://github.com/mapbox/mapbox-gl-js/blob/master/src/data/bucket/symbol_attributes.js#L64 |
@lucaswoj thank you! Do you have an idea how I can change this type? I feel a bit out of my depth here. |
@bhison Unfortunately the process is rather involved. You'll need to figure out exactly which attributes are overflowing because of a too-small integer type, fork GL JS, change those types, and create your own build. I don't recommend it. |
@lucaswoj oh ok. So the alternative is...have fewer symbols I guess? |
@bhison hard to say... it all depends on the situational specifics |
It turns out this situation can also cause an exception to be thrown during rendering (assuming this code hasn't diverged too much from MapLibre) -- in line label projection, the code checks to see if there's enough room for all the glyphs on a line by checking that the first and last glyph fit. The code assume that the glyphs are in increasing-offset order. However, if the offsets get jumbled by the overflow, it's possible for a "middle" glyph to be outside of the min/max offset. When the code tries to place the glyph, it can't find a place to put the glyph on the line and ends up doing a null pointer dereference. |
mapbox-gl-js version: v0.20.0, v0.20.1, v0.21.0.
Occurs in all browsers I've tested including chrome 51, FF47, FF39 and a few others on Mac OS and windows.
Repro here: http://23.239.25.88/repro.html
To view the behavior, zoom in and out. When zoomed in, the sprites render at the coordinates specified by the geojson point geometry. When you zoom out past zoom level 10, copies of the sprites start being rendered in the "background" (or something) of the labels of the point data and the map is very clearly no longer correct.
I started observing this behavior circa mapbox-gl-js v0.20.0 in maps with more complicated sprite sheets and geometries. I bisected mapbox-gl-js and I believe the behavior was introduced in one of these commits: {e268120, 6537f3e, 92fbfb8}.
This example is probably not minimal, but I trimmed as much of the source map out as I could.
When you cross the zoom-level inflection point you should see the map transition from something like:
which is correct, to:
which is incorrect.
The text was updated successfully, but these errors were encountered: