mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
fix use of geometry operators
@ is contained by while ~ is contains.
This commit is contained in:
@@ -507,7 +507,7 @@ BEGIN
|
|||||||
FROM placex
|
FROM placex
|
||||||
WHERE osm_type = 'R' and class = 'boundary' and type = 'administrative'
|
WHERE osm_type = 'R' and class = 'boundary' and type = 'administrative'
|
||||||
and admin_level < in_level
|
and admin_level < in_level
|
||||||
and geometry && geom and ST_Covers(geometry, geom)
|
and geometry ~ geom and _ST_Covers(geometry, geom)
|
||||||
ORDER BY admin_level desc LIMIT 1;
|
ORDER BY admin_level desc LIMIT 1;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
@@ -624,7 +624,7 @@ BEGIN
|
|||||||
SELECT rank_address FROM placex
|
SELECT rank_address FROM placex
|
||||||
WHERE class = 'place' and rank_address < 24
|
WHERE class = 'place' and rank_address < 24
|
||||||
and rank_address > NEW.rank_address
|
and rank_address > NEW.rank_address
|
||||||
and geometry && NEW.geometry
|
and geometry ~ NEW.geometry
|
||||||
and ST_Relate(geometry, NEW.geometry, 'T*T***FF*') -- contains but not equal
|
and ST_Relate(geometry, NEW.geometry, 'T*T***FF*') -- contains but not equal
|
||||||
ORDER BY rank_address desc LIMIT 1
|
ORDER BY rank_address desc LIMIT 1
|
||||||
LOOP
|
LOOP
|
||||||
@@ -640,7 +640,7 @@ BEGIN
|
|||||||
SELECT rank_address FROM placex
|
SELECT rank_address FROM placex
|
||||||
WHERE osm_type = 'R' and class = 'boundary' and type = 'administrative'
|
WHERE osm_type = 'R' and class = 'boundary' and type = 'administrative'
|
||||||
and rank_address = NEW.rank_address
|
and rank_address = NEW.rank_address
|
||||||
and geometry && NEW.centroid and _ST_Covers(geometry, NEW.centroid)
|
and geometry ~ NEW.centroid and _ST_Covers(geometry, NEW.centroid)
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
LOOP
|
LOOP
|
||||||
NEW.rank_address = NEW.rank_address + 2;
|
NEW.rank_address = NEW.rank_address + 2;
|
||||||
@@ -743,10 +743,10 @@ BEGIN
|
|||||||
IF NEW.osm_type = 'N' AND addr_street IS NULL AND addr_place IS NULL
|
IF NEW.osm_type = 'N' AND addr_street IS NULL AND addr_place IS NULL
|
||||||
AND NEW.housenumber IS NULL THEN
|
AND NEW.housenumber IS NULL THEN
|
||||||
FOR location IN
|
FOR location IN
|
||||||
-- The additional && condition works around the misguided query
|
-- The additional ~ condition works around the misguided query
|
||||||
-- planner of postgis 3.0.
|
-- planner of postgis 3.0.
|
||||||
SELECT address from placex where ST_Covers(geometry, NEW.centroid)
|
SELECT address from placex where ST_Covers(geometry, NEW.centroid)
|
||||||
and geometry && NEW.centroid
|
and geometry ~ NEW.centroid
|
||||||
and (address ? 'housenumber' or address ? 'street' or address ? 'place')
|
and (address ? 'housenumber' or address ? 'street' or address ? 'place')
|
||||||
and rank_search > 28 AND ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon')
|
and rank_search > 28 AND ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon')
|
||||||
limit 1
|
limit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user