Skip to content
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

feat(spriteCache): cache the sprites that are downloaded already #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aberenyi
Copy link
Contributor

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?

@ahocevar
Copy link
Member

ahocevar commented Jan 18, 2017

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.

@aberenyi
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants