Not all relations accepted in `relation_scan_function` are passed to `relation_function`
Lot of boundary relations in Prague with admin_level=10 (such as relation 428369) are not passed to the relation_function. What is interesting is that they ARE passed to the relation_scan_function and are successfully accepted. They are also readable inside way_function. Also, some of the relations (such as relation 435882) work correctly, despite being very similiar to the problematic ones.
The simplest way to reproduce is:
- Download https://download.geofabrik.de/europe/czech-republic-latest.osm.pbf
2. Create process.lua and config.json files:
process.lua:
relation_id = "428369"
function relation_scan_function()
if Id() == relation_id then
print("Found the relation in relation_scan_function")
Accept()
end
end
-- Assign ways to a layer, and set attributes, based on OSM tags
function relation_function()
if Id() == relation_id then
print("Found the relation in relation_function")
Layer("boundary", true)
end
end
function way_function()
end
function node_function()
end
config.json:
{
"layers": {
"boundary": { "minzoom": 8, "maxzoom": 8 }
},
"settings": {
"minzoom": 8,
"maxzoom": 8,
"basezoom": 8,
"include_ids": true,
"name": "Error reproduction",
"version": "0.1",
"description": "Error reproduction",
"compress": "gzip"
}
}
- Run tilemaker on theese files:
tilemaker osm-data.pbf tiles.pmtiles --process process.lua --config config.json
After that, you can see that Found the relation in relation_scan_function is present in tilemaker's logs as expected, however Found the relation in relation_function is missing. The relation is also mising from the produced tileset.
When you replace relation_id = "428369" with relation_id = "435882" it starts working correctly, printing both Found the relation in relation_scan_function and Found the relation in relation_function, despite these being very similar relations.
When running tilemaker with a different lua code which accepts all relations with admin_level=10...
See the code
function relation_scan_function()
if Find("type")=="boundary" and Find("admin_level")=="10" then
Accept()
end
end
-- Assign ways to a layer, and set attributes, based on OSM tags
function relation_function()
if Find("type")=="boundary" and Find("admin_level")=="10" then
Layer("boundary",true)
end
end
function way_function()
end
function node_function()
end
...it produces tiles looking like this when viewed on https://pmtiles.io (this is relation 435882 , you can see that it's there without any surrounding boundaries. There are some other relations outside of bounds of the screenshot).
.
However when running the equivalent overpass query, we can see that there are in fact many more relations which are missing from generated tiles: