//Define the origin for the raster dataset, which is the lower left corner of the raster. IPoint origin = new PointClass(); origin.PutCoords(lowerLeft.x, lowerLeft.y); //Define the dimension of the raster dataset. int width = nColumns; //This is the width of the raster dataset. int height = nRows; //This is the height of the raster dataset. double xCell = cellSize; //This is the cell size in x direction. double yCell = cellSize; //This is the cell size in y direction. int NumBand = 5; // This is the number of bands the raster dataset contains. //Create a raster dataset in grid format. rasterDataset = rasterWs.CreateRasterDataset(rasterFilename, "GRID", origin, width, height, xCell, yCell, NumBand, rstPixelType.PT_FLOAT, sr, true); //Get the raster band. IRasterBandCollection rasterBands = (IRasterBandCollection)rasterDataset; IRasterBand rasterBand; IRasterProps rasterProps; rasterBand = rasterBands.Item(0); rasterProps = (IRasterProps)rasterBand; //Set NoData if necessary. For a multiband image, NoData value needs to be set for each band. const double NoDataValue = -9999.99; rasterProps.NoDataValue = Convert.ToSingle(NoDataValue); //Create a raster from the dataset. IRaster raster = rasterDataset.CreateDefaultRaster(); IRasterEdit rasterEdit = (IRasterEdit)raster;
To change ESRI.ArcGIS.DataSourcesRaster.IRasterBand.Bandname property, you must cast ESRI.ArcGIS.DataSourcesRaster.IRasterBand object into ESRI.ArcGIS.Geodatabase.IDataset interface and run IDataset.Rename() method.