How can I use IMapAlgebraOp to achieve the Raster Neiborhood Statistics?

249
0
02-16-2014 09:31 PM
RENShun
New Contributor
I have a code like this:
...................
IGeoDataset pGeoDataset = pDataset as IGeoDataset;
 IMapAlgebraOp rsalgebra = new RasterMapAlgebraOpClass();
 IRasterAnalysisEnvironment rasAnaEnv = (IRasterAnalysisEnvironment)rsalgebra;
...................

 rsalgebra.BindRaster(pGeoDataset, "R");
//FocalStatistics(,NbrRectangle(7,7,"CELL"),"MINORITY","NODATA")
String mpastr = "FocalStatistics(," + "NbrRectangle(7,7," + "\"" + "CELL" + "\"" + ")," + "\"" + "MINORITY" + "\"" + "," + "\"" + "NODATA" + "\"" + ")";                                                                
IGeoDataset outGetDataset=rsalgebra.Execute(mpastr);

I use ArcEngine 10.1 SDK and want achieve the FocalStatistics function same as in ArcGIS Desktop. I run this code and get messages"
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
But when I use the text got when run the code by tracks 'String var mpastr' in the code,I got "  FocalStatistics(,NbrRectangle(7,7,"CELL"),"MINORITY","NODATA")    " ,and get write result in ArcGIS Desktop.
I want to know how can I write the expression as mpastr to excute FocalStatistics Functions?
Thanks!
0 Kudos
0 Replies