-
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
Add map.setSprite(spriteUrl)
method
#2058
Comments
A bit tricky to implement, but this should be supported. (As should changing the glyphs URL.) The implementation will need to assume that the new sprite could have added icons, removed icons, and changed the contents, sizes, and pixel ratios of existing icons. All tiles will need to be re-layouted, and in order to avoid flickering and misrendering, the existing sprite texture will need to be preserved until all tiles have completed relayout. Basically, multiple sprite atlases will need to exist in parallel, and a tile will need to indicate which atlas it was layouted against. |
This would also help #2081 since currently it seems the |
Closing in favor of #2059 & mapbox/mapbox-gl-style-spec#220 |
Reopening this as a shorter-term fix that is required before #3643 can merge. |
Reopening because we're still interested in the original use case — speeding up |
I have two custom geojson sources and layers that I add to my map.
This changes the the 'baselayer' but does not render the custom layers. On the console I get this warning:
The second attempt was to remove the custom layers and sources, then do map.setStyle, then add the custom layers back:
This gives the same result as the first attempt: changes the baselayer, but does not render the custom layers with the following console message:
I am able to achieve my goal through the following brute force approach:
It appears to me to be quite drastic to tear down the whole map instance, simply to change the baselayer. Are there better ways of achieving this goal or should we wait till setStyle()/setSprite() is improved in the future? |
The style diff utility defines an operation to change the sprite sheet for a style. Mapbox GL JS does not support this method currently causing a fall back to the more invasive setStyle when this operation is encountered.
When this method is invoked, the current sprite sheet should be removed and recreated.
Minimally
setSprite(spriteUrl)
should be added to the style batch, it would also be helpful to expose this method on the map instance.The text was updated successfully, but these errors were encountered: