also take place tags into account for address rank

An admin boundary might have a place tag but no matching place node.
We still should use the place value as indicator for the address
rank in this case.
This commit is contained in:
Sarah Hoffmann
2020-08-06 09:20:42 +02:00
parent 4ff0e20e1f
commit 5b9f61cff8

View File

@@ -534,6 +534,7 @@ DECLARE
centroid GEOMETRY;
parent_address_level SMALLINT;
place_address_level SMALLINT;
addr_street TEXT;
addr_place TEXT;
@@ -828,6 +829,17 @@ BEGIN
THEN
NEW.importance = linked_importance;
END IF;
ELSE
-- No linked place? As a last resort check if the boundary is tagged with
-- a place type and adapt the rank address.
IF NEW.rank_address > 0 and NEW.extratags ? 'place' THEN
SELECT address_rank INTO place_address_level
FROM compute_place_rank(NEW.country_code, 'A', 'place',
NEW.extratags->'place', 0::SMALLINT, False, null);
IF place_address_level > parent_address_level THEN
NEW.rank_address := place_address_level;
END IF;
END IF;
END IF;
-- Initialise the name vector using our name