[PostGIS] #5698: XX000: SQL/MM Spatial exception - point not on edge

PostGIS trac at osgeo.org
Fri Mar 22 04:32:55 PDT 2024


#5698: XX000: SQL/MM Spatial exception - point not on edge
--------------------------------+---------------------------
  Reporter:  Lars Aksel Opsahl  |      Owner:  strk
      Type:  defect             |     Status:  new
  Priority:  medium             |  Milestone:  PostGIS 3.4.3
 Component:  topology           |    Version:  3.4.x
Resolution:                     |   Keywords:
--------------------------------+---------------------------
Comment (by strk):

 According to ST_Distance the second line's end point is at a distance of
 ~6.68e-13 units from the start point of the first line and according to
 ST_Relate the lines do not intersect.

 If zero-tolerance was supported the above would result in adding 2
 disjoint edges.

 Instead PostGIS Topology computes an internal "working tolerance" based on
 the floating point grid and uses that as a tolerance. The internally
 computed working tolerance is ~2.49e-13

 Snapping the incoming line to the existing one, using the computed
 tolerance, results in adding a vertex to the incoming line:

 {{{
 LINESTRING(
   15.79762019616626 69.05719853383958, -- initially present
   15.796760167740288 69.05714853429149, -- first vertex of first line,
 added by snap
   15.796760167739626 69.05714853429157 -- initially present
 )
 }}}

 The so-snapped line is then split, resulting in two segments:

 LINESTRING(15.79762019616626 69.05719853383958,15.796760167740288
 69.05714853429149)
 LINESTRING(15.796760167740288 69.05714853429149,15.796760167739626
 69.05714853429157)

 It's to be noted that the second segment (from added vertex to end vertex
 of original line) has a length of 6.63e-13 units.

 The first segment gets in the topology correctly and gets edge identifier
 2.

 The second segment is what triggers the problem.

 This allows us to further reduce the testcase to only use the second
 (tiny) segment to the topology, to trigger the problem, which I confirm
 can be reproduced:
 {{{
 SELECT topology.CreateTopology ('ticket_5698');

 SELECT topology.TopoGeo_addLinestring('ticket_5698','LINESTRING(
 15.796760167740288 69.05714853429149,
 15.795906966300288 69.05725770093837)');

 SELECT topology.TopoGeo_addLinestring('ticket_5698', 'LINESTRING(
 15.796760167740288 69.05714853429149,
 15.796760167739626 69.05714853429157)');
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5698#comment:6>
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