[gdal-dev] Too much precision in WKT

Brent Fraser bfraser at geoanalytic.com
Wed Jun 3 09:57:42 EDT 2009


Peter,

  I want to round the coordinates of the vertices of linestrings represented as WKT, not the projection parameters.  My problem is that databases have different field types for strings depending on their expected length (MS Access TEXT vs MEMO for example, and I'm still trying to find info on DBF types).

   As you've explained below, instead of representing the latitude of a vertex as 53.146791166875367, it would be ok to instead use 53.1467912 and be within a centimeter of the original latitude (as long as the projection parameters remained at their full precision).

Best Regards,
Brent Fraser

Peter J Halls wrote:
> Brent,
> 
>    why would you want to?  Maybe you do not appreciate the implications 
> of so doing?  The parameters of which you complain define the ellipsoid, 
> the shape and measurements of the Earth, to be used for that 
> projection.  Round them and you effectively change the size and shape of 
> the Earth!
> 
>    Based on the Clarke Ellipsoid, 1m at the equator is approximately 
> 0.0008833141949 of a degree; round that and you lose the positional 
> accuracy - and 1m positional accuracy is, frankly, not great.  You can 
> divide that figure by ten if you want to work at .1m positional 
> accuracy.  However, most mapping agencies and surveyors will probably 
> use 1cm positional accuracy, or one hundreth: 0.000008833141949.  There 
> are a number of other spheroids and ellipsoids in use, as the surface of 
> our planet is sufficiently irregular to necessitate different 
> measurements depending upon the location of interest.
> 
>    The map projection equations are sensitive to this numerical 
> precision - they have to be - so reducing the numerical precision of the 
> projection parameters will significantly reduce the precision of the 
> final result.  Indeed, it does not take much rounding to have a dramatic 
> result, should you seek to align the results with material projected 
> using the proper parameters.
> 
>    You can test this yourself be experimenting with some spherical 
> trigonometry - the mathematics necessary for working with position on a 
> sphere.  You can find the equations for the various projections in J P 
> Snyder's 'Map Projections: a working manual', which is available online 
> from USGS.  Try out some of the equations by hand, with the full 
> precision and with your proposed precision for some locations in your 
> area of interest and I'm sure you will then appreciate the need for the 
> precision in these parameters.
> 
> Best wishes,
> 
> Peter
> 
> Brent Fraser wrote:
>> I've been experimenting with v1.6.0 ogr2ogr:
>>
>>    ogr2ogr -f csv test_dir test_in.shp -nln test_out -lco GEOMETRY=AS_WKT
>>
>> The precision of the coordinates in the WKT seems to be overkill, eg:
>>    "LINESTRING (-115.11433812265155 
>> 53.146791166875367,-115.12192424362472 53.147304268559473,
>>
>> Is there any way to limit the precision?
>>
>> Thanks!
>> Brent Fraser
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 


More information about the gdal-dev mailing list