[gdal-dev] Integer overflow issue in ogr2ogr

Even Rouault even.rouault at mines-paris.org
Thu Mar 24 14:30:17 EDT 2011


Le jeudi 24 mars 2011 00:33:44, Dan Putler a écrit :
> All,
> 
> I'm working with the topological faces from the 2010 Tiger shapefile
> data. Some of the faces are huge in Alaska (over 2147483647 meters^2,
> which exceeds the size of a signed 32 bit integer). In the block face
> attribute table the area of each face is given. When I process a file
> with these large areas with ogr2ogr, the resulting attribute table has
> area values that have been converted from the large value to -2147483648
> (the largest, in absolute value, possible negative value of a 32 bit
> signed integer). I'm using GDAL 1.7.3 on Ubuntu 10.4 64 bit which I
> obtained from the Ubuntu GIS repository (1.8.0 has not made it to the
> Ubuntu GIS repository yet). My question really is whether there is a
> work around, say processing the file beforehand in a way that converts
> the large integers to double precision values.

Yes this is a well known problem that has been recorded in multiple tickets... 
A possible solution would be the adoption of a 64bit integer type. There's a 
pending (not yet implemented) RFC to deal about that : 
http://trac.osgeo.org/gdal/wiki/rfc31_ogr_64

A possible workaround would be to edit the header of the DBF file to alter the 
field definition and set a non 0 value for the number of decimals. In which case 
OGR will recognize it as a double value (but you could potential have 
precision loss).

> 
> Dan
> _______________________________________________
> 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