[geos-devel] NaN as coordinate value
strk at keybit.net
Sat May 14 06:02:40 EDT 2011
On Fri, May 13, 2011 at 05:35:30PM +0100, Mateusz Loskot wrote:
> The following code comes from the GEOSisValidDetailTest unit:
> geom_ = GEOSGeomFromWKT("LINESTRING(0 0, 10 0, NaN -5)");
> ensure(0 != geom_);
> Is this really supposed to construct geometry object?
> Shouldn't it read ensure(0 == geom_); ?
The IsValidOp class does check for NaN ordinate values, so there
must at least be a way to produce them to test the validity.
Moreover, in real world there might be cases in which you do end
up with NaN ordinate values in your data, due to bugs in geometry
processing software (a recent one was reported originating in PROJ4).
GEOS client code could be written to deal with those cases in some
way or another (for instance it might make up a value interpolating
previous and next valid one, or set to zero, or let the user specify
what to do based on parameters).
None of that is available in the core at the moment,
but might become available in 3.4.0, if it'll get some fundings.
I'd surely love to see this happen at the JTS side for a start.
PostGIS made some steps in that direction with the new ST_MakeValid,
but that one doesn't allow any parametrization/policy specification
and doesn't deal with NaN/Infinite values at all.
() Free GIS & Flash consultant/developer
More information about the geos-devel