Opened 14 years ago

Closed 10 years ago

#1627 closed defect (duplicate)

Shapelib: handling of Integers wider than 10 digits

Reported by: Kosta Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc: Markus Neteler

Description

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 as target type "String" instead, which can handle an "arbitrarily" 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...

Another (and even better) fix would be to use a C/C++ integer type of 64 bit precision for the OGR data type OFTInteger, but that would involve a large number of changed source code locations...

Attachments (1)

shapefile_large_int.patch (1.0 KB) - added by Kosta 14 years ago.
Bug fix for "large integer" support for Shapefiles

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by Kosta

Attachment: shapefile_large_int.patch added

Bug fix for "large integer" support for Shapefiles

comment:1 Changed 14 years ago by Markus Neteler

Cc: Markus Neteler added

Adding myself in CC since GRASS uses dbfopen.c, too

comment:2 Changed 10 years ago by warmerdam

Resolution: duplicate
Status: newclosed

I'm making #3615 the official ticket to address wide integer fields in dbf.

Note: See TracTickets for help on using tickets.