]> granicus.if.org Git - postgis/commitdiff
topology.AddEdge: when an intersection occurs, also report intersection point [RT...
authorSandro Santilli <strk@keybit.net>
Thu, 27 Jan 2011 08:48:11 +0000 (08:48 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 27 Jan 2011 08:48:11 +0000 (08:48 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6739 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/populate.sql
topology/test/regress/addedge_expected

index 49b05378d90b7bec968182f4c4e7a1811d663e28..1e124ac7513cbe0d490caab633759821932ec064 100644 (file)
@@ -142,6 +142,7 @@ DECLARE
        aline ALIAS FOR $2;
        edgeid int;
        rec RECORD;
+  ix geometry; 
 BEGIN
        --
        -- Atopology and apoint are required
@@ -294,9 +295,18 @@ BEGIN
         RETURN rec.edge_id;
     END IF;
 
-         RAISE EXCEPTION 'Edge intersects (not on endpoints) with existing edge % ', rec.edge_id;
+    -- WARNING: the constructive operation might throw an exception
+    BEGIN
+      ix = ST_Intersection(rec.geom, aline);
+    EXCEPTION
+      WHEN OTHERS THEN
+        RAISE NOTICE 'Could not compute intersection between input edge (%) and edge % (%)', aline::text, rec.edge_id, rec.geom::text;
+      
+    END;
 
-       END LOOP;
+         RAISE EXCEPTION 'Edge intersects (not on endpoints) with existing edge % at or near point %', rec.edge_id, ST_AsText(ST_PointOnSurface(ix));
+
+  END LOOP;
 
        --
        -- Get new edge id from sequence
index 2793fa1a8ec9e7cab6043c1201ff9aa645d539b9..f381ca3724b8e251a495e6fe32586ed937c61454 100644 (file)
@@ -1,15 +1,15 @@
 t
 e1|1
 e*1|1
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
-ERROR:  Edge intersects (not on endpoints) with existing edge 1 
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(1 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(1 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(1 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(0 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(0 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(5 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(5 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(0 0)
+ERROR:  Edge intersects (not on endpoints) with existing edge 1 at or near point POINT(5 0)
 e2|2
 e3|3
 e4|4
@@ -17,9 +17,9 @@ e5|5
 e6|6
 #770-1|7
 #770-2|8
-ERROR:  Edge intersects (not on endpoints) with existing edge 7 
-ERROR:  Edge intersects (not on endpoints) with existing edge 7 
-ERROR:  Edge intersects (not on endpoints) with existing edge 7 
+ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(8 10)
+ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(8 10)
+ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(10 12)
 #770-1*|7
 1|0|0|1|1|LINESTRING(0 0,8 0)
 2|0|0|2|2|LINESTRING(8 0,8 10)