At the moment Linear Referencing doesn't support a precision model, so the
only way to apply a PrecisionModel is to do it manually on the results of
operations.
On Thu, Mar 12, 2015 at 4:17 PM, Jan Tosovsky <[email protected]> wrote:
> Dear All,
>
> in the following code I would expect to get the same coords as original
> ones
> before processing. But there are rounding errors. Is there any way to get
> rid of this? Is there any way to apply precission model here?
>
>
> @Test
> public void testConversion() {
>
> Coordinate[] corners = new Coordinate[]{
> new Coordinate(0.0, 0.0),
> new Coordinate(5.0, 0.0),
> new Coordinate(5.0, 4.0),
> new Coordinate(0.0, 4.0),
> new Coordinate(0.0, 0.0)};
>
> Geometry borderGeometry = new
> GeometryFactory().createLineString(corners);
> LengthIndexedLine lengthIndexedLine = new
> LengthIndexedLine(borderGeometry);
>
> Coordinate coordinateOriginal = new Coordinate(0,
> 0.41278619766154856);
>
> double distance = lengthIndexedLine.indexOf(coordinateOriginal);
>
> Coordinate coordinateNew =
> lengthIndexedLine.extractPoint(distance);
>
> System.out.println(coordinateOriginal.toString());
> System.out.println(coordinateNew.toString());
>
> /*
> (0.0, 0.41278619766154856, NaN)
> (0.0, 0.4127861976615499, NaN)
> */
> }
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user