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

Tiles cache #262

Open
fitoprincipe opened this issue Jan 16, 2019 · 9 comments
Open

Tiles cache #262

fitoprincipe opened this issue Jan 16, 2019 · 9 comments

Comments

@fitoprincipe
Copy link
Contributor

Hi, I'd like to know if tiles are downloaded into a cache folder. If not, is there any possibility to implement this? Thank you.

@martinRenou
Copy link
Member

Hi, tiles are not downloaded to a cache folder. There are some plugins for LeafletJS that allows caching of tiles, like this one: https://github.com/MazeMap/Leaflet.TileLayer.PouchDBCached. Adding this feature to ipyleaflet should be easy using this plugin, but I start to be a little bit annoyed by the number of dependencies, and most of them are not maintained.

I suppose there is some caching already with the browser, but it does not last long.

@fitoprincipe
Copy link
Contributor Author

I understand @martinRenou, thank you for your time.

@martinRenou
Copy link
Member

Do you think that having the tiles in a folder and using something like a LocalTilesLayer in ipyleaflet, as discussed here would be enough for your use case? I guess you want caching for being able to use ipyleaflet without an internet connection, is that it?

@fitoprincipe
Copy link
Contributor Author

I made a tool upon ipyleaflet to visualize tiles pulled from GEE (Google Earth Engine) (my tool: https://github.com/gee-community/gee_tools/blob/master/notebooks/ui/map_visualization.ipynb). I use it a lot myself, and that is why I am able to maintain it. If you sing up to GEE you can try it out.

Basically, using Google Earth Engine Python API I do some raster manipulation on their servers and they serve me the result as tiles (url), so every time I request a tile, their servers compute it and serve it (which may take long). Downloading the raster images would take much longer and would miss the point of "playing around" with GEE.

@martinRenou
Copy link
Member

Ok I see :) I guess we can try adding the plugin for caching. It should not be too difficult.

@fitoprincipe
Copy link
Contributor Author

That would be great! Thank you =)

@martinRenou
Copy link
Member

I looked closer to Leaflet.PouchDBCached, it's not maintained anymore, apparently does not support the last version of LeafletJS and PouchDB.
MazeMap/Leaflet.TileLayer.PouchDBCached#38
On the other hand, it's not a lot of code, I guess it would not be that difficult to implement something similar.

@fitoprincipe
Copy link
Contributor Author

Thanks for keeping this alive @martinRenou. May be if you guide me, I could help you, but that could be an extra effort for you, and whatever is your decision is fine to me. =)

@martinRenou
Copy link
Member

Sure I can guide you :)
I think the way to go would be to take a look at this file from Leaflet.TileLayer.PouchDBCached, and try to implement your own version that supports the last version of LeafletJS. I don't know if a dependency like PouchDB is essential.
But to avoid duplication of effort I think it would be a good idea to answer to this issue first, I guess his code coulld be what we need :)

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

No branches or pull requests

2 participants