Closed qiangwai closed 3 years ago
see this sample
using (var reader = new ShapefileDataReader("crustal_test_bugged", Factory))
{
int length = reader.DbaseHeader.NumFields;
while (reader.Read())
{
Debug.WriteLine(reader.GetValue(length - 1));
}
}
You missed the reader.Read()
, that is basically the standard pattern when reading data from any source in .net
yes,you are right.@DGuidi But I have another question ,dataReader.GetValue[i]and dataReader.Geometry only support one Geometry and it's value?My Shape is multi Geometry ,I want read multi attribute ,How should I read?
It's not the way it works. A multi-geometry it's a single geometry object, so it has a single set of attributes: a multipoint is a single geometry composed of a number of points, and all these points share the same set of attributes, like a single geometry do.
Thank you@DGuidi .Now I can read all attributes.But sometimes messy code characters appear in attributes when read contains chinese character shape.How can i solve this problem? like this shape anhui_shp.zip
maybe related to #39
please check if last commit fix the issue, as expected
I want get ShapeFile's AttributeTable ,I did it this way
but Why dataReader's depth is 0,result in an empty reference exception to be thrown.My shp can be read in ArcMap.Is My method wrong? What is the general way to read AttributeTable?