-
-
Notifications
You must be signed in to change notification settings - Fork 259
Why limited the length of field to 10? #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The Dbf format limits fields to 10 characters. There are some derivative Some GIS software will handle longer fields with different database
On Monday, June 30, 2014, kuno [email protected] wrote:
Joel Lawhead, PMP |
ok, very helpful. Thanks. |
Dear Author, In the dbf file format https://en.wikipedia.org/wiki/.dbf, the size of the field name is 11 bytes, not 10 bytes. Could it be fixed if it is a bug ? Database field descriptor bytes 0-10 11 bytes Field name in ASCII (zero-filled) Thank you for reading and reply. |
@jinz2014 the shapefile article spells out that the maximum length of a field name is only 10 characters. I don't know what the 11th byte is used for, but it's existence doesn't allow shapefiles to have 11 character field names. It may be possible to hack something that lets people use longer field names within pyshp, but this stack exchange thread makes clear why that would be a bad idea. |
In DBF the 11th byte is a zero (00h) value, for null termination. It is probably the way to make seem to be somewhat like C null terminated strings. You might be able to use fscanf to read it in, which almost nobody would do today. Remember, dBase is a DOS format with design decision made back in the 1980s. It is not a bug, its a feature! 😄 ESRI's ArcGIS software has aliases for field, which I assume is just in the map .MXD file for display to the end user. |
Thank you for your answer. From: Eldan Goldenberg [mailto:[email protected]] @jinz2014https://github.com/jinz2014 the shapefile articlehttps://en.wikipedia.org/wiki/Shapefile#Data_storage spells out that the maximum length of a field name is only 10 characters. I don't know what the 11th byte is used for, but it's existence doesn't allow shapefiles to have 11 character field names. It may be possible to hack something that lets people use longer field names within pyshp, but this stack exchange threadhttps://gis.stackexchange.com/questions/15784/how-to-bypass-10-character-limit-of-field-name-in-shapefiles makes clear why that would be a bad idea. — |
Sync with geospatialpython master
…l new tests Previously field names that exceeded the 10 character limit were capped and written as the first 11 characters, although it should be capped to the first 10 characters and ended with a null-terminator. See #2.
I am new to shapefile, I saw in this line of code
https://github.com/GeospatialPython/pyshp/blob/master/shapefile.py#L744
That you limited the lenght of the field to 10 at most, can you explain why?
The text was updated successfully, but these errors were encountered: