Select to view content in your preferred language

2 iterators in the same model builder

3724
12
11-22-2021 06:09 PM
SAV
by
New Contributor II

Hi all! I am facing a problem because I know is not possible to include 2 iterators in the same model builder. I have 10 features (polygons) in a shapefile and 1000 rasters in a folder. I want to calculate for each polygon the zonal statistical as a table for each raster. Therefore, I need to use:

  1. Iterate feature selection to avoid the problem of overlapping polygons and iterate each polygon
  2. Iterate raster to make the iteration of each raster in each polygon

Therefore, I need two iterators, any idea on how to overcome this problem?

I am trying by creating a submodel and a model as shown in the images below but without too much success

submodel2.JPGmodel.JPG

 

Thank you!

 

 

0 Kudos
12 Replies
SAV
by
New Contributor II

I solved the problem by renaming the output of the parse_path to Name2

Capture4.PNG

but in the iterate rasters, only use the first raster and does not iterate over the other rasters in that folder. The iterate rasters looks like the following image

Capture5.PNG

and my folder I am sure that has more than 1 raster file as shown in the image below

7.PNG

Do you know why iterate only over the first raster file?

 

Thank you for the help!

0 Kudos
curtvprice
MVP Esteemed Contributor

Great to hear you got this thing running. I don't know, I would make sure you validate the model before you re-run it. Your model looks like it should run correctly. You may want to try "turning it off and turning it on again" -- ie restart Pro. Often that fixes things for me when things do not run as they should!

0 Kudos
curtvprice
MVP Esteemed Contributor

Good solution removing the space. This can happen with the Spatial Analyst tools - they often bail on names, layer names, or even paths with spaces or any special characters.

0 Kudos