[postgis-devel] Re: [geos-devel] GEOS returning invalid geometries

strk at refractions.net strk at refractions.net
Sat Sep 18 00:22:02 PDT 2004


On Fri, Sep 17, 2004 at 11:13:56PM +0000, Carl Anderson wrote:
> 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

Conversion between postgis and GEOS do not rely on string output.
This can be true when 'reading' output on the console.
Still the isvalid() function would not be confused by this issue.

--strk;

> 
> 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
> 
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel



More information about the postgis-devel mailing list