Sunday, 10 January 2016

How to Iterate through Bands of Raster using ArcGIS 10.1 ModelBuilder?


I have a large number of rasters with 3 bands (R,G,B). What I want to do is add all 3 bands of each raster together to end up with a single band image with the summed R,G,B values in each pixel but I'm not sure how to do this in ModelBuilder. Do I have to somehow split each raster first, then add each one?



How would I iterate through each band of every raster?


Edit:Basically this is what I have so far. Right now it will take 3 bands of 1 raster and add the bands then go on to create a polygon of a certain reclassed area. I want to do this on a large number of rasters but am unsure of how to make it work.


enter image description here



Answer



Set up your model as shown below.


enter image description here


Tools used.



  • Iterate Rasters - Picks up all the rasters in a given workspace

  • Parse Path - Set Parse Type to PATH and FILE


  • Calculate Value - Calculates Full Path to Raster Band. Set Data Type as Raster Band. For Band 3 - the expression would be something like this "%path%"+"\%FILE%"+"\Band_3"

  • Composite Bands - Pulls out individual Bands using paths from Calculate value

  • Cell Statistics - Add the Bands together - Set Overlay Statistic to SUM

  • Add the rest of your processing steps


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...