[gdal-dev] Integer overflow issue in ogr2ogr

Dan Putler dan.putler at sauder.ubc.ca
Wed Mar 23 20:34:30 EDT 2011


Given that someone else may run into the same problem in the near 
future, I decided to answer my own question, so it can be found in a web 
search.

The problem only occurs for seven county equivalents (likely census 
areas) in Alaska. I solved the problem by reading the dbf portion of the 
shapefile into R using the read.dbf function of the foreign library, and 
then just overwrote the original attribute table for the problematic 
shapefiles. This changes the number of decimal places in the dbf header, 
and ogr2ogr then treats it as a floating point number, not an integer, 
solving the problem.


On 03/23/2011 04:33 PM, Dan Putler wrote:
> 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.
>
> 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