本文主要是介绍AE+C#开发问题之五——地图代数ERROR 010328: Syntax error at or near symbol NEW-LINE.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
最近在使用地图代数计算两个或者几个栅格数据的最大值、最小值、平均值的时候,遇到如下问题:
先粘贴下代码:
IGeoDataset tempGeodata1 = pRaster1 as IGeoDataset;//IGeoDataset tempGeodata2 = pRaster2 as IGeoDataset;IMapAlgebraOp rsalgebra = new RasterMapAlgebraOpClass();//设置栅格运算空间IRasterAnalysisEnvironment rasAnaEnv = (IRasterAnalysisEnvironment)rsalgebra;IWorkspaceFactory wsf = new FileGDBWorkspaceFactory();IWorkspace ws = wsf.OpenFromFile(m_projextdatapath + "\\" + m_projextgdbname, 0);//设置输出空间rasAnaEnv.OutWorkspace = ws;rsalgebra.BindRaster(tempGeodata1, "F");rsalgebra.BindRaster(tempGeodata2, "T");IGeoDataset outGetDataset = null;if (operatename == "MAX"){outGetDataset = rsalgebra.Execute("con([F]>[T],[F],[T])");}if (operatename == "MIN"){outGetDataset = rsalgebra.Execute("con([F]<[T],[F],[T])");}if (operatename == "MEAN"){outGetDataset = rsalgebra.Execute("([F]+[T]) / 2") ;}return outGetDataset;
最大值错误:
ERROR 010316: Unable to open the input raster: E:\项目\TEMPLATE.GDB\G_G528>E:\项目\TEMPLATE.GDB\G_G529
ERROR 010067: Error in executing grid expression.
最小值错误:
ERROR 010316: Unable to open the input raster: E:\项目\TEMPLATE.GDB\G_G808<E:\项目\TEMPLATE.GDB\G_G809
ERROR 010067: Error in executing grid expression.
平均值错误:
ERROR 010328: Syntax error at or near symbol NEW-LINE.
ERROR 010267: Syntax error in parsing grid expression.
经过反复试以及网友提供的方法,是因为空格的问题,拿最大值为例:
错误写法:
outGetDataset = rsalgebra.Execute("con([F]>[T],[F],[T])");
正确写法:
outGetDataset = rsalgebra.Execute("con([F] > [T],[F],[T])");
也就是说加了空格就没问题,就这么一个小的问题,或者arcengine接口解析的时候,是根据空格来判断运算符。
这篇关于AE+C#开发问题之五——地图代数ERROR 010328: Syntax error at or near symbol NEW-LINE.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!