Opened 19 years ago

Closed 14 years ago

#933 closed defect (duplicate)

shapefile driver: an integer field is reported as real

Reported by: ari.jolma@… Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc: Markus Neteler

Description (last modified by warmerdam)

In ogrshapelayer.cpp:600 the default width for an integer field is set to 11.
This happens, e.g. when you create a new Integer FieldDefn in scripting language.

When you open thus created shapefile, dbfopen.c:1003 reports that it is a Double
(FieldSize > 10).

It seems that the field is actually an integer field but looking at it from
script, it is reported as Real.

Change History (2)

comment:1 by carlh@…, 18 years ago

My guess is that the test at dbfopen.c:1003 is based on the fact that the
largest signed, 32-bit integer value requires 10 characters ("2147483647"). 
However, due to its leading minus sign, the smallest signed, 32-bit integer
value requires 11 characters ("-2147483648").

comment:2 by warmerdam, 14 years ago

Description: modified (diff)
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.