TransWikia.com

From osm.pbf data to mbtiles (pbf vector tiles inside a sqlite3 container)?

Geographic Information Systems Asked by swiss_knight on July 21, 2021

I need to experiment with vector tiles based on OSM data.

To do that, I’ve downloaded an OSM *.osm.pbf data file from geofabrik.de.

I want now to store these data either as the standard /tileset/{Z}/{X}/{Y}.vector.pbf files, or as a single sqlite3-flavoured *.mbtiles file (better).

Do you know a straightforward way to proceed using command line tool(s) on Linux (Ubuntu server 18.04), and, if possible, without passing through a PostGIS database?

A docker based solution could also be useful.

The tricky part will certainly be to set up a symbology (for which I don’t know from where to explore at the time of writing…) but I wonder if one can use some predefined one such as the cartodb positron for example, or online tools such as https://cloud.maptiler.com/customize/#streets/0.82/0/0 or https://maputnik.github.io/editor/#0.83/0/0 to generate a custom style.json file which could then be used somewhere in a config?

What I’ve tried so far:

I’ve thought writing data to a sqlite3 database as follows could be a nice idea, but this will obviously not make it ‘mbtiles’ ready (i.e. it will not be encoded as protobuf chunks):
wget -O - http://www.example.com/some.pbf | ogr2ogr -f SQLite my.sqlite /vsistdin/
(this latter command is explained here)

I also gave GDAL’s MVT driver a try, but this doesn’t seem to work very well (I’m unable to serve the so build tiles, e.g. tileserver-gl complains that the tiles are not in the "openmaptiles" format (why?). And I cannot figure out if this format is implemented in GDAL. Maybe I need another server then?):
ogr2ogr -f MVT mytileset my_osm_data.osm.pbf -o METADATA_FILE='./tileset/metadata.json'

Creating MBtiles file from ".osm.pbf" file using TileMill is outdated for my usage.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP