TransWikia.com

How to iterate folder in a model that has a sub-model (iterate raster) in ModelBuilder

Geographic Information Systems Asked by Sung Joo Lee on July 16, 2021

enter image description here

I have multiple folders that contain a number of raster files. What I would like to do is iterate through every folder and resample each every raster file from 1km to 30m.

Since only one iterator is allowed in one model, I figured importing the submodel (iterate raster) into another model (iterate workspace).
In the ‘Resample30m’ model, I created a folder variable and defined it as a model parameter.
I chose ‘folder’ for Workspace type in the workspace iterator, and tried to connect the iterate workspace’s output (Workspace) with Resample30m model, it was impossible to do it. Only the environments and precondition option popped out.

I’m guessing the iterate workspace doesn’t access the inner composition and that’s the one raising the problem.

Is there any way that I can achieve what I want in ModelBuilder?

2 Answers

For an alternative to using nested iterators, try using a combination of iterators and lists.

Essentially, in your 'inner' model, right-click to make the workspace variable a list, and link to your workspaces.

Answered by Mox on July 16, 2021

another alternative is to run your model in batch mode. First define your input file as a parameter of the model, close model builder, then right click on you model asking for batch. You can then open all the files inside you folder and launch all jobs at once.

Remark: IMHO, the best alternative is to export your model in Python, where you can nest as many loops as you want.

Answered by radouxju on July 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP