tegola icon indicating copy to clipboard operation
tegola copied to clipboard

Create a cache provider for mbtile

Open gdey opened this issue 7 years ago • 2 comments

https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md

The MBTile spec is perfect for our cache system. We should implement this a deployment target for our cache system.

A few things to note.

The system will have to do the translation from the standard "XYZ" format to the one required by mbtiles using the formula describe at: https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md#content-1

When setting up the cache the use will need to specify the the bounds of the map (Need to see if the cache has the ability to get this from the mapname?) and the center point.

The Min and Max Zoom values should be those of the cache.

For this implementation we will not support grid and grid_data tables.

We will assume that the system will provide us with gzipped mvt data. So, all tile data should be stored as pbf.

The biggest diffculty may be the metadata table and the JSON field in it. We may need a way for the cache to get access to Atlas to get a maps metadata. We should be able to create a new mbtile file for each map.

gdey avatar Sep 27 '18 18:09 gdey

Thanks for creating this issue, @gdey, it's encouraging to see your expertise shine through as you scope out what needs to be done.

erictheise avatar Sep 27 '18 18:09 erictheise

Couple of things to keep in mind

  • the mbtiles spec sets out what it needs to look like for the consumer of it, but allows different storage with views. A common way of writing mbtiles is to write x, y, z, md5 into one table, md5, tiledata into another table, and have a view that joins them
  • Most mbtiles caches I've seen fail with concurrency errors when you put heavy concurrent reads and writes on them, so this is something that needs testing.

pnorman avatar Mar 11 '19 19:03 pnorman