AnsweredAssumed Answered

Create a raster from subset of bands

Question asked by modybsystematics-co-il-esridist Employee on Jul 25, 2018
Latest reply on Jul 30, 2018 by Hornbydd

Hello all

 

I have a multi band raster (9 bands) and I need to create a 3 band raster from bands 1,3,4 in ArcObjects.

The way I do it in ArcMap is the MakeRasterLayer with the 3 needed bands and then copy raster it to a new name.

I cannot do the MakeRasterLayer in ArcObjects and retrieve the results.

The commands works successfully but I cannot get the results.

Here is my code:

ESRI.ArcGIS.DataManagementTools.MakeRasterLayer MakeRasterTool = new ESRI.ArcGIS.DataManagementTools.MakeRasterLayer();
MakeRasterTool.in_raster = @"D:\Rasters1\MultiBand.TIF";
MakeRasterTool.out_rasterlayer = "Three";
MakeRasterTool.band_index = "1,3,4";
result = GP.Execute(MakeRasterTool, null) as ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult;

ESRI.ArcGIS.Geoprocessing.IGPUtilities gpUtils = new ESRI.ArcGIS.Geoprocessing.GPUtilities();
IRaster RD = gpUtils.DecodeRaster(result.GetOutput(0));

 

I tried DecodeRasterLayer too with the same results.

Should I opened somehow the raster "Three"?

 

Thanks

Outcomes