NetTopologySuite / NetTopologySuite.IO.ShapeFile

The ShapeFile IO module for NTS.
33 stars 25 forks source link

Incorrect handling of dots in the file name #41

Closed LevYas closed 1 month ago

LevYas commented 4 years ago

Hi! Thank you for the tool, it is very useful. However, I faced a problem, ShapefileDataWriter incorrectly handles dots in the provided filename. The ShapefileDataWriter documentation says:

\<param name="fileName">File path without any extension\</param>

So I pass there: "C:\\TestOutput\\Dr. J.J.P. Oudsingel\\Dr. J.J.P. Oudsingel Surfaces"

However, it produces a file named "Dr. J.J.P.shp"

I believe this is because of calls to Path.ChangeExtension(path, ".shp") in the ShapefileStreamProviderRegistry constructor. If you require a shapefile name without any extension, maybe the better idea would be to replace Path.ChangeExtension(path, ".shp") to simple path + ".shp"? If you'd like, I can make a PR with these changes.

KubaSzostak commented 1 month ago

Support for a custom-managed stream, which allows shapes to be written to it, has been added in the successor library. There is also a sample code demonstrating how to use streams.