]> git.openstreetmap.org Git - nominatim.git/commitdiff
Remove boundries when downgrading from polygon to line
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 6 Jun 2017 19:58:41 +0000 (21:58 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 6 Jun 2017 19:59:36 +0000 (21:59 +0200)
Fixes #135.

sql/functions.sql
test/bdd/db/update/simple.feature

index d863a9bf5e91639577633c320ecc609302f6346e..9dbc6fe0438067731d7c8a1c0f862790d5e8af9b 100644 (file)
@@ -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,
index 0833c90c9248427beca621182980751579c058cd..ecbb1244c7caab45a1e90c25758062b4e065fa95 100644 (file)
@@ -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