linking: better name matching for address-less places

Administrative boundaries that do not figure in the address
should still be able to take part in the name matching.
Use the rank_search for comparison in this case.
This commit is contained in:
Sarah Hoffmann
2020-03-21 21:57:04 +01:00
parent ce5870223a
commit 3db2b05069

View File

@@ -253,7 +253,8 @@ BEGIN
FOR linked_placex IN
SELECT placex.* from placex
WHERE make_standard_name(name->'name') = bnd_name
AND placex.rank_address = bnd.rank_address
AND ((bnd.rank_address > 0 and placex.rank_address = bnd.rank_address)
OR (bnd.rank_address = 0 and placex.rank_search = bnd.rank_search))
AND placex.osm_type = 'N'
AND placex.rank_search < 26 -- needed to select the right index
AND _st_covers(bnd.geometry, placex.geometry)