Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
Have a look at this related question –  Hornbydd Nov 6 '13 at 18:22
    
I understand how to select bands, but I'm unsure how to turn this into a batch process so I can perform this on a number of rasters –  eddie416 Nov 6 '13 at 18:33

2 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
This has been very helpful and an awesome answer, but I'm having trouble connecting both the path and file to each 'calculate value'. Arc only wants to connect one of either the path or file to each –  eddie416 Nov 7 '13 at 16:21
    
What are the connections from parse path to calculate value set as in this model? Expression, code block, pre condition, etc? –  eddie416 Nov 7 '13 at 17:42
    
Nevermind, got it working. Thanks a lot!! –  eddie416 Nov 7 '13 at 18:34

This question and answer were helpful to me, but I couldn't get the answer model above to work for me (I got stuck around the issue of "what are the connections from parse path to calculate value..?" as did eddie416). I ended up finding a simpler solution using the Select Data tool (model only), as below.

My task was slightly different in that I wanted to iterate through rasters and then calculate a statistic based on only band 2 out of the rasters. But the Select Data tool could be used repeatedly to select the various bands to feed into Cell Statistics (e.g. for the question above) or other tools. In my case I also had to use the Collect Values (model only) tool so that Cell Statistics could operate on each of the rasters being iterated.

model

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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