[geos-devel] GeometrySnapper stability

Sandro Santilli strk at keybit.net
Wed Sep 21 10:08:24 EDT 2011


Martin, I've found that GeometrySnapper depends on the order
in which "snap points" are considered. Check this out:


 Tolerance:  1
  Input:     LINESTRING(0 0, 10 0)

  SnapGeom:  MULTIPOINT(5 0.8, 5 1.6)
    Result:  LINESTRING(0 0,5 1.6,5 0.8,10 0)

  SnapGeom:  MULTIPOINT(5 1.6, 5 0.8)
    Result:  LINESTRING(0 0,5 0.8,10 0)

It looks like in the first case the line was first snapped to the closest
point (0.8 units away) and then to the second point (1.6 away from the
original but 0.8 units away from the so-snapped geometry).

In the second case the code probably analyzed the further point first
(1.6 units away) and skipped it, subsequently only snapping to the one
within tolerance.

Another weird effect of that "incremental snapping" is that
multiple points close to each other can create back-and-forth
non-simple lines (thus non-valid polygons). Example:

 Tolerance:  1
  Input:     LINESTRING(0 0, 10 0)
  SnapGeom:  MULTIPOINT(10 0.2, 10 0.1, 10 0.3)
    Result:  LINESTRING(0 0,10 0.1,10 0.3,10 0.2)

So questions here are:

 1) Does JTS behave the same here ?
 2) Does JTS have XML based support for testing this ?
 3) Which of the above is the desired behavior ?

Thanks in advance.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html

--

what comes below this line is just spam, dont bother scrolling...




















































    still here ?





























More information about the geos-devel mailing list