Skip to content

Not all relations accepted in relation_scan_function are passed to relation_function #848

Open

Description

@FireFragment

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:

  1. 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"
	}
}
  1. 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).

.
Image

However when running the equivalent overpass query, we can see that there are in fact many more relations which are missing from generated tiles:

Image

Activity

  1. dktue commented on Oct 28, 2026

    @dktue
    Contributor

    I tried to reproduce this with current master on today's czech-republic-latest.osm.pbf. Using your Lua (accepting all type=boundary + admin_level=10), all 1613 relations accepted in relation_scan_function reach relation_function when running in memory, and so do 428369 and 435882 when selected by ID (both have since been retagged as cadastral boundaries without admin_level). Could you retest with current master and say which tilemaker version and command line you used originally, including whether you used --store?

    With --store, master currently loses relations whose first member way is outside the extract (104 here, all just across the border). That's fixed in #943.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions