<div dir="ltr">Hi Guys, <br>Thanks for everyone for the answers. <br>I'm sorry about the haste in sending the email. I've should have read more carefully. <br>This issue is even in WIKIPEDIA ...<br><br>Oz.<br><br><div class="gmail_quote">
On Wed, Mar 24, 2010 at 4:47 PM, Jason Roberts <span dir="ltr"><<a href="mailto:jason.roberts@duke.edu">jason.roberts@duke.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Oz,<br>
<br>
The specification that Peter refers to is <a href="http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf" target="_blank">http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf</a>. Also, check out the OGR Shapefile driver's documentation <a href="http://www.gdal.org/ogr/drv_shapefile.html" target="_blank">http://www.gdal.org/ogr/drv_shapefile.html</a>. It documents this issue, as well as others that might be of interest. Finally, if you are interested in compatibility with ArcGIS, <a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Geoprocessing%20considerations%20for%20shapefile%20output" target="_blank">http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Geoprocessing%20considerations%20for%20shapefile%20output</a>.<br>
<br>
In my experience, it is very important to read the OGR driver documentation carefully for whatever data format you're working with. The driver may exhibit different behavior than the original applications designed to work with that format. For example, the OGR shapefile driver documentation states that the default width for integer fields is 11 characters, which is the width required to fully represent 32-bit signed integers, yet the last link I mentioned above states that ArcGIS limits the width to 9 characters. You may want to carefully investigate issues like that if you are interested in compatibility with ArcGIS.<br>
<br>
Finally, the OGR driver documentation may occasionally document something better than the original documentation for the format. For example, the OGR shapefile driver documentation makes mention of storing dates in shapefiles. ArcGIS also supports storing dates in shapefiles yet ESRI's whitepaper makes no mention that shapefiles support dates.<br>
<br>
Best,<br>
<font color="#888888"><br>
Jason<br>
</font><div><div></div><div class="h5"><br>
-----Original Message-----<br>
From: <a href="mailto:gdal-dev-bounces@lists.osgeo.org">gdal-dev-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:gdal-dev-bounces@lists.osgeo.org">gdal-dev-bounces@lists.osgeo.org</a>] On Behalf Of Peter J Halls<br>
Sent: Wednesday, March 24, 2010 11:15 AM<br>
To: Oz Nahum<br>
Cc: <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
Subject: Re: [gdal-dev] field name in ESRI file<br>
<br>
Oz,<br>
<br>
shapefiles use the dBase IV format .dbf file for attributes: this defines the<br>
maximum field name width to be 10 characters - 'LAND USE CODE' has 13. Also,<br>
space characters are not permitted - use underscore '_' instead. Whilst GDAL<br>
may create the field names as you have specified, other packages may not accept<br>
them as input. I believe that the Shapefile rules are still available as a<br>
White Paper on the ESRI.com website: it is worth reading the document to<br>
understand what is possible.<br>
<br>
Best wishes,<br>
<br>
Peter<br>
<br>
Oz Nahum wrote:<br>
> Hello GDAL Devs,<br>
><br>
> I encoutered a small problem, where I don't understand why field names in<br>
> ESRI Shape files created by gdal, are truncated.<br>
> Here is a code snippet:<br>
><br>
> field_LUC = ogr.FieldDefn()<br>
> field_LUC.SetName('LAND USE CODE')<br>
> field_LUC.SetType(ogr.OFTInteger)<br>
> field_LUC.SetWidth(15)<br>
> dst_layer.CreateField(field_LUC)<br>
><br>
><br>
> Yet, when I examine the output file the attribute table contains a field<br>
> called "LAND USE C",<br>
> so 3 characters are missing.<br>
><br>
> Would be happy to know what am I doing wrong. Thank you very much,<br>
><br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> gdal-dev mailing list<br>
> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
--<br>
--------------------------------------------------------------------------------<br>
Peter J Halls, GIS Advisor, University of York<br>
Telephone: 01904 433806 Fax: 01904 433740<br>
Snail mail: Computing Service, University of York, Heslington, York YO10 5DD<br>
This message has the status of a private and personal communication<br>
--------------------------------------------------------------------------------<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br><br><br>
</div>