Closed yfz34 closed 3 years ago
can you elaborate more the problem you are facing? I've built this test against the latest develop, but it does not show the problem you experienced
const string TestKey = "備註1";
const string TestVal = "數值1";
var encoding = Encoding.UTF8;
var factory = GeometryFactory.Default;
var geometry = factory.CreatePoint(new Coordinate(0, 0));
var attributes = new AttributesTable { { TestKey, TestVal } };
var feature = new Feature(geometry, attributes);
string outpath = Path.GetFileNameWithoutExtension(Path.GetTempFileName());
var writer = new ShapefileDataWriter(outpath, factory, encoding)
{
Header = ShapefileDataWriter.GetHeader(feature, 1, encoding)
};
writer.Write(new List<IFeature> { feature });
using var reader = new ShapefileDataReader(outpath, factory, encoding);
Assert.IsTrue(reader.Read());
Assert.IsTrue(reader.Geometry.EqualsExact(geometry));
Assert.AreEqual(reader.GetOrdinal(TestKey), 1);
Assert.AreEqual(reader.GetName(1), TestKey);
Assert.AreEqual(reader.GetString(1), TestVal);
Assert.IsFalse(reader.Read());
I use nuget to add this package and version is 2.0.0. And I try to built the latest develop package. It's successed encoding. Thank you so much!
Hello! I have a problem with reading shape file, when I used ShapefileDataWriter function to create shape file and read this shape file can't get correct name, but value can corrected encoding.
Create shape file
read shape file
and print result