Keep OSM feature type in the final mbtiles file
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 :)
Exemple inspecting the mbtiles produces with the default tilemaker options with include_ids.
This "Point" is in fact a way https://www.openstreetmap.org/way/64518593#map=20/47.55544/-3.13397&layers=H
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.
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.
Mmmh maybe WritePOI needs to be modified as well.
Awesome :)
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 !
Hi @systemed, what about relations that are handled by way_function, is it possible to know that a feature treated by way_function is an OSM relation ?
Tilemaker handles multipolygon relations natively. The combined geometries are processed as ways (i.e. by way_function), so if your function puts buildings in a 'buildings' layer, tilemaker will cope with this whether the building is mapped as a simple way or a multipolygon. The only difference is that they're given an artificial ID. Multipolygons are expected to have tags on the relation, not the outer way.
E.g. some schools can be ways or relations. This one is a relation, but in my tiles I want to keep track of the original OSM object, so I need to keep its original relation status.
I haven't been able to find a way to do that.
Could way_function get a parameter that tells the original status of the OSM feature ?
I believe I found the answer. These relations are directed to way_function because they are multipolygon relations.
Tilemaker handles multipolygon relations natively. The combined geometries are processed as ways (i.e. by way_function), so if your function puts buildings in a 'buildings' layer, tilemaker will cope with this whether the building is mapped as a simple way or a multipolygon. The only difference is that they're given an artificial ID. Multipolygons are expected to have tags on the relation, not the outer way.
Hence, just testing if it's a multipolygon will tell us if it is a relation.
IsMultiPolygon(): returns true if the current object is a multipolygon.
Mmmh, it's not working, IsMultiPolygon() does not appear to be available in process_openmaptiles.
My bad ! It's an addition from two weeks ago, my local executable is older.
Wonderful. Code is here : https://github.com/cartesapp/serveur/commit/51dd2a222b3d410562ee3b2e8c126010de71bd50
Keeping this open in case merging to the repo's lua file is considered a good idea at some point.
This is great - absolutely delighted you're using tilemaker for cartes.app!
Thanks ! Hopefully to generate tiles for the whole europe and then the world soon. For now, we're using movisda's degree tiles to generate tiles that englobe France, and a MapLibre protocol to switch to Panoramax's planet.pmtiles.
solved in #834 by adding a new function OsmType(). (@systemed you can close the issue, I tried but I don't have the rights to do so)