Search code examples
openstreetmapmbtilesopenmaptiles

How can I generate mbtiles with a smaller extent with openmaptiles?


I'm using OpenMapTiles to download OSM data and create a mbtiles with mapbox vector tiles. This all works great, except I'm targeting an embedded platform.

At zoom level 14 with the default extent of 4096, a single tile can be over 1MB and cover an entire city. Not only is that a huge file to process for an embedded platform, it also means you're potentially sifting through every house in an entire city. I went as far as writing a streaming protobuf parser, but it takes 10 minutes to just parse such a file.

How can I generate mapbox vector tiles with a smaller extent?

I found there appears to be a parameter for it, but can't figure out where it actually gets used to generate tiles and how to modify it: https://github.com/openmaptiles/openmaptiles-tools/blob/4cc6e88dfdef83de69bd49845e0f23908d9edecc/openmaptiles/sqltomvt.py#L25

I'm not married to openmaptiles, but it's what I'm currently using to download and process openstreetmap data.


Solution

  • in case others need it, use https://github.com/mapbox/tilelive and specify maxzoom you want

    bin/tilelive-copy --minzoom=0 --maxzoom=10 ~/Apps/tileserver/tiles/osm-2017-07-03-v3.6.1-planet.mbtiles ~/Apps/tileserver/tiles/small-osm-2017-07-03-v3.6.1-planet.mbtiles