QQ交流群:607330463 GIS开发技术最强交流群
/// <summary>
/// GP栅格计算器
/// </summary>
/// <param name="expression">表达式</param>
/// <param name="output_raster">输出地址</param>
private void GPRasterCalculatorAnalyst(string expression, string output_raster)
{
//string a1 = "C:\\Users\\54061\\Documents\\ArcGIS\\Default.gdb" + "\\" + "Reclass_Extr2";
//string a2 = "C:\\Users\\54061\\Documents\\ArcGIS\\Default.gdb" + "\\" + "Reclass_Slop1";
//表达式规范如:string expression = "\"" + a1 + "\" + \"" + a2 + "\"";
//记住表达式填写路径 两头要加 \"
Geoprocessor GP = new Geoprocessor();
GP.OverwriteOutput = true;
//定义栅格计算器
RasterCalculator RC = new RasterCalculator();
RC.expression = expression;
RC.output_raster = output_raster;
try
{
GP.Execute(RC, null);
object sev = null;
MessageBox.Show(GP.GetMessages(ref sev));
}
catch (Exception ex)
{
object sev = null;
MessageBox.Show(GP.GetMessages(ref sev));
}
}
GP写法的注意:肯可能突然弹出来这个问题,但是不影响,确定也能成功