diff --git a/topology/sql/populate.sql b/topology/sql/populate.sql index a4ea7ced3..7f4a0ddbe 100644 --- a/topology/sql/populate.sql +++ b/topology/sql/populate.sql @@ -261,11 +261,10 @@ BEGIN -- they have puntual intersection between interiors -- -- compute intersection, check it's a single point - -- and equals first StartPoint _and_ second StartPoint + -- and equals first's StartPoint _and_ second's StartPoint IF ST_Equals(ST_Intersection(rec.geom, aline), - ST_StartPoint(aline)) OR - ST_Equals(ST_Intersection(rec.geom, aline), - ST_EndPoint(aline)) + ST_StartPoint(aline)) AND + ST_Equals(ST_StartPoint(aline), ST_StartPoint(rec.geom)) THEN RAISE DEBUG 'Closed edge shares boundary with existing closed edge %', diff --git a/topology/test/regress/addedge.sql b/topology/test/regress/addedge.sql index 7f042ae44..e02b93ae6 100644 --- a/topology/test/regress/addedge.sql +++ b/topology/test/regress/addedge.sql @@ -52,6 +52,9 @@ SELECT '#770-2', topology.addEdge('tt', 'LINESTRING(8 10, 9 8, 10 9, 8 10)'); SELECT '#770-*', topology.addEdge('tt', 'LINESTRING(8 10, 8 12, 10 12)'); -- same as above, but this time the new edge is closed too SELECT '#770-*', topology.addEdge('tt', 'LINESTRING(8 10, 7 13, 10 12, 8 12, 10 12)'); +-- once again, but the intersection is now at the new edge endpoint +-- (not the existing edge endpoint) +SELECT '#770-*', topology.addEdge('tt', 'LINESTRING(10 12, 11 12, 10 13, 10 12)'); SELECT edge_id, left_face, right_face, next_left_edge, next_right_edge, diff --git a/topology/test/regress/addedge_expected b/topology/test/regress/addedge_expected index 2cadd19bb..9ca16ce8e 100644 --- a/topology/test/regress/addedge_expected +++ b/topology/test/regress/addedge_expected @@ -19,6 +19,7 @@ e6|6 #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 1|0|0|1|1|LINESTRING(0 0,8 0) 2|0|0|2|2|LINESTRING(8 0,8 10) 3|0|0|3|3|LINESTRING(0 0,0 10)