2

I'm creating a fishnet on ModelBuilder, the extent of which is based on an Input raster.

The output of "Create Fishnet" is gone through an Intersect tool, and then is fed into an Iterate Feature Iterator. The output of the iterator is fed into a Clip tool, in order to make separate clipped images of the original image, based on the features of the Fishnet.

The problem is that after the first execution of Clip, the entire model is iterated from the beginning, instead of moving to clipping with the next feature. This does not happen if I use an Input feature class as feed to the Iterate Feature Selection (e.g., an existing shapefile and not with something that is created with the same model). I've also tried to use "Make Table View" between the Intersect and the Iterator, but the same thing happened.

Any idea as to the cause of this?

Model

1 Answer 1

2

This would be expected behaviour. EVERYTHING runs as many times as an iterator loops. If you come from a background of programming this would seem slightly odd and can trip you up.

The solution is to place everything feeding into the iterator into it's own model. Then you drag 'n' drop that model into a master model. Create another model with the iterator and clip and drag 'n' drop that into the master model. So you end up with one model containing two sub-models. To enable models to connect to each other you would need to expose the inputs/outputs as parameters.

So remember the golden rule when using any iterator that everything in the model runs as many times as it loops. I often see models where people connect say a merge tool directly to an iterator. Whilst "it works" it is terribly inefficient, the merge tool only needs to run once as it takes a LIST of inputs, this is why you use the collects tool and sub-modelling.

1
  • Yes,I also just saw that in the last line of documentation of Iterate Feature. I did exactly that and it worked! It's an odd behavior regardless, and yes even if it works it is terribly inefficient, especially if the model includes raster processing.Thank you very much!
    – kowalski
    Jan 14, 2019 at 10:31

Your Answer

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

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