做一个ArcEngine的小程序,用到IMapAlgebraOp接口进行栅格数据相减,自己写了个栅格求差的函数,如下所示。只是不知道为什么计算完了之后的结果不是差值,很诡异的一个栅格,不知道怎么计算出来的。不知道各位大侠有没有遇到过类似的问题?求助
1 public IRaster QiuCha(IRaster oldDEM, IRaster newDEM, 2 string filepath,string filename) 3 { 4 IMapAlgebraOp mapAlgebraOp = new RasterMapAlgebraOpClass(); 5 IRasterAnalysisEnvironment env = mapAlgebraOp as IRasterAnalysisEnvironment; 6 IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass(); 7 IWorkspace workspace = workspaceFactory.OpenFromFile(filepath, 0); 8 env.OutWorkspace = workspace; 9 10 mapAlgebraOp.BindRaster(oldDEM as IGeoDataset, "old"); 11 mapAlgebraOp.BindRaster(newDEM as IGeoDataset, "new"); 12 13 IRaster pRasterOut; 14 pRasterOut = mapAlgebraOp.Execute("Abs([old] - [new])") as IRaster; 15 SaveRraster(pRasterOut, workspace, filename, "TIFF"); 16 mapAlgebraOp.UnbindRaster("old"); 17 mapAlgebraOp.UnbindRaster("new"); 18 mapAlgebraOp = null; 19 workspace = null; 20 return pRasterOut; 21 }
请问你是怎么解决的呢