Hi,
Im trying snap overlay capabilities of JTS 1.8, and Im getting a strange result (or its possible I dont understand well the concept of "PrecisionModel").

The code is:

String wktLS1 = "LINESTRING (260 120, 300 180, 420 180, 480 120)";
String wktLS2 = "LINESTRING (479.999 120, 459 114, 437 128, 426 130, 458 141)";

GeometryFactory factory = new GeometryFactory();
WKTReader wktReader = new WKTReader(factory);
Geometry ls1 = wktReader.read(wktLS1);
Geometry ls2 = wktReader.read(wktLS2);

Geometry intersection = SnapIfNeededOverlayOp.intersection(ls1, ls2);
System.out.println(intersection.toText());

and the result is:
LINESTRING (479.999 120, 480 120)

With a default PrecisionModel, result is GEOMETRYCOLLECTION(EMPTY) (correct),
With a PrecisionModel of factor = 1 result is  MULTIPOINT (458 141, 480 120)

Please, correct me if Im wrong, but in a snap environment they (479.999 120, 480 120) must be consideered the same point, dont they?

When JTS didnt have snap capabilities, I developed a snap overlay stuff, by extending (LineIntersector, PlanarGraph, PointLocator, PolygonBuilder,etc. etc.) to work with snap concepts (including a SnapCoordinateMap). This code will be available in the next release of gvSIG, but only compiles with JTS 1.7. If someone wants to probe it, Ill send it by mail.

I say this because my snap overlay version, the result with a snap tolerance of 0.001d is POINT (480 120). that is: it consideer them the same point.

Another question; would be better for snapping to compute an average coordinates? If we compute an overlay, the result is 480,120, but one of the geometries dont have this exact point may be confusing.....or maybe we would must to snap coordinates between geometries before computing an overlay?

Sorry If all of this looks unclear.....

Thank you very mutch and best regards.








Hi, sometime ago I developed a Snap Overlay operation by extending

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to