[gdal-dev] field name in ESRI file

Peter J Halls P.Halls at york.ac.uk
Wed Mar 24 11:15:02 EDT 2010


Oz,

   shapefiles use the dBase IV format .dbf file for attributes: this defines the 
maximum field name width to be 10 characters - 'LAND USE CODE' has 13.  Also, 
space characters are not permitted - use underscore '_' instead.  Whilst GDAL 
may create the field names as you have specified, other packages may not accept 
them as input.  I believe that the Shapefile rules are still available as a 
White Paper on the ESRI.com website: it is worth reading the document to 
understand what is possible.

Best wishes,

Peter

Oz Nahum wrote:
> Hello GDAL Devs,
> 
> I encoutered a small problem, where I don't understand why field names in
> ESRI Shape files created by gdal, are truncated.
> Here is a code snippet:
> 
>     field_LUC = ogr.FieldDefn()
>     field_LUC.SetName('LAND USE CODE')
>     field_LUC.SetType(ogr.OFTInteger)
>     field_LUC.SetWidth(15)
>     dst_layer.CreateField(field_LUC)
> 
> 
> Yet, when I examine the output file the attribute table contains  a field
> called "LAND USE C",
> so 3 characters are missing.
> 
> Would be happy to know what am I doing wrong. Thank you very much,
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
--------------------------------------------------------------------------------
Peter J Halls, GIS Advisor, University of York
Telephone: 01904 433806     Fax: 01904 433740
Snail mail: Computing Service, University of York, Heslington, York YO10 5DD
This message has the status of a private and personal communication
--------------------------------------------------------------------------------


More information about the gdal-dev mailing list