FAQ: How have shapefile dBase field mappings changed?


How have shapefile dBase field mappings changed?


Changes in dBase\Shapefile Field Mappings

When creating a shapefile, the requested field types are mapped to ensure that the data can transfer to other data formats and into ArcObjects without overflow or truncation. Because of this, there is no guarantee that the requested field type will be created. The "best fit" is created to eliminate any chance of data loss.

The field mapping used with dbase\shapefiles was changed, beginning at ArcGIS 10.3.1, to resolve a data truncation problem. In short integer fields, numbers like -12345 would be truncated to -1234. In long integer fields, numbers like -1234567890 were truncated to -123456789. The numbers are stored in the dBASE file as text and there is no allowance made for negative numbers. The excess precision was truncated without warning or error.

The mappings are enforced on creation and on insert/update by ArcObjects, arcpy, and through the user interface. Existing shapefiles are not changed and maintain their mappings. Operations that create new shapefiles use the new mappings. Performing a copy/paste operation on a shapefile is a file-based process and does not update the mappings.

Field Mapping in ArcGIS 10.3 and earlier versions
Type Offered on CreateDisplayed in propertiesWidthPrecisionMin/Max Values Allowed
ShortShort1-5 -9999*, 32767
LongLong1-10 -999999999**, 2147483647
FloatFloat1-61-6-3.4028234664e+38, 3.4028234664e+38
DoubleDouble7+0+-1.7976931348623158e+308, 1.7976931348623158e+308
TextText1-254 254
* The min value that can be entered without truncation is -9999. A true short integer has a min of -32768.

** The min value that can be entered without truncation is -999999999. A true long integer has a min of -2147483648.

Field Mapping in ArcGIS 10.3.1 and later versions
Type Offered on CreateDisplayed in propertiesWidth RequestedWidthPrecisionMin/Max Values Allowed
ShortLong1-55 -9999, 99999
LongLong1-1010 -999999999, 2147483647
FloatFloatn/a00-3.4028234664e+38, 3.4028234664e+38
DoubleDoublen/a00-1.7976931348623158e+308, 1.7976931348623158e+308
TextText1-2541-254 254

Esri is reviewing how to add back support for scale and precision in a future release of ArcGIS. Any plans or updates will be posted in this technical article. Shapefile dBase field mappings have been changed both on creation and when viewing older files. This change was made to minimize data loss, which had been occurring under the old mapping. Please note that in existing data, the internals do not change; only the interpretation has changed.

Reading existing data

When reading existing data, the best fit to the new mapping is attempted. Nothing changes in the data, but the field type may be reported differently. Precision and type are used to determine the mapping, and precision/scale are displayed on pre-existing shapefiles.

Integer < 5Short
Integer >= 5, < 11Long
Integer > 10Double
Non-zero scale, precision < 14Float
Non-Zero scale, precision >= 14Double