]> git.openstreetmap.org Git - nominatim.git/commitdiff
address rank adjustment for addressable boundaries only
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Sep 2020 15:59:26 +0000 (17:59 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Sep 2020 15:59:26 +0000 (17:59 +0200)
Only administrative boundaries with an address rank need
to be adjusted. Otherwise just handle them like any other
object.

sql/functions/placex_triggers.sql

index 38b3421f7bff8f7c60a35c337d358c267707e1c1..dc96efd4664976d6f14d6aac9051b551c3677f76 100644 (file)
@@ -596,7 +596,9 @@ BEGIN
                             (NEW.extratags->'capital') = 'yes',
                             NEW.address->'postcode');
   -- We must always increase the address level relative to the admin boundary.
                             (NEW.extratags->'capital') = 'yes',
                             NEW.address->'postcode');
   -- We must always increase the address level relative to the admin boundary.
-  IF NEW.class = 'boundary' and NEW.type = 'administrative' and NEW.osm_type = 'R' THEN
+  IF NEW.class = 'boundary' and NEW.type = 'administrative'
+     and NEW.osm_type = 'R' and NEW.rank_address > 0
+  THEN
     parent_address_level := get_parent_address_level(NEW.centroid, NEW.admin_level);
     IF parent_address_level >= NEW.rank_address THEN
       IF parent_address_level >= 24 THEN
     parent_address_level := get_parent_address_level(NEW.centroid, NEW.admin_level);
     IF parent_address_level >= NEW.rank_address THEN
       IF parent_address_level >= 24 THEN