@@ -241,6 +241,23 @@ def get_skip_reason(elem, tag_to_check, table_details, importable_relation_types
241241 if not tags :
242242 return {"reason" : "Element has no tags" , "commentable" : False }
243243
244+ # Check non-importable relation types early.
245+ # Relations with types like "waterway" are grouping relations whose member
246+ # ways get imported individually — the relation itself is never stored.
247+ # This must be checked before tag matching to avoid false positives when the
248+ # relation carries tags (e.g. waterway=stream) that match import tables but
249+ # are incompatible with the relation geometry type.
250+ if elem_type == "relation" :
251+ rel_type = tags .get ("type" , "" )
252+ if rel_type and rel_type not in importable_relation_types :
253+ return {
254+ "reason" : (
255+ f"Relation type '{ rel_type } ' is not imported by the tiler. "
256+ f"Only these relation types are supported: { ', ' .join (sorted (importable_relation_types ))} "
257+ ),
258+ "commentable" : False ,
259+ }
260+
244261 # Check geometry validity
245262 if elem_type == "way" :
246263 node_count = elem .get ("node_count" , 0 )
@@ -330,34 +347,13 @@ def get_skip_reason(elem, tag_to_check, table_details, importable_relation_types
330347 return None
331348
332349 if not matched_any_tag :
333- # For relations: check if the relation type itself is not importable
334- # (only check here, after confirming no other tags matched any table)
335- if elem_type == "relation" :
336- rel_type = tags .get ("type" , "" )
337- if rel_type and rel_type not in importable_relation_types :
338- return {
339- "reason" : (
340- f"Relation type '{ rel_type } ' is not imported by the tiler. "
341- f"Only these relation types are supported: { ', ' .join (sorted (importable_relation_types ))} "
342- ),
343- "commentable" : False ,
344- }
345-
346350 return {
347351 "reason" : "No tags match the tiler's import configuration" ,
348352 "commentable" : False ,
349353 }
350354
351355 # Tags matched but all tables rejected it — mapper should know
352356 if rejection_reasons :
353- # For relations with non-standard type: mention the relation type in the reason
354- if elem_type == "relation" :
355- rel_type = tags .get ("type" , "" )
356- if rel_type and rel_type not in importable_relation_types :
357- rejection_reasons .append (
358- f"relation type '{ rel_type } ' is not directly importable "
359- f"(supported: { ', ' .join (sorted (importable_relation_types ))} )"
360- )
361357 return {
362358 "reason" : "Element has mappable tags but was rejected by all tables: " + "; " .join (rejection_reasons ),
363359 "commentable" : True ,
0 commit comments