[Gdal-dev] ogr2ogr: double -> integer conversion problem

Frank Warmerdam warmerdam at pobox.com
Fri Mar 10 08:48:26 EST 2006


mirza wrote:
> Hello,
> 
> When I try to convert shapefile to mid/mif using ogr2ogr, some double 
> values are converted to (overflowed) integers. For example, value 
> 14420300000144 in shapefile is converted to -1500011687 in .mid file. I 
> submitted bug to MITAB project but same bug occurred when converting to 
> CSV so maybe it is more general. Any idea?

Mirza,

This is an issue with the Shapefile driver.  The problem is deciding how to
handle integer fields that are so wide they might not fit in a 32bit integer.
My decision some time ago was to pretend that these are doubles rather than
deal with adding some sort of 64bit integer type to shapelib.

This decision is at the base of the problems.

You can file a bug against the OGR shapefile driver or even shapelib
itself, but I haven't yet figured out what to do about it.

Note that OGR's integer field is a 4byte integer so there is no way to
represent large integers in OGR.

Ugg.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list