]> git.openstreetmap.org Git - nominatim.git/commitdiff
reintroduce addr:place for interpolation
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 15 May 2016 12:24:43 +0000 (14:24 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 15 May 2016 12:24:43 +0000 (14:24 +0200)
It is perfectly valid that interpolated addresses refer to
something else than a street.

Also gets rid of the maximum interpolation size. As we don't
expand, arbitrary sizes are fine.

sql/functions.sql
sql/tables.sql

index 8f2611d4f576fe963631dab346ef3ee7e6f9c24a..3403dfab902148447fbcd5abaa8d1f56acf8289d 100644 (file)
@@ -711,7 +711,7 @@ BEGIN
       endnumber := substring(nextnode.housenumber,'[0-9]+')::integer;
 
       IF startnumber IS NOT NULL AND endnumber IS NOT NULL
-         AND @(startnumber - endnumber) < 1000 AND startnumber != endnumber
+         AND startnumber != endnumber
          AND ST_GeometryType(sectiongeo) = 'ST_LineString' THEN
 
         IF (startnumber > endnumber) THEN
@@ -722,9 +722,12 @@ BEGIN
         END IF;
 
         insert into location_property_osmline
-          values (sectiongeo, nextval('seq_place'), partition, wayid, NULL, startnumber, endnumber, 
-          interpolationtype, street, coalesce(prevnode.postcode, defpostalcode),
-          calculated_country_code, geometry_sector, 2, now());
+          values (sectiongeo, nextval('seq_place'), partition, wayid, NULL,
+                  startnumber, endnumber, interpolationtype,
+                  coalesce(street, prevnode.street, nextnode.street),
+                  coalesce(addr_place, prevnode.addr_place, nextnode.addr_place),
+                  coalesce(defpostalcode, prevnode.postcode, nextnode.postcode),
+                  calculated_country_code, geometry_sector, 2, now());
       END IF;
 
       -- early break if we are out of line string,
@@ -1072,21 +1075,20 @@ BEGIN
     delete from location_property_osmline where place_id = OLD.place_id;
     RETURN NULL;
   END IF;
-  
+
   IF NEW.indexed_status != 0 OR OLD.indexed_status = 0 THEN
     RETURN NEW;
   END IF;
-  
-  IF OLD.indexed_status = 2 and NEW.indexed_status=0 THEN
-    -- do the reparenting: (finally here, because ALL places in placex, that are needed for reparenting, need to be up to date)
-    -- (the osm interpolationline in location_property_osmline was marked for reparenting in placex_insert/placex_delete with index_status = 2 
-    -- => index.c: sets index_status back to 0
-    -- => triggers this function)
-    place_centroid := ST_PointOnSurface(NEW.linegeo);
-    -- marking descendants for reparenting is not needed, because there are actually no descendants for interpolation lines
-    NEW.parent_place_id = get_interpolation_parent(NEW.osm_id, NEW.street, null, NEW.partition, place_centroid, NEW.linegeo); -- addr_place (3rd param) is not necessarily needed
-    return NEW;
-  END IF;
+
+  -- do the reparenting: (finally here, because ALL places in placex, that are needed for reparenting, need to be up to date)
+  -- (the osm interpolationline in location_property_osmline was marked for reparenting in placex_insert/placex_delete with index_status = 1 or 2 (1 inset, 2 delete)
+  -- => index.c: sets index_status back to 0
+  -- => triggers this function)
+  place_centroid := ST_PointOnSurface(NEW.linegeo);
+  -- marking descendants for reparenting is not needed, because there are actually no descendants for interpolation lines
+  NEW.parent_place_id = get_interpolation_parent(NEW.osm_id, NEW.street, NEW.addr_place,
+                                                 NEW.partition, place_centroid, NEW.linegeo);
+  return NEW;
 END;
 $$
 LANGUAGE plpgsql;
index 75129ce8984a9a00b08ec2662f670b7569a1234c..19398eb558f1cb3b546011a9273a5395d1af92ea 100644 (file)
@@ -95,6 +95,7 @@ CREATE TABLE location_property_osmline (
     endnumber INTEGER,
     interpolationtype TEXT,
     street TEXT,
+    addr_place TEXT,
     postcode TEXT,
     calculated_country_code VARCHAR(2),
     geometry_sector INTEGER,