[gdal-dev] GDAL precision for Geometry object

Even Rouault even.rouault at spatialys.com
Sat Oct 10 05:06:30 PDT 2015


Le samedi 10 octobre 2015 13:45:05, Dimitrianos Savva a écrit :
> Hi all,
> 
> Recently I noticed that the ExportToWKT
> <http://gdal.org/java/org/gdal/ogr/Geometry.html#ExportToWkt()> function
> of a Geometry object that has been read from a Shapefile, generates the
> well known text representation without any compromise on the precision of
> the coordinates values.
> 
> I wonder how these coordinates are represented in memory. A double
> precision floating type is not enough to represent some coordinates.
> 
> For example the geometry POINT (4799826.09861662145704
> 2773995.445373429451138) cannot be represented by two double types. But
> still the ExportToWKT function produces the correct result with full
> precision for the values.

Dimitrianos,

The implementation of ExportToWKT() in GDAL uses 15 decimal figures ("%.15f" 
printf formatting) whatever the source precision was, and as you point, 
whatever the intrinsic precision of the double value is.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list