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

Cache map tiles for offline use #366

Closed
underbluewaters opened this issue Apr 13, 2022 · 2 comments
Closed

Cache map tiles for offline use #366

underbluewaters opened this issue Apr 13, 2022 · 2 comments

Comments

@underbluewaters
Copy link
Contributor

underbluewaters commented Apr 13, 2022

There a few different options for doing this:

  • Use the mapbox vector tile api to fetch all the needed tiles for a subset of basemaps and cache those in the client's browser.
    • How many tiles would this take and what would it cost?
    • Could we cache detailed zoom levels near shorelines, but less detail over sparse ocean space? How would mapbox-gl handle that if a tile isn't cached but one at a "parent" zoom level is?
  • Instead, we could create our own mbtiles files specifically for offline use. This would require dedicated "offline basemaps" complete with tile packages and styles to be uploaded. This would be less ideal as it would require a lot more work for each project.
  • We could have truly global basemaps with very sparse data in the worst case scenario so we could build just 1 "offline basemap" once.

Other questions...

  • How to handle satellite imagery. Is it much different?
@underbluewaters
Copy link
Contributor Author

This thread has some useful discussion about how mapbox-gl-js overzooms "sparse" tilesets. It appears we may be able to get away with caching different areas at different zoom levels but there may be some issues.

@underbluewaters
Copy link
Contributor Author

I have a partial answer to how many tiles would take and what it would cost, per-basemap.

Screen Shot 2022-04-14 at 10 46 33 AM

Tiling French Polynesia at zoom levels 16-10 would generate something around 35k tiles and cost around $9.00 to download from MapBox. Unfortunately, it is explicitly against their terms of service to download and redistribute tiles for offline use, so each time a survey facilitator downloads a map it would incur this cost. We may need to look at discounts through their community program.

Imagery is handled via the raster tile API, which actually has a more generous free tier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant