Iterators in model builder

1376
4
Jump to solution
11-15-2021 06:56 PM
SAV
by
New Contributor II

Hello, my question is about iterators and model builder. I believe that does not fit in this group, but I am not able to post under the ModelBuilder group.

My question is:

I need to make a division between two rasters (raster1/raster2). Raster1 and Raster2 have the same name but are located in two different folders.

For example:

Folder1:  users/folder1/Raster1

Folder2: users/folder2/Raster2

I want to do these operations over multiple files, then I need to iterate over two folders and make the division of the rasters with the same name. The output is a raster with the result of that division.

I have tried following this idea: idea: https://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Integrating_a_model_within_a_model/00...

 

with the result of the image below. I cannot connect the output of the submodel to the raster calculator of the main model.

 

Any idea in how to do it?

 

Thank you in advance!

Picture1.png

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

Maybe this will help.

example.JPG

 

View solution in original post

0 Kudos
4 Replies
curtvprice
MVP Esteemed Contributor

It sounds like you don't need nested models. Iterate over the first folder, this will yield the path to the first raster as users\folder1\raster1.tif for example. 

Then then use the Name variable (which on that iteration will contain the text string "raster1.tif") to generate the path for the second by specifying it as users\folder2\%Name%.

Hope that helps you out!

0 Kudos
SAV
by
New Contributor II

Thank you!but I am not sure how to implement it. Could you provide me with some visual example? How can I put the name as variable and after use to generate the path for the second folder?

I have attached an image about how looks the first iteration, and what I can see in the raster calculator

Could you give some advice in how to do it?

Picture3.PNG

0 Kudos
curtvprice
MVP Esteemed Contributor

Maybe this will help.

example.JPG

 

0 Kudos
SAV
by
New Contributor II

Thank you for your help!

I could do it!