]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 11 Feb 2015 21:34:18 +0000 (22:34 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 11 Feb 2015 21:34:18 +0000 (22:34 +0100)
osm2pgsql
sql/functions.sql
tests/features/osm2pgsql/update/relation.feature

index accc3eff0ef8799a116d3d2b46be204de8b60e19..10c274f851b63547d8e1a194231a67f8f0f8aed6 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit accc3eff0ef8799a116d3d2b46be204de8b60e19
+Subproject commit 10c274f851b63547d8e1a194231a67f8f0f8aed6
index b4ecdad84c33c2146e079243c166f54c33c230d6..29e6544c4500014a8c9f5161dea5ee674b25cfde 100644 (file)
@@ -1252,6 +1252,7 @@ DECLARE
   location_distance FLOAT;
   location_parent GEOMETRY;
   location_isaddress BOOLEAN;
+  location_keywords INTEGER[];
 
   tagpairid INTEGER;
 
@@ -1798,10 +1799,26 @@ BEGIN
 
       IF location.rank_address != location_rank_search THEN
         location_rank_search := location.rank_address;
-        location_distance := location.distance * 1.5;
+        IF location.isguess THEN
+          location_distance := location.distance * 1.5;
+        ELSE
+          IF location.rank_address <= 12 THEN
+            -- for county and above, if we have an area consider that exact
+            -- (It would be nice to relax the constraint for places close to
+            --  the boundary but we'd need the exact geometry for that. Too
+            --  expensive.)
+            location_distance = 0;
+          ELSE
+            -- Below county level remain slightly fuzzy.
+            location_distance := location.distance * 0.5;
+          END IF;
+        END IF;
+      ELSE
+        CONTINUE WHEN location.keywords <@ location_keywords;
       END IF;
 
       IF location.distance < location_distance OR NOT location.isguess THEN
+        location_keywords := location.keywords;
 
         location_isaddress := NOT address_havelevel[location.rank_address];
         IF location_isaddress AND location.isguess AND location_parent IS NOT NULL THEN
index 2e6f9d8add192389cd1a2080e688cacae5f70e90..f7bf53aa2e7c4a80aede9211328e1e263ed30cf8 100644 (file)
@@ -28,3 +28,125 @@ Scenario: Remove all members of a relation
           When updating osm data
         Then table place has no entry for R1
 
+
+Scenario: Change type of a relation
+        Given the osm nodes:
+          | id  | geometry
+          | 200 | 0 0
+          | 201 | 0 0.0001
+          | 202 | 0.0001 0.0001
+          | 203 | 0.0001 0
+        Given the osm ways:
+          | id | tags                             | nodes
+          | 2  | 'ref' : '45'                     | 200 201 202 203 200
+        Given the osm relations:
+          | id | tags                                                        | members
+          | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+        When loading osm data
+        Then table place contains
+          | object | class   | type   | name
+          | R1     | tourism | hotel  | 'name' : 'XZ'
+        Given the osm relations:
+          | action | id | tags                                                        | members
+          | M      | 1  | 'type' : 'multipolygon', 'amenity' : 'prison', 'name' : 'XZ' | W2
+          When updating osm data
+        Then table place has no entry for R1:tourism
+        And table place contains
+          | object | class   | type   | name
+          | R1     | amenity | prison | 'name' : 'XZ'
+
+Scenario: Change name of a relation
+        Given the osm nodes:
+          | id  | geometry
+          | 200 | 0 0
+          | 201 | 0 0.0001
+          | 202 | 0.0001 0.0001
+          | 203 | 0.0001 0
+        Given the osm ways:
+          | id | tags                             | nodes
+          | 2  | 'ref' : '45'                     | 200 201 202 203 200
+        Given the osm relations:
+          | id | tags                                                        | members
+          | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'AB' | W2
+        When loading osm data
+        Then table place contains
+          | object | class   | type   | name
+          | R1     | tourism | hotel  | 'name' : 'AB'
+        Given the osm relations:
+          | action | id | tags                                                        | members
+          | M      | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+        When updating osm data
+        Then table place contains
+          | object | class   | type   | name
+          | R1     | tourism | hotel  | 'name' : 'XZ'
+
+
+Scenario: Change type of a relation into something unknown
+        Given the osm nodes:
+          | id  | geometry
+          | 200 | 0 0
+          | 201 | 0 0.0001
+          | 202 | 0.0001 0.0001
+          | 203 | 0.0001 0
+        Given the osm ways:
+          | id | tags                             | nodes
+          | 2  | 'ref' : '45'                     | 200 201 202 203 200
+        Given the osm relations:
+          | id | tags                                                        | members
+          | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+        When loading osm data
+        Then table place contains
+          | object | class   | type   | name
+          | R1     | tourism | hotel  | 'name' : 'XZ'
+        Given the osm relations:
+          | action | id | tags                                                        | members
+          | M      | 1  | 'type' : 'multipolygon', 'amenities' : 'prison', 'name' : 'XZ' | W2
+          When updating osm data
+        Then table place has no entry for R1
+
+Scenario: Type tag is removed
+        Given the osm nodes:
+          | id  | geometry
+          | 200 | 0 0
+          | 201 | 0 0.0001
+          | 202 | 0.0001 0.0001
+          | 203 | 0.0001 0
+        Given the osm ways:
+          | id | tags                             | nodes
+          | 2  | 'ref' : '45'                     | 200 201 202 203 200
+        Given the osm relations:
+          | id | tags                                                        | members
+          | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+        When loading osm data
+        Then table place contains
+          | object | class   | type   | name
+          | R1     | tourism | hotel  | 'name' : 'XZ'
+        Given the osm relations:
+          | action | id | tags                               | members
+          | M      | 1  | 'tourism' : 'hotel', 'name' : 'XZ' | W2
+          When updating osm data
+        Then table place has no entry for R1
+
+Scenario: Type tag is renamed to something unknown
+        Given the osm nodes:
+          | id  | geometry
+          | 200 | 0 0
+          | 201 | 0 0.0001
+          | 202 | 0.0001 0.0001
+          | 203 | 0.0001 0
+        Given the osm ways:
+          | id | tags                             | nodes
+          | 2  | 'ref' : '45'                     | 200 201 202 203 200
+        Given the osm relations:
+          | id | tags                                                        | members
+          | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+        When loading osm data
+        Then table place contains
+          | object | class   | type   | name
+          | R1     | tourism | hotel  | 'name' : 'XZ'
+        Given the osm relations:
+          | action | id | tags                               | members
+          | M      | 1  | 'type' : 'multipolygonn', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+          When updating osm data
+        Then table place has no entry for R1
+