[Shapelib] Handling of Integers wider than 10 digits

Baumann, Konstantin Konstantin.Baumann at hpi.uni-potsdam.de
Thu May 17 05:06:10 PDT 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.

Frank,
 
I see your point, but with the current behavior, you loose information contained in the original data during import; using a string type instead, you would miss only some operations on the values but all information can be preserved; IMHO, the better choice...
 
Kind regards,
    Kosta





More information about the Shapelib mailing list