[gdal-dev] Forcing the rounded of coordinates

Sylvain Maffren sylvain.maffren at crige-paca.org
Mon Jun 20 17:49:18 EDT 2011


Hi !

I apologize in advance for my english which I not very fluent. I have 
some questions about the tool ogr2ogr (and also about gdalwarp and 
gdal_translate) and the rounding of coordinates.


Let me explain:

Some databases (particularly IGN -- France databases) have coordinates 
rounded to the meter (BD CARTO for example) or the decimeter (BD TOPO 
for example).

I will explain my comment with for bases the coordinates of a point of 
BD CARTO to support my comments :

In an original *.shp in Lambert93 - France, a point has the following 
coordinates (provided by ogrinfo):

X = 993366 m Y = 6304044 m

We import this in PostGIS with shp2pgsql, and the point has always these 
coordinates:

X = 993366 m Y = 6304044 m

It's good !

If we try to export this PostGIS layer through ogr2ogr (in *.shp, *.tab 
or *.mif), a ogrinfo gives us the same point of the layer resulting, 
with the following coordinates:

X = and Y = 993366.00000000058 6304043.9999999898)

This means that ogr2ogr (identical tests performed on a raster layer 
bounding box with reprojection (gdalwarp) or without (gdal_translate)) 
changes the number of decimal coordinates of origin, which can be 
annoying in some cases (when we need to recover a given output with the 
same number of decimal than in entry.

I tried to find a setting to force ogr2ogr (or gdal and related 
functions) to round the coordinates to a given number of decimal (as can 
be done with CS2CS) and I have not found any answer.

Is it possible to set the number of decimal places in output (and 
ideally keep the same as input) ? And if so, how?

Thank you in advance to all who have good ideas and / or directions to 
follow.


Sylvain Maffren

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110620/28ae98b6/attachment.html


More information about the gdal-dev mailing list