[geos-devel] GEOS returning invalid geometries
Carl Anderson
carl.anderson at vadose.org
Fri Sep 17 19:13:56 EDT 2004
On 09/17/2004 03:47:35 PM, Martin Davis wrote:
> I wonder if this is due to floating-point implementation issues?
> Being
> build on Java, JTS has the luxury of being able to assume that all
> floating point is carried out in IEEE754. GEOS on the other hand is
> dependent on the underlying compiler (and presumably processor FPU).
>
There is more than one issue
First
WKT in postgis uses 15 digits of precision
%.15g in postgis_inout.c
WKT in GEOS uses 16 digits,
MaxSignificantDigits in PrecisionModel.cpp defaults to 16
int decimalPlaces = precisionModel->getMaximumSignificantDigits();
string fmt="%.";
char buffer[255];
sprintf(buffer,"%i",decimalPlaces);
fmt.append(buffer);
fmt.append("f");
The conversion can turn a valid topology into an invalid one
There is another out there as well, so I will start where you suggest.
> I can't think of any explicit dependencies in JTS/GEOS which would
> cause
> this, but if another floating point model is used it's possible that
> some computations could come out slightly differently.
>
C.
Carl Anderson
More information about the geos-devel
mailing list