reintroduce addr:place for interpolation

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.
This commit is contained in:
Sarah Hoffmann
2016-05-15 14:24:43 +02:00
parent 2a0c7fb57a
commit 8b91284f7f
2 changed files with 19 additions and 16 deletions

View File

@@ -711,7 +711,7 @@ BEGIN
endnumber := substring(nextnode.housenumber,'[0-9]+')::integer; endnumber := substring(nextnode.housenumber,'[0-9]+')::integer;
IF startnumber IS NOT NULL AND endnumber IS NOT NULL 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 AND ST_GeometryType(sectiongeo) = 'ST_LineString' THEN
IF (startnumber > endnumber) THEN IF (startnumber > endnumber) THEN
@@ -722,9 +722,12 @@ BEGIN
END IF; END IF;
insert into location_property_osmline insert into location_property_osmline
values (sectiongeo, nextval('seq_place'), partition, wayid, NULL, startnumber, endnumber, values (sectiongeo, nextval('seq_place'), partition, wayid, NULL,
interpolationtype, street, coalesce(prevnode.postcode, defpostalcode), startnumber, endnumber, interpolationtype,
calculated_country_code, geometry_sector, 2, now()); 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; END IF;
-- early break if we are out of line string, -- early break if we are out of line string,
@@ -1077,16 +1080,15 @@ BEGIN
RETURN NEW; RETURN NEW;
END IF; 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)
-- 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)
-- (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
-- => index.c: sets index_status back to 0 -- => triggers this function)
-- => triggers this function) place_centroid := ST_PointOnSurface(NEW.linegeo);
place_centroid := ST_PointOnSurface(NEW.linegeo); -- marking descendants for reparenting is not needed, because there are actually no descendants for interpolation lines
-- 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.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 NEW.partition, place_centroid, NEW.linegeo);
return NEW; return NEW;
END IF;
END; END;
$$ $$
LANGUAGE plpgsql; LANGUAGE plpgsql;

View File

@@ -95,6 +95,7 @@ CREATE TABLE location_property_osmline (
endnumber INTEGER, endnumber INTEGER,
interpolationtype TEXT, interpolationtype TEXT,
street TEXT, street TEXT,
addr_place TEXT,
postcode TEXT, postcode TEXT,
calculated_country_code VARCHAR(2), calculated_country_code VARCHAR(2),
geometry_sector INTEGER, geometry_sector INTEGER,