我有以下代码来读取 shapefile 集(.dbf、.prj、.shp、.shx)NetTopologySuite.IO.ShapefileDataReader
:
public FeatureCollection ReadShapeFile(string localShapeFile)
{
var collection = new FeatureCollection();
var factory = new GeometryFactory();
using (var reader = new ShapefileDataReader(localShapeFile, factory))
{
var header = reader.DbaseHeader;
while (reader.Read())
{
var f = new Feature {Geometry = reader.Geometry};
var attrs = new AttributesTable();
for (var i = 0; i < header.NumFields; i++)
{
attrs.AddAttribute(header.Fields[i].Name, reader.GetValue(i));
}
f.Attributes = attrs;
collection.Add(f);
}
}
return collection;
}
这可行,但几何对象没有属性来告诉坐标所在的参考系统。
如何找出形状文件或单个形状所在的坐标系/参考系?