Submodel and iterator

797
1
09-26-2018 12:53 AM
BartoszBrzeziński1
New Contributor III

Hi, 

In my case I would like to automate hole process but i have little problem with submodel and iterator. So what is going on? I hava few shapefiles (watersheds) and i want export each to geodatabase. So I created submodel. After that I would like to clip contours (generated from DTM). Clip feature: every watershed polygon, Input feature: contour. I created iterator based on previous mentioned watersheds database but after loop the model export shapefiles to geodatabase again and again. I know that iterator after submodel is wrong but how to created model on proper way?

Thank for help!

0 Kudos
1 Reply
JakeSimms1
Esri Contributor

Bartosz, got a simple solution for you.

Ditch the sub-model. I have recreated your model with test data and have a working solution.

Insert a model variable Workspace (In Model Builder - Insert > Create Variable > Workspace)

Create a file geodatabase using inline variables the inline variable comes form the iterator where you set the Group by Fields field. Think of it as setting the attribute which will give the geodatabase and watershed output its name.

Then build your model as above. Make sure to use the geodatabase creation location within your clip with the inline variable. 

And set the output of the Create File GDB tool as a prerequisite for the Clip to insure the database is created first before you try to place model outputs from the Clip into it.

This is what the output looks like:

Let me know if you have any questions.

0 Kudos