NetTopologySuite / NetTopologySuite.IO.Esri

BSD 3-Clause "New" or "Revised" License
35 stars 18 forks source link

Allow DbfCharacterField support 255 length. #39

Closed jp-rl closed 3 months ago

jp-rl commented 11 months ago

Hi!

Sometimes, character fields in dbf file (inside ShapeFile) has 255 chars length. This one generates error during reading.

a posible solution:

--- a/src/NetTopologySuite.IO.Esri.Shapefile/Dbf/Fields/DbfCharacterField.cs +++ b/src/NetTopologySuite.IO.Esri.Shapefile/Dbf/Fields/DbfCharacterField.cs @@ -22,7 +22,7 @@ public DbfCharacterField(string name, int length = MaxFieldLength) : this(name, }

     internal DbfCharacterField(string name, int length, Encoding encoding)

TIA, regards

KubaSzostak commented 8 months ago

Thank you @jp-rl for submitting this issue. Unfortunately, we are unable to investigate further without additional information. Can you provide sample shapefile or sample code that causes the error?

jp-rl commented 7 months ago

Hi @KubaSzostak, I have uploaded a file so you can investigate... thank you,

Line.zip

KubaSzostak commented 7 months ago

According to dBASE documentation the limit of character fields is 254. The same limit is stated in Esri documentation. The shapefile you provided contains character fields of 255 length. Nevertheless, I will adjust the code, so it properly handle 255 characters even though it's not compliant with the specification.