mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-23 21:54:10 +03:00
demote place nodes in admin areas
If a place node of city rank and above finds itself in an administrative boundary of the same address rank, then increase the address rank by 2. This catches the rather frequent case where city suburbs are tagged for historical reasons as towns or villages.
This commit is contained in:
parent
c66f701232
commit
b04463bb2d
@ -624,6 +624,21 @@ BEGIN
|
||||
NEW.rank_address := parent_address_level + 2;
|
||||
END IF;
|
||||
END IF;
|
||||
-- If a place node is contained in a admin boundary with the same address level
|
||||
-- and has not been linked, then make the node a subpart by increasing the
|
||||
-- address rank (city level and above).
|
||||
ELSEIF NEW.class = 'place' and NEW.osm_type = 'N'
|
||||
and NEW.rank_address between 16 and 23
|
||||
THEN
|
||||
FOR location IN
|
||||
SELECT rank_address FROM placex
|
||||
WHERE osm_type = 'R' and class = 'boundary' and type = 'administrative'
|
||||
and rank_address = NEW.rank_address
|
||||
and geometry && NEW.centroid and _ST_Covers(geometry, NEW.centroid)
|
||||
LIMIT 1
|
||||
LOOP
|
||||
NEW.rank_address = NEW.rank_address + 2;
|
||||
END LOOP;
|
||||
ELSE
|
||||
parent_address_level := 3;
|
||||
END IF;
|
||||
|
Loading…
Reference in New Issue
Block a user