mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 18:37:58 +00:00
Compare commits
3 Commits
e578c60ff4
...
1df56d7548
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1df56d7548 | ||
|
|
9cfef7a31a | ||
|
|
139678f367 |
@@ -341,6 +341,22 @@ BEGIN
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
IF bnd.extratags ? 'wikidata' THEN
|
||||
FOR linked_placex IN
|
||||
SELECT * FROM placex
|
||||
WHERE placex.class = 'place' AND placex.osm_type = 'N'
|
||||
AND placex.extratags ? 'wikidata' -- needed to select right index
|
||||
AND placex.extratags->'wikidata' = bnd.extratags->'wikidata'
|
||||
AND (placex.linked_place_id is null or placex.linked_place_id = bnd.place_id)
|
||||
AND placex.rank_search < 26
|
||||
AND _st_covers(bnd.geometry, placex.geometry)
|
||||
ORDER BY lower(name->'name') = bnd_name desc
|
||||
LOOP
|
||||
{% if debug %}RAISE WARNING 'Found wikidata-matching place node %', linked_placex.osm_id;{% endif %}
|
||||
RETURN linked_placex;
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
||||
-- If extratags has a place tag, look for linked nodes by their place type.
|
||||
-- Area and node still have to have the same name.
|
||||
IF bnd.extratags ? 'place' and bnd.extratags->'place' != 'postcode'
|
||||
@@ -361,22 +377,6 @@ BEGIN
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
||||
IF bnd.extratags ? 'wikidata' THEN
|
||||
FOR linked_placex IN
|
||||
SELECT * FROM placex
|
||||
WHERE placex.class = 'place' AND placex.osm_type = 'N'
|
||||
AND placex.extratags ? 'wikidata' -- needed to select right index
|
||||
AND placex.extratags->'wikidata' = bnd.extratags->'wikidata'
|
||||
AND (placex.linked_place_id is null or placex.linked_place_id = bnd.place_id)
|
||||
AND placex.rank_search < 26
|
||||
AND _st_covers(bnd.geometry, placex.geometry)
|
||||
ORDER BY lower(name->'name') = bnd_name desc
|
||||
LOOP
|
||||
{% if debug %}RAISE WARNING 'Found wikidata-matching place node %', linked_placex.osm_id;{% endif %}
|
||||
RETURN linked_placex;
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
||||
-- Name searches can be done for ways as well as relations
|
||||
IF bnd_name is not null THEN
|
||||
{% if debug %}RAISE WARNING 'Looking for nodes with matching names';{% endif %}
|
||||
@@ -874,7 +874,7 @@ BEGIN
|
||||
-- Remove linkage, if we have computed a different new linkee.
|
||||
UPDATE placex SET linked_place_id = null, indexed_status = 2
|
||||
WHERE linked_place_id = NEW.place_id
|
||||
and (linked_place is null or linked_place_id != linked_place);
|
||||
and (linked_place is null or place_id != linked_place);
|
||||
-- update not necessary for osmline, cause linked_place_id does not exist
|
||||
|
||||
-- Postcodes are just here to compute the centroids. They are not searchable
|
||||
|
||||
Reference in New Issue
Block a user