AE 不同椭球体地理坐标转换 使用GP工具

1、需要先定义一个转换方式 从一个地理坐标系转换到另一个地理坐标系

  public static void alter() { 
            Geoprocessor gp = new Geoprocessor();
            gp.OverwriteOutput = true;
          
            ESRI.ArcGIS.DataManagementTools.CreateCustomGeoTransformation create = new ESRI.ArcGIS.DataManagementTools.CreateCustomGeoTransformation();
            create.geot_name = "hhh";
            ISpatialReferenceFactory spatialReferenceFact = new SpatialReferenceEnvironmentClass();
            ISpatialReference pSR = spatialReferenceFact.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
            create.in_coor_system = pSR;
            create.out_coor_system = pSR;

            create.custom_geot = "GEOGTRAN[METHOD['Geocentric_Translation'],PARAMETER['X_Axis_Translation',''],PARAMETER['Y_Axis_Translation',''],PARAMETER['Z_Axis_Translation','']]";

                try
                {
                gp.Execute(create, null);

                }
                catch
                {
                    for (int a = 0; a < gp.MessageCount; a++)
                    {
                        Console.WriteLine(gp.GetMessage(a) + "\n"); ;
                    }
                }

        }

2、使用上述地理坐标系 进行投影转换

到这一步时上一步自定义的方法不能用了,但是同一个地理坐标系内投影是可以转换的。(希望有大佬解答,怎么自定义转换方法,后续也可以使用的

 #region 调用ArcToolBox投影工具
        public static void alterSpatialReference(IGeoDataset pGeoData, ISpatialReference pSpatialReference, string transform_method, string outputPath)
        {
            Geoprocessor gp = new Geoprocessor();
            gp.OverwriteOutput = true;
            ESRI.ArcGIS.DataManagementTools.Project pro = new ESRI.ArcGIS.DataManagementTools.Project();
           
            if (pGeoData != null)
            {

                IGeoDataset pGeoDataset = pGeoData;

                pro.in_dataset = pGeoData;
                pro.in_coor_system = pGeoDataset.SpatialReference;
                pro.out_coor_system = pSpatialReference;
                pro.out_dataset = outputPath;
                pro.transform_method = transform_method;

                try
                {
                    gp.Execute(pro, null);
                }
                catch
                {
                    for (int a = 0; a < gp.MessageCount; a++)
                    {
                        Console.WriteLine(gp.GetMessage(a) + "\n"); ;
                    }
                }

            }

        }
        #endregion

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值