systemed / tilemaker

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

Keep OSM feature type in the final mbtiles file #740

Open laem opened 1 month ago

laem commented 1 month ago

Hi, I found the include_ids option in the parameters, but I can't find an option to store the OSM feature type as well : node, way or relation.

It makes it very difficult to link the tiles' nodes to OSM on the final map.

I wonder if it's possible to add someting in the process-openmaptiles.lua file... Any help appreciated, thanks :)

laem commented 1 month ago

Exemple inspecting the mbtiles produces with the default tilemaker options with include_ids.

Sélection_230

This "Point" is in fact a way https://www.openstreetmap.org/way/64518593#map=20/47.55544/-3.13397&layers=H

systemed commented 1 month ago

The $id is a dedicated field in the vector tiles, rather than an user-set attribute: see 4.2 in https://github.com/mapbox/vector-tile-spec/tree/master/2.1. There is no dedicated field for an "id type".

If you do want to add it as an attribute, you could certainly do that in process.lua. In node_function you'd add a line like Attribute("obj_type", "node"), in way_function you'd add Attribute("obj_type","way") and so on.

laem commented 1 month ago

Thanks for your quick answer ! I just tried this https://github.com/laem/gtfs/blob/master/tilemaker/resources/process-openmaptiles.lua#L124 without success yet, but I'm investigating.

laem commented 1 month ago

Mmmh maybe WritePOI needs to be modified as well.

laem commented 1 month ago

Awesome :)

image

laem commented 1 month ago

Do you think I should open a PR to add this attribute to the default process-openmaptiles.lua ? Else, the PR can be closed. Thanks again !