C#调用GP工具Clip裁剪栅格数据报错
m_pClip = new ESRI.ArcGIS.DataManagementTools.Clip();
this.m_pClip.in_raster = rasterFile;
this.m_pClip.rectangle = string.Format("{0} {1} {2} {3}", pOutExtent.XMin, pOutExtent.YMin, pOutExtent.XMax, pOutExtent.YMax);
//this.m_pClip.in_template_dataset = "#";
//this.m_pClip.nodata_value = -3.402823e+038;
//this.m_pClip.clipping_geometry = "NONE";
this.m_pClip.maintain_clipping_extent = "MAINTAIN_EXTENT";
this.m_pClip.out_raster = outPath;
m_pGeoProc.OverwriteOutput = true;
geoprocessor.Execute(process, null);
执行Execute 报上面的错误。
2 个回复
朱新颖
赞同来自:
其次,路径是否过长?是否含有中文等特殊字符,修改成只含有英文试试,另外,可以通过try catch捕捉一下详细报错信息。
下面代码是我以前执行成功的,可供参考:
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
ESRI.ArcGIS.DataManagementTools.Clip clip = new ESRI.ArcGIS.DataManagementTools.Clip();
clip.in_raster = @"E:\ZhuXinying\testData\Raster.gdb\PDEM";
clip.rectangle = "-117.35334730268 33.8297125828826 -116.792366370644 34.4768962586111";
clip.out_raster = @"E:\ZhuXinying\testData\Raster.gdb\PDEM_Clip";
clip.in_template_dataset = @"E:\ZhuXinying\testData\Raster.gdb\clipPDEM";
clip.nodata_value = "-1";
clip.clipping_geometry = "ClippingGeometry";
try
{
gp.Execute(clip, null);
}
catch (Exception ex)
{
// Print geoprocessing execution error messages.
for (int i = 0; i < gp.MessageCount; i++)
Console.WriteLine(gp.GetMessage(i));
}
nfc - GISer
赞同来自:
要回复问题请先登录或注册
发起人
GISer
相关问题
问题状态