如何用ArcEngine编程得到当前图层的坐标系
发布网友
发布时间:2022-05-21 08:57
我来回答
共2个回答
热心网友
时间:2023-10-21 13:36
朋友,得到图层的空间参考需要在ILayer和IGeoDataset接口之间进行转换:首先使用ILayer接口得到图层ILayer layer=map.Layer[i]; 然后转换到IGeoDataset接口,访问IGeoDataset接口的SpatialReference.Name属性即可。
热心网友
时间:2023-10-21 13:37
首先获取FeatureClass 以通过地图控件图层为例:
IMap pMap = MapCtrl.Map;
ILayer pLayer = pMap.get_Layer(0);
IFeatureClass pFeaCls = (pLayer as IFeatureLayer).FeatureClass;
再通过IGeoDataset接口获取FeatureClass坐标系统
ISpatialReference pSpatialRef = (pFeaCls as IGeoDataset).SpatialReference;
另外 可以通过IProjectedCoordinateSystem接口获取坐标系的详细信息
IProjectedCoordinateSystem pProCoordSys = pSpatialRef as IProjectedCoordinateSystem;
IProjection pro = pProCoordSys.Projection;
pro.Name;
pProCoordSys.FalseEasting
pProCoordSys.FalseNorthing
pProCoordSys.get_CentralMeridian(true);
pProCoordSys.CoordinateUnit.Name;
IGeographicCoordinateSystem pGeographCoordinateSys =pProCoordSys.GeographicCoordinateSystem;
等等