我正在搜索脚本以使用点空间从 shapefile 中的多边形获取内环。下面是我从 shapefile 获取所有坐标(忽略外环/内环)的脚本。
string shapeFilePath = @"\example.shp";
shapeFilePath = location + shapeFilePath;
Shapefile indexMapFile = Shapefile.OpenFile(shapeFilePath);
indexMapFile.Reproject(KnownCoordinateSystems.Geographic.Australia.GeocentricDatumofAustralia1994);
for (int i = 0; i < indexMapFile.DataTable.Rows.Count; i++)
{
IFeature feature = indexMapFile.Features.ElementAt(i);
var arr = feature.Coordinates.ToArray();
foreach (var det in arr)
{
DotSpatial.Topology.Coordinate det_cor = det;
string X = det_cor.X.ToString();
string Y = det_cor.Y.ToString();
}
}