From 1eb52879c6d3d4a4af42030b99fcdfdecb5dc541 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 25 Feb 2015 23:33:30 +0100 Subject: [PATCH] replace final reference to way-node index with spatial lookup --- sql/functions.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sql/functions.sql b/sql/functions.sql index 8c14dc6e..194a64d7 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1546,9 +1546,9 @@ BEGIN --RAISE WARNING 'x1'; -- Is this node part of a way? - FOR way IN select id from planet_osm_ways where nodes @> ARRAY[NEW.osm_id] LOOP ---RAISE WARNING '%', way; - FOR location IN select * from placex where osm_type = 'W' and osm_id = way.id + FOR location IN select p.* from placex p, planet_osm_ways w + where p.osm_type = 'W' and p.rank_search >= 26 + and p.geometry && NEW.geometry and p.osm_id = w.id and NEW.osm_id = any(w.nodes) LOOP --RAISE WARNING '%', location; -- Way IS a road then we are on it - that must be our road @@ -1599,7 +1599,6 @@ BEGIN END IF; END LOOP; - END LOOP; END IF;