其他分享
首页 > 其他分享> > ArcEngine GP栅格计算器以及表达式的写法描述

ArcEngine GP栅格计算器以及表达式的写法描述

作者:互联网

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写法的注意:肯可能突然弹出来这个问题,但是不影响,确定也能成功

 

 

标签:sev,string,GP,栅格,RC,expression,ArcEngine
来源: https://blog.csdn.net/qq_30430463/article/details/112721982