你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
朱新颖
赞同来自:
ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984); spatialReference.SetFalseOriginAndUnits(-80.0000000232831, 39.9999999767169, 42949672.9); //Destination spatial reference IProjectedCoordinateSystem projectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1927UTM_19N); //Define the XYDomain equivalent to SetFalseOriginAndUnits projectedCoordinateSystem.SetDomain(500000, 600000, 5300000, 5600000); //Create a Geotransformation (Datum transformation) IGeoTransformation geoTransformation = spatialReferenceFactory.CreateGeoTransformation((int)esriSRGeoTransformationType.esriSRGeoTransformation_NAD1927_To_WGS1984_12) as IGeoTransformation; IMapDocument mapDocument = new MapDocumentClass(); string filepath = @C:\Users\Administrator\Desktop\mxd\无标题1.mxd; mapDocument.Open(filepath); IMap map = axMapControl1.Map; IMapGeographicTransformations mapGeographicTrans = map as IMapGeographicTransformations; IGeoTransformationOperationSet geoTrans = mapGeographicTrans.GeographicTransformations; geoTrans.Set(esriTransformDirection.esriTransformReverse, geoTransformation); IMxdContents mxd = axMapControl1.Map as IMxdContents; mapDocument.ReplaceContents(mxd); mapDocument.Save(true, false);
要回复问题请先登录或注册
1 个回复
朱新颖
赞同来自:
将IMap转为IMapGeographicTransformations接口,然后通过IMapGeographicTransformations.GeographicTransformations获取IGeoTransformationOperationSet,通过IGeoTransformationOperationSet.Set将自定义的IGeoTransformation添加进去,然后将该mxd保存之后在ArcMap中打开就已经进行动态投影了。
测试代码:
要回复问题请先登录或注册