Closed kristofdegrave closed 3 years ago
In the DBaseFileHeader, we determine with the following logic if the Type is an Int32 or Int64:
https://github.com/NetTopologySuite/NetTopologySuite.IO.ShapeFile/blob/c0819c1cfbf8c52146a0004e0e7b3a2b48044d98/src/NetTopologySuite.IO.ShapeFile/Dbase/DbaseFieldDescriptor.cs#L176-L184
If we create a Header based on a feature, the following logic is used: https://github.com/NetTopologySuite/NetTopologySuite.IO.ShapeFile/blob/c0819c1cfbf8c52146a0004e0e7b3a2b48044d98/src/NetTopologySuite.IO.ShapeFile/Dbase/DbaseFieldDescriptor.cs#L176-L184 With the following values: https://github.com/NetTopologySuite/NetTopologySuite.IO.ShapeFile/blob/c0819c1cfbf8c52146a0004e0e7b3a2b48044d98/src/NetTopologySuite.IO.ShapeFile/ShapefileDataWriter.cs#L97-L101
This means an Int32 is defined with a length of 10 when writting. If you would read this header again, using the DBaseFieldDescriptor logic, it would be turn into an Int64 instead of an Int32.
Fixed with #59. Thanks!
In the DBaseFileHeader, we determine with the following logic if the Type is an Int32 or Int64:
https://github.com/NetTopologySuite/NetTopologySuite.IO.ShapeFile/blob/c0819c1cfbf8c52146a0004e0e7b3a2b48044d98/src/NetTopologySuite.IO.ShapeFile/Dbase/DbaseFieldDescriptor.cs#L176-L184
If we create a Header based on a feature, the following logic is used: https://github.com/NetTopologySuite/NetTopologySuite.IO.ShapeFile/blob/c0819c1cfbf8c52146a0004e0e7b3a2b48044d98/src/NetTopologySuite.IO.ShapeFile/Dbase/DbaseFieldDescriptor.cs#L176-L184 With the following values: https://github.com/NetTopologySuite/NetTopologySuite.IO.ShapeFile/blob/c0819c1cfbf8c52146a0004e0e7b3a2b48044d98/src/NetTopologySuite.IO.ShapeFile/ShapefileDataWriter.cs#L97-L101
This means an Int32 is defined with a length of 10 when writting. If you would read this header again, using the DBaseFieldDescriptor logic, it would be turn into an Int64 instead of an Int32.