永发信息网

如何实现 ArcEngine+C# 中实现栅格数据投影转换?求救,急急!!!答案有帮助的加分。

答案:2  悬赏:0  手机版
解决时间 2021-02-07 08:39
  • 提问者网友:沉默菋噵
  • 2021-02-06 14:23
源代码大致如下:
igp= new ESRI.ArcGIS.Geoprocessor.Geoprocessor();

pror = new ProjectRaster();

//IRaster newRaster = new RasterClass();
//再进行投影
//构造Geoprocessor

//pror.in_coor_system = oldsr;//oldsr.Name"GCS_WGS_1984"
pror.out_coor_system = oldsr;//.Name; "World_Mercator"
pror.in_raster = pRaster;// @"E:\TestData\gisrs\reclassify\reclass.img";
pror.out_raster =@"E:\TestData\gisrs\reclassify\out.img";// newRaster;
// pror.cell_size = 68818;
//pror.cell_size = pProps.MeanCellSize().X;
pror.resampling_type = "NEAREST";

// pror.re

//执行project raster工具
RunTool(igp, pror, null);
private void RunTool(Geoprocessor geoprocessor, IGPProcess process, ITrackCancel TC)
{
// Set the overwrite output option to true
geoprocessor.OverwriteOutput = true;
geoprocessor.AddOutputsToMap = true;
try
{
// geoprocessor.Execute(
geoprocessor.Execute(process, null);
ReturnMessages(geoprocessor);

}
catch (Exception err)
{
Console.WriteLine(err.Message);
ReturnMessages(geoprocessor);
}

}
最佳答案
  • 五星知识达人网友:慢性怪人
  • 2021-02-06 15:33
下面是Desktop里面这个Tool参数的说明,我觉得问题可能出现在下面这点的设置上

geographic_transform (Required)

The transformation method used between two geographic systems or datums.

The geographic transformation is optional when the input and output coordinate systems have the same datum. If the input and output datum are different, a geographic transformation needs to be specified.

Learn about geographic transformation methods.

For information on each supported geographic (datum) transformations, see the geographic_transformations.pdf located in \ArcGIS\Documentation.
全部回答
  • 1楼网友:你哪知我潦倒为你
  • 2021-02-06 16:31
搜索半天没一个靠谱的答案,自己写了一个下面 的代码仅供参考public bool ChangeRasterCoordinate(string prjPath, string inputRasterPath, string outRasterPath) { var prj = SpatialReferenceHelper.ReadSR(prjPath);//prjPath即你要转换成的坐标系的prj文件;inputRasterPath:需要转换的文件路径;outRasterPath转换完成后的文件路径 Geoprocessor gp = new Geoprocessor(); ProjectRaster projectRaster = new ProjectRaster(); projectRaster.in_raster = inputRasterPath; projectRaster.out_raster = outRasterPath; projectRaster.cell_size = "10000"; projectRaster.out_coor_system = prj; IGeoProcessorResult tGPResult = (IGeoProcessorResult)gp.Execute(projectRaster, null); if (tGPResult.Status == ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded) { return true; } return false; }
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯