add unknown addr:place to address output

When a POI has no addr:street but an addr:place that is not
contained in the name list of the parent place, then remember
this situation and merge the content of addr:place into the
address output.

We don't need to care about translations in this case because
it is obvious that no object with translations exists if the
parent isn't the object named in addr:place.
This commit is contained in:
Sarah Hoffmann
2020-09-23 11:55:18 +02:00
parent f2ff351da4
commit c84e7e72f1
3 changed files with 41 additions and 23 deletions

View File

@@ -575,6 +575,7 @@ BEGIN
-- update not necessary for osmline, cause linked_place_id does not exist
NEW.extratags := NEW.extratags - 'linked_place'::TEXT;
NEW.address := NEW.address - '_unlisted_place'::TEXT;
IF NEW.linked_place_id is not null THEN
--DEBUG: RAISE WARNING 'place already linked to %', NEW.linked_place_id;
@@ -740,9 +741,18 @@ BEGIN
IF NEW.parent_place_id is not null THEN
-- Get the details of the parent road
SELECT p.country_code, p.postcode FROM placex p
SELECT p.country_code, p.postcode, p.name FROM placex p
WHERE p.place_id = NEW.parent_place_id INTO location;
IF addr_street is null and addr_place is not null THEN
-- Check if the addr:place tag is part of the parent name
SELECT count(*) INTO i
FROM svals(location.name) AS pname WHERE pname = addr_place;
IF i = 0 THEN
NEW.address = NEW.address || hstore('_unlisted_place', addr_place);
END IF;
END IF;
NEW.country_code := location.country_code;
--DEBUG: RAISE WARNING 'Got parent details from search name';