0

I am facing a problem because I know is not possible to include 2 iterators in the same ModelBuilder model. 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 each polygon by using Iterate feature selection to avoid the problem of overlapping polygons
  2. Iterate raster to make the iteration of each raster in each polygon

I am trying by creating a submodel to iterate the rasters

enter image description here

and a model that calls the submodel to perform the zonal statistical

enter image description here

However, in the Input value raster of the model, I am not able to call the rasters I have collected in the submodel.

Any idea on how to solve this?

3
  • So, your polygons table will have 1000+ fields?
    – FelixIP
    Nov 28, 2021 at 18:39
  • No, I have 10 polygons and 1000 rasters. Then, I need to calculate the zonal statistics as table for each polygon and each raster
    – Sss
    Nov 28, 2021 at 18:45
  • 1
    So the desired output is 10k tables?
    – FelixIP
    Nov 28, 2021 at 19:59

1 Answer 1

1

I'm not 100% sure that I understand your situation precisely, but if I do understand your requirements, then what you need to do is...

Pick one of the two scenarios below. If all the rasters need to processed against all of the polygons, then it probably doesn't matter too much which you choose. But which ever one of these two scenarios you choose, most of the processing will be done in the sub-model, not the parent model, because it is only in the sub-model that you have both an individual raster AND an individual polygon to work with. The parent model would not have much in it apart from an iterator and the sub-model.

The important part is to connect the output of the parent model's iterator to an input (parameter) of the sub-model.

You will need to be careful to create your final outputs with unique names to avoid having them overwrite each other every time you run through the iterator. The 'Value' or 'Name' variable from the iterators can help with this (ie, use %Value% and %Name% as part of the output name, you may have to pass one of these in from the parent model the the sub-model, in addition to passing in the output of the parent model's iterator to the sub-model).

Raster iterator in the sub-model

The sub-model should have an input parameter for the polygon, which is connected in the parent model to the sub-model (output of the parent model's iterator). The sub-model can then process each raster (from the sub-model's own iterator) agains the polygon passed in (from the parent model's iterator).

Polygon iterator in the sub-model

The sub-model should have an input parameter for the raster, which is connected in the parent model to the sub-model (output of the parent model's iterator). The sub-model can than process each polygon (from the sub-model's own iterator) against the raster passed in (from the parent model's iterator).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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