0

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?

1
  • Yes, but it's a real pain. The iterators do not work as you expect them to, and getting them to is a bit ticklish. My experience suggests if you have 10 or less folders to iterate over, just run your tool ten times. Otherwise, developing a nest model is a waste of time. If you are going to be doing things like this often, give serious thought to exporting to python, or doing it in R.
    – Mox
    Mar 11, 2020 at 17:11

2 Answers 2

1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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