From: Sarah Hoffmann Date: Tue, 6 Jun 2017 19:58:41 +0000 (+0200) Subject: Remove boundries when downgrading from polygon to line X-Git-Tag: v3.0.0~12 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/623d58b67e5c5d69f8f8e7d67a769ba920d021f0 Remove boundries when downgrading from polygon to line Fixes #135. --- diff --git a/sql/functions.sql b/sql/functions.sql index d863a9bf..9dbc6fe0 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -2144,6 +2144,12 @@ BEGIN NEW.name := hstore('ref', NEW.address->'postcode'); END IF; + IF NEW.class in ('boundary') + AND ST_GeometryType(NEW.geometry) not in ('ST_Polygon','ST_MultiPolygon') THEN + DELETE FROM placex where place_id = existingplacex.place_id; + RETURN NULL; + END IF; + update placex set name = NEW.name, address = NEW.address, diff --git a/test/bdd/db/update/simple.feature b/test/bdd/db/update/simple.feature index 0833c90c..ecbb1244 100644 --- a/test/bdd/db/update/simple.feature +++ b/test/bdd/db/update/simple.feature @@ -69,3 +69,19 @@ Feature: Update of simple objects Then placex contains | object | class | type | | N3 | place | house | + + Scenario: remove boundary when changing from polygon to way + Given the grid + | 1 | 2 | + | 3 | 4 | + And the places + | osm | class | type | name | admin | geometry | + | W1 | boundary | administrative | Haha | 5 | (1, 2, 4, 3, 1) | + When importing + Then placex contains + | object | + | W1 | + When updating places + | osm | class | type | name | admin | geometry | + | W1 | boundary | administrative | Haha | 5 | 1, 2, 4, 3 | + Then placex has no entry for W1