mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
restrict linked places to place nodes
Avoids getting the wrong entry when the linked place has double tagging. Fixes #573.
This commit is contained in:
@@ -1492,7 +1492,8 @@ BEGIN
|
|||||||
FOR relMember IN select get_osm_rel_members(relation_members,ARRAY['label']) as member LOOP
|
FOR relMember IN select get_osm_rel_members(relation_members,ARRAY['label']) as member LOOP
|
||||||
|
|
||||||
FOR linkedPlacex IN select * from placex where osm_type = upper(substring(relMember.member,1,1))::char(1)
|
FOR linkedPlacex IN select * from placex where osm_type = upper(substring(relMember.member,1,1))::char(1)
|
||||||
and osm_id = substring(relMember.member,2,10000)::bigint order by rank_search desc limit 1 LOOP
|
and osm_id = substring(relMember.member,2,10000)::bigint
|
||||||
|
and class = 'place' order by rank_search desc limit 1 LOOP
|
||||||
|
|
||||||
-- If we don't already have one use this as the centre point of the geometry
|
-- If we don't already have one use this as the centre point of the geometry
|
||||||
IF NEW.centroid IS NULL THEN
|
IF NEW.centroid IS NULL THEN
|
||||||
@@ -1523,7 +1524,8 @@ BEGIN
|
|||||||
FOR relMember IN select get_osm_rel_members(relation_members,ARRAY['admin_center','admin_centre']) as member LOOP
|
FOR relMember IN select get_osm_rel_members(relation_members,ARRAY['admin_center','admin_centre']) as member LOOP
|
||||||
|
|
||||||
FOR linkedPlacex IN select * from placex where osm_type = upper(substring(relMember.member,1,1))::char(1)
|
FOR linkedPlacex IN select * from placex where osm_type = upper(substring(relMember.member,1,1))::char(1)
|
||||||
and osm_id = substring(relMember.member,2,10000)::bigint order by rank_search desc limit 1 LOOP
|
and osm_id = substring(relMember.member,2,10000)::bigint
|
||||||
|
and class = 'place' order by rank_search desc limit 1 LOOP
|
||||||
|
|
||||||
-- For an admin centre we also want a name match - still not perfect, for example 'new york, new york'
|
-- For an admin centre we also want a name match - still not perfect, for example 'new york, new york'
|
||||||
-- But that can be fixed by explicitly setting the label in the data
|
-- But that can be fixed by explicitly setting the label in the data
|
||||||
|
|||||||
@@ -108,3 +108,22 @@ Feature: Linking of places
|
|||||||
Then results contain
|
Then results contain
|
||||||
| osm_type |
|
| osm_type |
|
||||||
| W |
|
| W |
|
||||||
|
|
||||||
|
# github #573
|
||||||
|
Scenario: Boundaries should only be linked to places
|
||||||
|
Given the named places
|
||||||
|
| osm | class | type | extra+wikidata | admin | geometry |
|
||||||
|
| R1 | boundary | administrative | 34 | 8 | poly-area:0.1 |
|
||||||
|
And the named places
|
||||||
|
| osm | class | type | geometry |
|
||||||
|
| N3 | natural | island | 0.00001 0 |
|
||||||
|
| N3 | place | city | 0.00001 0 |
|
||||||
|
And the relations
|
||||||
|
| id | members |
|
||||||
|
| 1 | N3:label |
|
||||||
|
When importing
|
||||||
|
Then placex contains
|
||||||
|
| object | linked_place_id |
|
||||||
|
| N3:natural | - |
|
||||||
|
| N3:place | R1 |
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user