Closed Em3a-c closed 1 year ago
According to Esri documentation null
Date values should be stored as zero. DBF files produced by Esri software have null dates set to an array of char
set to zero (char.MinValue
== (char)0
). Shapefile attached by you have Date values filled with "00000000", which is array of char
filled with ASCII zero code. I don't see a reason why not treat it also as a valid null Date value.
Hi all,
I think this may be a non-issue, but I am getting an exception when trying to read in this shapefile,
The shapefile: Example Shapefile.zip
The exception: {"The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar."}
at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style) \r\n at NetTopologySuite.IO.Esri.Dbf.Fields.DbfDateField.ReadValue(Stream stream) \r\n at NetTopologySuite.IO.Esri.Dbf.DbfReader.Read(Boolean& deleted) \r\n at NetTopologySuite.IO.Esri.Shapefiles.Readers.ShapefileReader
1.Read(Boolean& deleted) \r\n at NetTopologySuite.IO.Esri.Shapefiles.Readers.ShapefileReader
1.Read(Boolean& deleted, Feature& feature) \r\n at NetTopologySuite.IO.Esri.Shapefiles.Readers.ShapefileReader.FeatureEnumerator.MoveNext() \r\n at System.Linq.Buffer1..ctor(IEnumerable
1 source) \r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) \r\n at NetTopologySuite.IO.Esri.Shapefile.ReadAllFeatures(String shpPath, ShapefileReaderOptions options)I think this may be an issue with the shapefile itself, as the field MAPDATE has dates stored as 00000000 in the attached .dbf file, (which could be causing this issue perhaps?).
But I wanted to confirm whether this is an error case that your library should be handling, or whether it's an issue with the shapefile, that should be fixed up, before reading in.
The shapefile is read in by:
foreach (var feature in Shapefile.ReadAllFeatures(filePath))
Thanks in advance,
Emma