[gdal-dev] Error reading long numbers as integer

Konstantin Baumann Konstantin.Baumann at autodesk.com
Tue Dec 7 03:27:30 EST 2010


Hi Even,

the fallback to double/real does only help if the integer could be stored in 52 bits, since the rest of the bits are reserved for the mantissa and sign => exact up to ~15 decimal digits.

I proposed a fix 3 years ago to change the data type to string in order to not loose data:
	Patch:  http://trac.osgeo.org/gdal/attachment/ticket/2286/gdal-shapefile-datatype.patch
	Ticket: http://trac.osgeo.org/gdal/ticket/2286
which was rejected. :-(

And the introduction of 64-bit integers (also RFC31_OGR_64 is highly appreciated) will still not help for integers with more than 19 decimal digits... [note: e.g., TeleAtlas uses 30 digit integers as feature IDs]

Kosta

-----Original Message-----
From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Even Rouault
Sent: Monday, December 06, 2010 8:56 PM
To: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Error reading long numbers as integer

Ralf,
> 
> I have created a ticket for the NAS reader. Long numbers (13 digits) are
> read as integer. Maybe there are more drivers who have the same trouble.

Yes, this is an issue that can be potentially found in other drivers. The 
situation could improve if/when RFC 31 / OGR 64bit integer is adopted.

For the time being, I've made a change in the GML driver so that it fallbacks 
to Real when it detects an integer that cannot fit into 32bit. Not ideal, but 
better than arbitrary truncation.

> 
> I have tested some workarounds. Changing the attribut definition in gfs
> file is successful, when destination driver is PGdump or Postgresql
> (create mode).

Which change did you make exactly ? Change from Integer to Real ?

> With Postgresql driver as destination ogr2ogr convert the
> 13 digits number always to integer in append mode and ignoring table
> definition.

I'm a bit skeptical about that one. Which exact commands did you use ?

> I tested with gdal SVN21189.
> 
> Gr
> Ralf
_______________________________________________
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