Open jodygarnett opened 7 years ago
To clarify the geotools test is testCoordinateDimensionPointLite1D
and is explicitly checking if a coordinate sequence of 1 dimensional will work. This has been used, along with a 1 dimensional spatial reference system, to locate a sample along a bore hole (because geology.)
Er.. well, 1D geometry has never been a design goal for JTS. So I think this is more a case of GeoTools exploiting a fortuitous implementation flaw in JTS rather than a bug in supported behaviour! All kinds of things in JTS will break on 1D CoordinateSequences, so I don't see this changing anytime soon.
Still messing us up, suggestions?
I can of course warp that specific factory but would prefer to have an upstream fix in JTS.
If it method is not going to respect params an exception would be better than an inconsistent result.
Yes, agreed - this method should throw an exception for dimension < 2. Won't help the Geotools issue though.
I can't offer a suggestion for dealing with this, since handling 1D geometry is so far from the design goals of JTS. It really depends on what GeoTools intends for the semantics of 1D geometry. Is it possible to produce an "effective" 1D geometry by representing it as a 2D geometry with the Y coordinate set to some constant, innocuous value (e.g. 0) ?
Yes, I think in that case it does the same check your getDimension() does, checks if the y value is NaN.
Since this is marked 'WONT FIX', can we close it?
Working on updating GeoTools to use JTS 1.14 (see https://github.com/geotools/geotools/pull/1665) and have run into a regression in the following:
This should produce a coodinate sequence with dimension 1, but it produces a coordinate sequence with dimension 3.
The JTS 1.14 implementation is:
You can see the
return new CoordinateArraySequence(size);
fails to pass in thedimension
.This is a regression, in JTS 1.13 the code was as follows: