0

I created a list of raster using ListRaster. However, composite band tool does not support list input. I want aggregate the list of raster into one raster, is there any other tool to do it in ArcGIS(arcpy)?

  • Are the rasters exactly the same size (rows, columns, cellsize, Origin X,Y)? Have a read of blogs.esri.com/esri/arcgis/2014/04/08/… – Michael Stimson May 19 '16 at 1:54
  • @MichaelMiles-Stimson Is there a way to do it through arcpy? – Yuyun He May 19 '16 at 2:03
  • Take your list and ';'.join(YourList) to turn it into semi-colon separated list for the composite bands tool or use GDALBuildVRT to make a virtual dataset. – Michael Stimson May 19 '16 at 2:16
  • @MichaelMiles-Stimson I tried ";".join(list) but it cannot open the input dataset. I have not used gdal before I'll take a try. Thank you!! – Yuyun He May 19 '16 at 2:32
  • Have you tried a list object for CompositeBands? The docs may be incorrect (wouldn't be the first time), provided your arcpy.env.workspace is set to the folder where the rasters are the tool might work with a list instead of a semi-colon separated list. – Michael Stimson May 19 '16 at 3:02
5

I tried this code and it worked.

import arcpy
arcpy.env.workspace = r'C:\GIS\MyRasterFolder' #My directory of rasters
rastList = arcpy.ListRasters()
myNewRast = arcpy.CompositeBands_management(rastList, r'C:\GIS\rasterCombined.tif')

(If this doesn't work for you, if you could post the code you're trying to run and the error message you're receiving, that will help refine things.)

  • it's interesting that the functions work under ArcGIS desktop but not on ArcGIS Pro. ArcGIS Pro does not recognize list input. – Yuyun He May 20 '16 at 14:09
  • I tried it in ArcGIS Pro with the same code above and it worked for me. Is there any chance that it doesn't like one of your rasters? – geobug May 20 '16 at 19:17
  • I tried exactly same input but it says my parameters are invalid. I checked pro's documents and it says for composite band function the input should not lists. It's good that it works on yours:) – Yuyun He May 20 '16 at 19:35
  • gis.stackexchange.com/questions/194353/… do you have any idea over this question? – Yuyun He May 20 '16 at 19:38
  • Well, yeah, it's good that it works, but it's kind of weird. Huh. I posted an answer to your other question. See if that helps at all. – geobug May 20 '16 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.