[gdal-dev] GDAL precision for Geometry object

Dimitrianos Savva dimis at di.uoa.gr
Sun Oct 11 05:09:41 PDT 2015


> On Oct 10, 2015, at 3:06 PM, Even Rouault <even.rouault at spatialys.com> wrote:
> 
> 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 <http://www.spatialys.com/>

Thanks you for the quick answer!
Actually I was confused at some point, because some geometries had the exact precision as in the Shapefile,
and some other not. 

Thanks again,
Dimitrianos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151011/0625d155/attachment.html>


More information about the gdal-dev mailing list