ol-mapbox-style
ol-mapbox-style copied to clipboard
feat(spriteCache): cache the sprites that are downloaded already
I think it could be quite useful to cache the downloaded sprites if one is about to re-apply styles to (a subset of) layers (for example to keep the number of styles low in Mapbox Studio).
I couldn't extensively test this though - could you please give it a go?
This will not work. spriteData
is added to the cache before it is loaded. And even when you fix that, things will still not work correctly when getStyleFunction()
is called again while the data or the image is still loading. So it requires more work to code that up properly.
I've been thinking about changing the API of ol-mapbox-style
a bit for v2.x, to make it really bare bone, and move some functionality it currently provides into a separate library, which could also create a complete OpenLayers map configuration from a Mapbox Style object, like suggested in #11.
Fair enough, I should have conducted more thorough testing. However, I think this is something worth considering, definitely in my use case.
The changes that you have on your mind re v2.x sound really great - looking forward to it.