[geos-devel] [GEOS] #760: Snapping leaves segments below tolerance

GEOS geos-trac at osgeo.org
Tue Dec 29 09:21:34 PST 2015


#760: Snapping leaves segments below tolerance
------------------------+---------------------------
 Reporter:  strk        |       Owner:  geos-devel@…
     Type:  defect      |      Status:  new
 Priority:  major       |   Milestone:  3.5.1
Component:  Default     |     Version:  3.5.0
 Severity:  Unassigned  |  Resolution:
 Keywords:              |
------------------------+---------------------------

Comment (by strk):

 I shell note the problem is dependent on order of vertices in the target
 point set.
 Here's a simpler input:
 {{{
 src: LINESTRING(0 0,0 20)
 tgt: LINESTRING(0.5 19,1 18,1.5 17)
 }}}

 Take the target in the given order and snapping is final after first
 iteration.
 Reverse the target and it takes 3 iterations to fully snap:

 {{{
  SELECT
    0.8 as tol,

    'LINESTRING(0 0,0 20)'
     ::geometry as src,

    'LINESTRING(0.5 19,1 18,1.5 17)'
     ::geometry as tgt
 )
 SELECT
  ST_AsText(src) src,
  ST_AsText(ST_Snap(src , tgt , tol)) snap1,
  ST_AsText(ST_Snap(ST_Snap(src , tgt , tol), tgt, tol)) snap2,
  ST_AsText(ST_Snap(ST_Snap(ST_Snap(src , tgt , tol), tgt, tol), tgt, tol))
 snap3,
  ST_AsText(ST_Snap(src , ST_Reverse(tgt) , tol)) snap1r,
  ST_AsText(ST_Snap(ST_Snap(src , ST_Reverse(tgt) , tol), ST_Reverse(tgt),
 tol)) snap2r,
  ST_AsText(ST_Snap(ST_Snap(ST_Snap(src , ST_Reverse(tgt) , tol),
 ST_Reverse(tgt), tol), ST_Reverse(tgt), tol)) snap3r,
  ST_Distance(src, ST_EndPoint(tgt)) dist_end,
  ST_Distance(src, ST_StartPoint(tgt)) dist_start,
  ST_Distance(src, ST_PointN(tgt,2)) dist_p2,
  ST_Distance(src, ST_PointN(tgt,3)) dist_p3
 FROM inp;
 -[ RECORD 1 ]---------------------------------------
 src        | LINESTRING(0 0,0 20)
 snap1      | LINESTRING(0 0,1.5 17,1 18,0.5 19,0 20)
 snap2      | LINESTRING(0 0,1.5 17,1 18,0.5 19,0 20)
 snap3      | LINESTRING(0 0,1.5 17,1 18,0.5 19,0 20)
 snap1r     | LINESTRING(0 0,0.5 19,0 20)
 snap2r     | LINESTRING(0 0,1 18,0.5 19,0 20)
 snap3r     | LINESTRING(0 0,1.5 17,1 18,0.5 19,0 20)
 dist_end   | 1.5
 dist_start | 0.5
 dist_p2    | 1
 dist_p3    | 1.5
 }}}

--
Ticket URL: <https://trac.osgeo.org/geos/ticket/760#comment:1>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list