[gdal-dev] Re: determine real number precision with ogr2ogr

Tamas Szekeres szekerest at gmail.com
Thu Jul 22 08:10:13 EDT 2010


2010/7/22 easyl <thlin.box at gmail.com>

>
> thanks for all your suggestions!
>
> Using 'cast' sql option with ogr2ogr is interesting.
> i.e. "SELECT CAST(DEPTH AS numeric(8,1)) from SOUNDG"
> But I still have two questions.
>
> 1. now I have all real number with 1 digit precision. The values look like
> 1.2, 3.2, 2.0, 1.0.....
>    Actually it is already good enough, but having "1.0" instead of just "1"
> is still a little bit annoying.
>    is that a OGR's issue (for evaluation and interpretation of numbers)?
>
>
I suspect this is an issue with OGRFeature::GetFieldAsString when formatting
the string representation of a double value.



> 2. is there any quick way to select all other attributes (and cast only one
> of them)?
>    writing "SELECT attrib1, attrib2, attrib3, .... attribN, CAST(DEPTH AS
> numeric(8,1)) from SOUNDG" is a little bit tedious.
>
>
To select all attributes you may use an asterisk '*' however it would
include the 'DEPTH ' field as well.



> btw, CAST feature is available from GDAL1.6+.
> GDAL/OGR from FWTools-2.0.6 will not work.
>
>
I'm not sure about the versions included in FWTools-2.0.6 you may however
use the proper versions of the packages from http://vbkto.dyndns.org/sdk/

Best regards,

Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100722/40a0d0de/attachment-0001.html


More information about the gdal-dev mailing list