private void RasterCaculator(string path)
{
IMap map = MainMap.ActiveView.FocusMap;
ILayer layer1 = map.get_Layer(0);
ILayer layer2 = map.get_Layer(1);
ILayer layer3 = map.get_Layer(2);
ILayer layer4 = map.get_Layer(3);
ILayer layer5 = map.get_Layer(4);
IRasterLayer rasterlayer1 = layer1 as IRasterLayer;
IRasterLayer rasterlayer2 = layer2 as IRasterLayer;
IRasterLayer rasterlayer3 = layer3 as IRasterLayer;
IRasterLayer rasterlayer4 = layer4 as IRasterLayer;
IRasterLayer rasterlayer5 = layer5 as IRasterLayer;
IRaster pRaster1 = rasterlayer1.Raster;//获得已知栅格图层pRasterLyr的栅格对象
IRaster pRaster2 = rasterlayer2.Raster;
IRaster pRaster3 = rasterlayer3.Raster;
IRaster pRaster4 = rasterlayer4.Raster;
IRaster pRaster5 = rasterlayer5.Raster;
IGeoDataset tempGeodata1 = pRaster1 as IGeoDataset;//
IGeoDataset tempGeodata2 = pRaster2 as IGeoDataset;
IGeoDataset tempGeodata3 = pRaster3 as IGeoDataset;
IGeoDataset tempGeodata4 = pRaster4 as IGeoDataset;
IGeoDataset tempGeodata5 = pRaster5 as IGeoDataset;
IMapAlgebraOp rsalgebra = new RasterMapAlgebraOpClass();
//设置栅格运算空间
IRasterAnalysisEnvironment rasAnaEnv = (IRasterAnalysisEnvironment)rsalgebra;
IWorkspaceFactory wsf = new RasterWorkspaceFactoryClass();
IWorkspace ws=wsf.OpenFromFile("",0);//设置输出空间
rasAnaEnv.OutWorkspace = ws;
rsalgebra.BindRaster(tempGeodata1, "1");
rsalgebra.BindRaster(tempGeodata2, "2");
rsalgebra.BindRaster(tempGeodata3, "3");
rsalgebra.BindRaster(tempGeodata4, "4");
rsalgebra.BindRaster(tempGeodata5, "5");
IGeoDataset outGetDataset=rsalgebra.Execute("[1] * [2] * [3] * [4] * [5]");
IRasterLayer pCreatRalyr=new RasterLayerClass();
pCreatRalyr.CreateFromRaster((IRaster)outGetDataset);
MainMap.AddLayer(pCreatRalyr);
}