arcgis中shp面积的获得:
不废话代码如下:
IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();
IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(filePath, 0);
IFeatureWorkspace myFeatureWorkspace = pWorkspace as IFeatureWorkspace;
string shpName = System.IO.Path.GetFileName(shpArray[i]);
IFeatureClass pFeatureClass = myFeatureWorkspace.OpenFeatureClass(shpName);//获得文件夹下所有shp
if (pFeatureClass == null)
return;
IFeatureCursor cursor = pFeatureClass.Search(null,false);
IFeature sourceFeature = cursor.NextFeature();
IArea pArea = sourceFeature.Shape as IArea;//获得面对象的面积。
注意的是这里获得到的面积是平方米为单位。如果要其他单位需要换算。
arcgis获得面对象的面积
最新推荐文章于 2024-07-03 22:07:40 发布