IWorkspaceFactory pWSF = new FileGDBWorkspaceFactoryClass(); IFeatureWorkspace pFWS = (IFeatureWorkspace)pWSF.OpenFromFile(@"D:\gis数据\测试0303.gdb", 0); IFeatureClass Featureclass = pFWS.OpenFeatureClass("CS"); IFeatureClass Featureclass2 = pFWS.OpenFeatureClass("CS_4547"); IFeatureClass Featureclass3 = pFWS.OpenFeatureClass("CS_4548"); IFeatureClass Featureclass4 = pFWS.OpenFeatureClass("CS_4549"); var fcur = Featureclass.Search(null, false); var fcur2 = Featureclass2.Search(null, false); var fcur3 = Featureclass3.Search(null, false); var fcur4 = Featureclass4.Search(null, false); IFeature pFeature = fcur.NextFeature(); IFeature pFeature2 = fcur2.NextFeature(); IFeature pFeature3 = fcur3.NextFeature(); IFeature pFeature4 = fcur4.NextFeature(); IPolygon polygon = pFeature.ShapeCopy as IPolygon; IPolygon polygon2 = pFeature2.ShapeCopy as IPolygon; IPolygon polygon3 = pFeature3.ShapeCopy as IPolygon; IPolygon polygon4 = pFeature4.ShapeCopy as IPolygon; IArea pArea = polygon as IArea; IArea pArea2 = polygon2 as IArea; IArea pArea3 = polygon3 as IArea; IArea pArea4 = polygon4 as IArea; double area = Math.Abs(pArea.Area); double area2 = Math.Abs(pArea2.Area); double area3 = Math.Abs(pArea3.Area); double area4 = Math.Abs(pArea4.Area); //4490 IAreaGeodetic areaGeodetic = polygon as IAreaGeodetic; ISpatialReferenceFactory srf = new SpatialReferenceEnvironmentClass(); ILinearUnit unit = srf.CreateUnit((int)esriSRUnitType.esriSRUnit_Meter) as ILinearUnit; double area11 = areaGeodetic.get_AreaGeodetic(esriGeodeticType.esriGeodeticTypeGeodesic, unit); //zhaun4547转4490 //IGeometry geo22 = (IGeometry)po
同一个图形作转换与对比:
//总结:4547,4548转换成4490,然后计算其面积跟4490的是相差不多的
//4547转4548或者是转4549,跟没有转换的4548,4549的也是相差不多的
//如果没有转换的话,相同的图斑4490与4547,4548,4549...的面积是依次相差越来越大的