[geos-devel] Re: [GEOS] #501: Snap operation: wrong snapping

GEOS geos-trac at osgeo.org
Wed Dec 21 03:29:16 EST 2011


#501: Snap operation: wrong snapping
------------------------+---------------------------------------------------
 Reporter:  aperi2007   |       Owner:  geos-devel@…              
     Type:  defect      |      Status:  new                       
 Priority:  major       |   Milestone:  GEOS Future               
Component:  Default     |     Version:  svn-trunk                 
 Severity:  Unassigned  |    Keywords:  jtsfail                   
------------------------+---------------------------------------------------

Comment(by strk):

 I report a schema of the problem described in the bug.


 The input (A-B) and the snap points (S1,S2):

 {{{
  A            B    S2
  *------------*    *
              S1
 }}}

 The figure produced by current algorithm (A-S2-B):

 {{{
  A            B    S2
  *------------*<-->*
               S1
 }}}

 The above happens because vertex snapping for B
 gives up when finding S1 being == B and later
 segment snapping finds S2 first (for some reason)
 and thus produces the invalid overstrike.
 Note that inverting the order of S1 and S2 in input
 fixes the issue:

 {{{
 =# select st_astext(st_snap('LINESTRING(0 0, 10 0)', 'MULTIPOINT(10 0, 11
 0)', 2));
          st_astext
 ---------------------------
  LINESTRING(0 0,11 0,10 0)


 =# select st_astext(st_snap('LINESTRING(0 0, 10 0)', 'MULTIPOINT(11 0, 10
 0)', 2));
          st_astext
 ---------------------------
  LINESTRING(0 0,10 0,11 0)
 }}}

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


More information about the geos-devel mailing list