From f1744061da9becff0221732bf996c731bc280dd1 Mon Sep 17 00:00:00 2001 From: mboeringa Date: Sat, 14 May 2022 12:48:18 +0200 Subject: [PATCH] Limit dual insertion in Line and Polygon table to "boundary=administrative" Hi Paul, this is a proposal for a minor change to the relation function. Currently, if a relation is tagged as either "type=boundary" or "type=multipolygon" with a boundary tag, then the feature will end up as both a geometry in the Line as well as Polygon table. While this is the desired behavior for administrative boundary relations to allow sophisticated Line symbology and de-duplication of administrative boundary lines of different "admin_level", other "boundary" relation types like "type=boundary and boundary=protected_area", should likely only end up in the Polygon table, not the Line table, as they usually do not represent contiguous topological connected structures, but are usually "stand-alone". This change now limits dual insertion in Line and Polygon table to "boundary=administrative" tagged features only. --- openstreetmap-carto.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openstreetmap-carto.lua b/openstreetmap-carto.lua index bf472773b4..f0adf194cf 100644 --- a/openstreetmap-carto.lua +++ b/openstreetmap-carto.lua @@ -704,7 +704,7 @@ function osm2pgsql.process_relation(object) if clean_tags(object.tags) then return end - if type == "boundary" or (type == "multipolygon" and object.tags["boundary"]) then + if (type == "boundary" or (type == "multipolygon" and object.tags["boundary"])) and object.tags.boundary == 'administrative' then add_line(object.tags) if roads(object.tags) then @@ -713,6 +713,9 @@ function osm2pgsql.process_relation(object) add_polygon(object.tags) + elseif type == "boundary" then + add_polygon(object.tags) + elseif type == "multipolygon" then add_polygon(object.tags)