[Gdal-dev] OGR returns wrong floating values for shapefiles (and
integer as real, in error)
Mateusz Loskot
mateusz at loskot.net
Tue Oct 24 09:55:23 EDT 2006
Maciej Sieczka wrote:
> Hi,
>
> ogrinfo (and other apps based on OGR, eg. OpenEV, QGIS) returns wrong
> floating point values querying my shapefiles. Eg.:
>
> $ ogrinfo -al -q streams.shp
>
> Layer name: streams
> OGRFeature(streams):523
> CAT (Real) = 484
> LCAT (Real) = 73
> Z (Real) = 101.583309999999997
> Z_BREACH (Real) = 101.583309999999997
> Z_BREACH1 (Real) = 100.583309999999997
> LENGTH (Real) = 2.036246000000000
> LINESTRING (598549.144524969975464 5677309.376777020283043,598550.0
> 5677311.224603090435266)
>
>
> After opening the dbf in oocalc 2.03, I can see the values should
> recpectively be:
>
> CAT 484
> LCAT 73
> Z 101.58331
> Z_BREACH 101.58331
> Z_BREACH1 100.58331
> LENGTH 2.036246
>
> Why the spurious "09999999997" in case of Z, Z_BREACH, Z_BREACH1 in
> OGR? Note that, interestingly, LENGTH is OK though.
As Roger has explained, this is *only* a view, a format, a way of
presentation. The underlying number is still the same, in both cases.
OGR could display these values also using scientific notation,
ie. 1.0158331e+2 or engineering notation 101.58331e+0 or with only 3
decimal places 101.583.
In all these cases it's still a way of displaying, no data is
truncated or extended.
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the Gdal-dev
mailing list