Skip to content

Commit 4fbb83d

Browse files
committed
Skip relations without a member for monitor
1 parent 782f7e4 commit 4fbb83d

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

images/tiler-monitor/pipeline-monitor/checks/imposm_import.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ def _get_changeset_elements(changeset_id):
218218
timestamp = elem.attrib.get("timestamp", "")
219219
# Count nodes for ways (to detect invalid geometries)
220220
node_count = len(elem.findall("nd")) if elem_type == "way" else 0
221+
# Count members for relations (to detect empty relations)
222+
member_count = len(elem.findall("member")) if elem_type == "relation" else 0
221223
elements.append({
222224
"type": elem_type,
223225
"osm_id": int(osm_id),
@@ -226,6 +228,7 @@ def _get_changeset_elements(changeset_id):
226228
"tags": tags,
227229
"timestamp": timestamp,
228230
"node_count": node_count,
231+
"member_count": member_count,
229232
})
230233
return elements
231234

images/tiler-monitor/pipeline-monitor/imposm_config_loader.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@ def get_skip_reason(elem, tag_to_check, table_details, importable_relation_types
254254
if not tags:
255255
return {"reason": "Element has no tags", "commentable": False}
256256

257+
# Skip relations with no members — imposm cannot build geometry from an
258+
# empty relation, so it will never appear in the tiler DB.
259+
if elem_type == "relation":
260+
member_count = elem.get("member_count", -1)
261+
if member_count == 0:
262+
return {
263+
"reason": "Relation has no members — imposm cannot import empty relations",
264+
"commentable": False,
265+
}
266+
257267
# Check non-importable relation types early.
258268
# Relations with types like "waterway" are grouping relations whose member
259269
# ways get imported individually — the relation itself is never stored.

0 commit comments

Comments
 (0)