Raster calculator with iterators in model builder

6837
2
Jump to solution
02-10-2015 02:02 PM
HeatherWelch1
New Contributor II

Hi all,

I am unable to use raster calculator after an iterator in model builder. I've read endless threads on this subject, but am still unable to get it to work. I'm trying to build a simple model: iterate rasters, collect values, raster calculator (see attached). However, when I try to connect the output values from Collect Values to Raster Calculator, the only available option is to connect them as a precondition. Any advice would be greatly appreciated.

If I can figure out the first step, I'd like to use raster calculator to convert the NoData in each raster to 1, using this expression: Con(IsNull("raster1"),1,"raster1")

How can I get the tool to run this iteration for each raster? If I use "%name%", will it work? Thanks in advance.

Cheers,

Heather

0 Kudos
1 Solution

Accepted Solutions
ChrisDonohue__GISP
MVP Alum

I don't know the exact answer, but here are some ideas:


1. My initial thought is that the "Collect Values" is not needed.  I'd try it without it.

2. If it does not work, it may be that you will need to use Raster Objects as part the process to bring in and then later save the final processed rasters.

When executing a Map Algebra expression that uses operators, the inputs must be either Raster objects or constants

Working with Raster objects

http://resources.arcgis.com/en/help/main/10.2/index.html#//00p60000000r000000

Overview of the Rules for Map Algebra

http://resources.arcgis.com/en/help/main/10.2/index.html#/An_overview_of_the_rules_for_Map_Algebra/0...

Chris Donohue, GISP

View solution in original post

0 Kudos
2 Replies
ChrisDonohue__GISP
MVP Alum

I don't know the exact answer, but here are some ideas:


1. My initial thought is that the "Collect Values" is not needed.  I'd try it without it.

2. If it does not work, it may be that you will need to use Raster Objects as part the process to bring in and then later save the final processed rasters.

When executing a Map Algebra expression that uses operators, the inputs must be either Raster objects or constants

Working with Raster objects

http://resources.arcgis.com/en/help/main/10.2/index.html#//00p60000000r000000

Overview of the Rules for Map Algebra

http://resources.arcgis.com/en/help/main/10.2/index.html#/An_overview_of_the_rules_for_Map_Algebra/0...

Chris Donohue, GISP

0 Kudos
curtvprice
MVP Esteemed Contributor

The raster calculator expression should be this, after renaming the variable named 200803.img to raster

Con(IsNull("%raster%"), 1, "%raster%")

Make sure the output is named something like a%Name%. This will make sure grid outputs will be valid (they must be less than 13 chars and start with a letter).

0 Kudos