]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 24 May 2013 21:38:19 +0000 (23:38 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 24 May 2013 21:38:19 +0000 (23:38 +0200)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index 8e5a63f41eac8220e78cd67b9a0e81f01a640e69,8593a3b1c9d3aaab051b8a6835ac860452b6d9fd..d254e33eddf324098884176302e0f3663ef8b780
@@@ -1094,10 -1094,10 +1094,10 @@@ BEGI
        ELSEIF NEW.type in ('national_park') THEN
          NEW.rank_search := 18;
          NEW.rank_address := 18;
-       ELSEIF NEW.type in ('suburb','croft','subdivision') THEN
+       ELSEIF NEW.type in ('suburb','croft','subdivision','isolated_dwelling') THEN
          NEW.rank_search := 20;
          NEW.rank_address := NEW.rank_search;
-       ELSEIF NEW.type in ('farm','locality','islet','isolated_dwelling','mountain_pass') THEN
+       ELSEIF NEW.type in ('farm','locality','islet','mountain_pass') THEN
          NEW.rank_search := 20;
          NEW.rank_address := 0;
          -- Irish townlands, tagged as place=locality and locality=townland
@@@ -1357,26 -1357,13 +1357,26 @@@ BEGI
      NEW.centroid := null;
  
      -- reclaculate country and partition
 -    IF NEW.rank_search >= 4 THEN
 -      --NEW.calculated_country_code := lower(get_country_code(NEW.geometry, NEW.country_code));
 -      NEW.calculated_country_code := lower(get_country_code(place_centroid));
 +    IF NEW.rank_search = 4 THEN
 +      -- for countries, believe the mapped country code,
 +      -- so that we remain in the right partition if the boundaries
 +      -- suddenly expand.
 +      NEW.partition := get_partition(place_centroid, lower(NEW.country_code));
 +      IF NEW.partition = 0 THEN
 +        NEW.calculated_country_code := lower(get_country_code(place_centroid));
 +        NEW.partition := get_partition(place_centroid, NEW.calculated_country_code);
 +      ELSE
 +        NEW.calculated_country_code := lower(NEW.country_code);
 +      END IF;
      ELSE
 -      NEW.calculated_country_code := NULL;
 +      IF NEW.rank_search > 4 THEN
 +        --NEW.calculated_country_code := lower(get_country_code(NEW.geometry, NEW.country_code));
 +        NEW.calculated_country_code := lower(get_country_code(place_centroid));
 +      ELSE
 +        NEW.calculated_country_code := NULL;
 +      END IF;
 +      NEW.partition := get_partition(place_centroid, NEW.calculated_country_code);
      END IF;
 -    NEW.partition := get_partition(place_centroid, NEW.calculated_country_code);
      NEW.geometry_sector := geometry_sector(NEW.partition, place_centroid);
  
      -- Adding ourselves to the list simplifies address calculations later