[Shapelib] Handling of Integers wider than 10 digits

Frank Warmerdam warmerdam at pobox.com
Wed May 16 09:52:39 EDT 2007


Baumann, Konstantin wrote:
> Hi!
> 
> I have filed the following bug ticket in the GDAL ticket system:
> <http://trac.osgeo.org/gdal/ticket/1627>
> 
> In the function DBFGetFieldInfo() (dbfopen.c: 960) an original "Integer"
> type is "cast" to the "Double" type, if the given field width of the
> Integer is larger than 10.
> 
> I think, that this is not the optimal solution, since the precision of
> doubles is also limited (~15-16 digits). I would suggest to use "String"
> as target type instead, which can handle an "arbitrary" number of
> digits. 
> 
> This problem occured during the import of some TeleAtlas shapefiles,
> which use 15 or even 22 integer digits as object IDs, to identify
> objects across different file sets...

Kosta,

This is a known bug and my intention is to incorporate a 64bit integer
type to resolve it properly.  However, my activity on shapelib has largely
ground to a halt and this issue has now languished for several years.

The idea of using strings does have the advantage of preserving the values
exactly.  However, it has the downside that no numerical type operations
will work on the field.  As such, I'm hesitant to pursue it.

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 OSGeo, http://osgeo.org



More information about the Shapelib mailing list