systemed / tilemaker

Make OpenStreetMap vector tiles without the stack
https://tilemaker.org/
Other
1.49k stars 231 forks source link

Openmaptiles .mbtiles compatibility #102

Open marcosox opened 6 years ago

marcosox commented 6 years ago

Hello, I am trying to generate vector mbtiles from an OSM dump to be used with the openmaptiles stack (tileserver-gl) or with tessera, but the server is complaining about the tiles not being in the right format (openmaptiles). I used the config.json and process.lua in the resources/ folder as explained in the readme:

tilemaker --input dataset.osm.pbf --output tiles.mbtiles --config resources/config-openmaptiles.json --process resources/process-openmaptiles.lua

After comparing the DB schema with an OMT sample .mbtiles file, I see that a lot of keys in the metadata table are missing (e.g. bounds, planettime, pixel_scale). the json additional metadata is different and basically the OMT file has 11 tables and 2 views, while the tilemaker generated one has only 2 tables.

How can I generate vector mbtiles in openmaptiles format that can be served by tileserver-gl?

systemed commented 6 years ago

Different Mapbox Vector Tiles clients expect different things in the metadata table. You can supply these to tilemaker using the metadata entry under settings in config.json: see https://github.com/systemed/tilemaker/blob/master/CONFIGURATION.md#additional-metadata for details.

Note that the config.json supplied with tilemaker is for demonstration purposes only, it's not really designed for producing a useful map.

This issue is broadly parallel to #82 and a bunch of other stuff over on the Mapbox github, e.g. https://github.com/mapbox/mbtiles-spec/pull/46 . I'm not averse to adding support for specific clients to tilemaker, but I don't want to prat around trying to keep up with 500 forever-changing specs.

@sfkeller, any thoughts?

systemed commented 6 years ago

It looks like https://github.com/openmaptiles/openmaptiles-tools has a generate_metadata tool that will generate the metadata that OMT needs.

marcosox commented 6 years ago

The generate-metadata tool in openmaptiles-tool simply adds/alters some fields in the metadata table inside the database, but nothing else. DB schema is completely different from openmaptiles and thus, incompatible. Do I understand correctly that playing with the config.json could alter the resulting mbtiles schema and potentially match the OMT one?

systemed commented 6 years ago

That surprises me. tilemaker produces vector tiles compliant with the Mapbox Vector Tiles spec and I thought that's what OpenMapTiles understood. I think this will require input from someone who knows about OMT.

sfkeller commented 6 years ago

@marcosox is right: That OMT tool generates several representations of the OMT data schema and serves also e.g. the TileJSON file extended for VT (which is also needed by Mapbox Studio). The specs. extended for VT by MB contains the JSON object "vector_layers" which describes the schema.

@marcosox asked

How can I generate vector mbtiles in openmaptiles format that can be served by tileserver-gl?

To clarify: I assume you are referring to mbtiles metadata table, since tileserver-gl can serve any VT data. I think this is something to ask over at tileserver-gl: http://tileserver.readthedocs.io/en/latest/config.html . /cc @klokan

OMT has a different data schema than MB VT (you know, after MB threatened OSM2VectorTiles, OpenMapTiles has been created with an own schema). I still have hope the mbtiles and TileJSON (metadata) specs. will get some love from MB! /cc 'ing https://github.com/mapbox/mbtiles-spec/pull/46 @flippmoke @ericfischer

e-n-f commented 6 years ago

Thanks @sfkeller. We recognize that the mbtiles and TileJSON specs have been long neglected and inconsistent and plan to get them straightened out soon.

For tilesets served by Mapbox, I still consider https://github.com/mapbox/mbtiles-spec/pull/47 to be the most accurate description: not what the spec really ought to be, perhaps, but what actually works. It would be great to extend that to include what tileserver-gl requires as well.

carlos-mg89 commented 5 years ago

Running this command tilemaker --input dataset.osm.pbf --output tiles.mbtiles --config resources/config-openmaptiles.json --process resources/process-openmaptiles.lua throws tones of errors. While running tilemaker --input dataset.osm.pbf --output tiles.mbtiles throws no error and the generated MBTiles seem to show what they were intended to show.

These are some of the errors I see when running the first command:

Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set
Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set
Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set
Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set
Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set
Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set
Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name if no Layer set Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute name_en if no Layer set
Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Geometry is empty in OsmLuaProcessing::LayerAsCentroid Can't add Attribute name if no Layer set Can't add Attribute name_en if no Layer set Can't add Attribute name_de if no Layer set Can't add Attribute rank if no Layer set Can't add Attribute class if no Layer set Can't add Attribute subclass if no Layer set