Closed jjm-ms2soft closed 2 weeks ago
Thank you @jjm-ms2soft for for submitting this issue. Unfortunately, we are unable to investigate further without additional information. If you are still interested in fixing this issue please provide code to create DbfFields and set geometry
. Without the code it will be hard to narrow down the issue.
We have requested more information regarding this issue, but have not received a response or additional information regarding this issue. Therefore, we are closing this issue. Please feel free to reopen it if you are able to provide the necessary details.
I'm trying to write a shapefile that may contain a mix of LineStrings and MultiLineStrings. I'm getting the writer like so:
When I try to write the file I get a "Cannot cast LineString to MultiLineString" error stemming from the ShapefileWriter class. The override of the Geometry property is trying to cast the Geometry to T.
The Shapefile.OpenWrite() method will return a PolyLineWriter. The PolyLineWriter is a ShapeFileWriter. Hence the error when trying to write a LineString.
If I use Features (as opposed to directly constructing DbfFields) and use
writer.Write(Features)
it works becauseWrite(Feature)
will turn the LineString into a MultiLineString for me in ShpPolyLineWriter.GetShapeGeometry().But features don't handle null values, due to the issue described in "Null value" (can't determine type). It would be nice if either features handled null values, or
writer.Write()
could handle LineStrings.