[PostGIS] #5795: ST_NewEdgesSplit can cause invalid topology

PostGIS trac at osgeo.org
Thu Oct 10 15:52:41 PDT 2024


#5795: ST_NewEdgesSplit can cause invalid topology
-----------------------------+---------------------------
  Reporter:  Björn Harrtell  |      Owner:  strk
      Type:  defect          |     Status:  new
  Priority:  medium          |  Milestone:  PostGIS 3.5.1
 Component:  topology        |    Version:  3.4.x
Resolution:                  |   Keywords:
-----------------------------+---------------------------
Comment (by Björn Harrtell):

 Expanding on the example to this:

 {{{
 select topology.droptopology('test_topo');
 select topology.createtopology('test_topo', 0, 0);
 select topology.st_addisonode('test_topo', 0, st_geomfromtext('POINT(0
 0)'));
 select topology.st_addisonode('test_topo', 0, st_geomfromtext('POINT(10
 10)'));
 select topology.st_addisoedge('test_topo', 1, 2,
 st_geomfromtext('LINESTRING(0 0, 10 0, 10 10)'));
 select topology.st_addedgenewfaces('test_topo', 2, 1,
 st_geomfromtext('LINESTRING(10 10, 0 10, 0 0)'));
 select topology.st_newedgessplit('test_topo', 1, st_geomfromtext('POINT(5
 0)'));
 select topology.st_newedgessplit('test_topo', 4, st_geomfromtext('POINT(10
 5)'));
 select topology.st_addedgenewfaces('test_topo', 3, 4,
 st_geomfromtext('LINESTRING(5 0, 10 5)'));
 select topology.st_newedgessplit('test_topo', 7,
 st_geomfromtext('POINT(7.5 2.5)'));
 select topology.st_newedgessplit('test_topo', 5, st_geomfromtext('POINT(10
 2.5)'));
 select topology.st_addedgenewfaces('test_topo', 5, 6,
 st_geomfromtext('LINESTRING(7.5 2.5, 10 2.5)'));
 }}}

 Cause "SQL Error [XX000]: ERROR: Backend error (no ring edges for edge
 -12): Corrupted topology: ring of edge -12 is topologically non-closed"
 both before and after fix, so fix is no good.

 It can be reduced to:


 {{{
 select topology.droptopology('test_topo');
 select topology.createtopology('test_topo', 0, 0);
 select topology.st_addisonode('test_topo', 0, st_geomfromtext('POINT(0
 0)'));
 select topology.st_addisonode('test_topo', 0, st_geomfromtext('POINT(10
 10)'));
 select topology.st_addisoedge('test_topo', 1, 2,
 st_geomfromtext('LINESTRING(0 0, 10 0, 10 10)'));
 select topology.st_addedgenewfaces('test_topo', 2, 1,
 st_geomfromtext('LINESTRING(10 10, 0 10, 0 0)'));
 select topology.st_newedgessplit('test_topo', 1, st_geomfromtext('POINT(5
 0)'));
 select topology.st_newedgessplit('test_topo', 4, st_geomfromtext('POINT(10
 5)'));
 select topology.st_addedgenewfaces('test_topo', 3, 4,
 st_geomfromtext('LINESTRING(5 0, 10 5)'));
 select topology.st_newedgessplit('test_topo', 7,
 st_geomfromtext('POINT(7.5 2.5)'));
 select * from topology.validatetopology('test_topo');
 }}}

 Resulting in invalid "next_left_edge 5 -9" with fix and "invalid
 next_right_edge 2 -6".
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5795#comment:4>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list