From 066e6d140e1c2c8ba869a289cfaaf3f053909915 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 7 Mar 2011 11:05:13 +0000 Subject: [PATCH] Avoid using ST_SharedPath (expensive) git-svn-id: http://svn.osgeo.org/postgis/trunk@6880 b70326c6-7e19-0410-871a-916f4a2858ee --- topology/sql/gml.sql | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/topology/sql/gml.sql b/topology/sql/gml.sql index 83a458001..562b609c8 100644 --- a/topology/sql/gml.sql +++ b/topology/sql/gml.sql @@ -208,7 +208,10 @@ BEGIN FOR rec2 IN EXECUTE 'SELECT e.*, ST_Line_Locate_Point(' || quote_literal(bounds::text) - || ', ST_Line_Interpolate_Point(e.geom, 0.2)) as pos FROM ' + || ', ST_Line_Interpolate_Point(e.geom, 0.2)) as pos' + || ', ST_Line_Locate_Point(' + || quote_literal(bounds::text) + || ', ST_Line_Interpolate_Point(e.geom, 0.8)) as pos2 FROM ' || quote_ident(toponame) || '.edge e WHERE ( e.left_face = ' || face_id || ' OR e.right_face = ' || face_id @@ -221,10 +224,7 @@ BEGIN -- if this edge goes in same direction to the -- ring bounds, make it with negative orientation - SELECT DISTINCT (ST_Dump( - ST_SharedPaths(rec2.geom, bounds)) - ).path[1] into side; - IF side = 1 THEN -- edge goes in same direction + IF rec2.pos2 > rec2.pos THEN -- edge goes in same direction gml = gml || ' orientation="-"'; END IF; @@ -360,7 +360,10 @@ BEGIN FOR rec2 IN EXECUTE 'SELECT e.*, ST_Line_Locate_Point(' || quote_literal(rec.geom::text) - || ', ST_Line_Interpolate_Point(e.geom, 0.2)) as pos FROM ' + || ', ST_Line_Interpolate_Point(e.geom, 0.2)) as pos' + || ', ST_Line_Locate_Point(' + || quote_literal(rec.geom::text) + || ', ST_Line_Interpolate_Point(e.geom, 0.8)) as pos2 FROM ' || quote_ident(toponame) || '.edge e WHERE ST_Covers(' || quote_literal(rec.geom::text) @@ -372,10 +375,7 @@ BEGIN -- if this edge goes in opposite direction to the -- line, make it with negative orientation - SELECT DISTINCT (ST_Dump( - ST_SharedPaths(rec2.geom, rec.geom)) - ).path[1] into side; - IF side = 2 THEN -- edge goes in opposite direction + IF rec2.pos2 < rec2.pos THEN -- edge goes in opposite direction gml = gml || ' orientation="-"'; END IF; -- 2.50.1