Close

USGS Topo Tile Cache Explorer

A project log for Backcountry Beacon

USB Powered Offline Map Server

brett-smithBrett Smith 08/26/2024 at 08:350 Comments

A big part of the project is determining what map tiles need to be downloaded for any given state.

Computing what tiles are needed is actually rather computationally expensive.

Essentially, we create a bounding box for the geojson polygon that contains the state outline. Then we iterate through through the tiles at the bounding for every zoom level (until zoom level 9) to build the list of required map tiles for the state. After zoom level 9, we assume that every tile below the current calculated tiles need to be included.

You can see and explore the outcome of this process here on the state of Hawaii: https://cache-explorer.netlify.app/

We can really only show to zoom level 12 on the netlify app, as bigger zoom levels make the cache file hundreds of megabytes.

This could be because the required maps are saved in JSON, which is intuitive but not space efficient:

{
 "12": {
   "456": [789, 790, 791],
   "457": [789, 790]
 },
 "13": {
   "912": [345, 346],
   "913": [345]
 }
}
You can learn more about this process here:
https://github.com/diyaquanauts/BackcountryBeacon/tree/main/tileDownloader


Discussions