0

While creating a ESRI-Shapefile using GDAL, it keeps truncating/normalizing my field names. Any reason why it does this? If the Field name is more than 10 characters it seems to do this.

For example

OGRFieldDefn("More than 10 chars", OFTString). Becomes More Than_1 instead of More Than 10 Chars.

6

Esri shapefile fields are limited to 10 characters, no matter how they are created.

  • I believe geodatabase feature classes can have field names up to 64 characters. – Michael B Jul 13 '15 at 14:32
  • Hmm okay interesting. So I would have to create some sort of parser when I'm pulling my ESRI shapefile to convert the truncated fields into the full field they are supposed to be. Interesting but thanks. – Jake Wade Jul 13 '15 at 14:37
  • 3
    The limit comes from dBase format actually and affects thus also shapefiles. – user30184 Jul 13 '15 at 15:11
  • @JakeWade you just need to take control of the name changes and keep track of what they were (eg "More than 10 chars" -> "F1" then when exporting "F1" -> "More than 10 chars") note that spaces also are not allowed (neither are punctuation except for underscore). Shapefile is an ancient format that was around in the 90's - the only reason for its continued existence is, despite serious limitations, it's the most recognized vector interchange format. – Michael Stimson Jul 14 '15 at 5:26
  • @MichaelMiles-Stimson Thanks thats really helpful. If you had posted that as an answer I would have up voted and marked as the answer. – Jake Wade Jul 14 '15 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.