Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a layer with several polygons and a road map. I need to take each polygon and use it to clip the road map, dissolve all of the road records into one, and then merge the polygons into one shapefile. The goal is to have a shapefile with each polygon as one record that contains the total roads within that polygon.

I know the easiest solution would be to dissolve the roads layer before hand and then clip using the polygons but I'm working on a continental scale and my computer keeps running out of memory for that. If I clip the road map and then dissolve everything is fine, the issue is the merge. Using row iterator the model only spits out one shapefile at a time after running a clip and dissolve on it. How do I collect all of those outputs and merge them?

Current Model: I'm using row iterator to select out each polygon, then use the clip tool to clip the road map, then using the dissolve tool to dissolve all of the roads inside that polygon into one record. Now I'm stuck on how to merge it all back together.

Thanks!

share|improve this question
1  
There is an ArcGIS tool named merge (data management) resources.arcgis.com/en/help/main/10.1/index.html#/Merge/… . If you need more that this tool, edit your question to allow better understanding of your final goal. –  jeb May 5 at 21:17
    
Yes, there is that but it isn't likely to work with the iterator and should be done after the model is run as a single geoprocessing step. –  Michael Miles-Stimson May 5 at 22:22
    
So you have x polygons and you want x (tremendously) multi-part lines in a single shapefile? I think what you're trying to do is create a master shapefile and then Append the iterator result shapefiles into it (as the last step of your iteration). –  Chris W May 6 at 1:20
    
I think Append could directly solve your problem, but based on jeb and Michael's comments, I found another area/tool you may wish to look into. Some help documentation stated you can only have one iterator per model and if you need more to break into submodels - so the model you have would be called in another model that does the merge. To do so you would add a Collect Values tool. See this help page. –  Chris W May 6 at 5:15
    
Thanks for the advice! I gave it a try using the Append tool but it only adds the result of the last iteration, so just the last polygon and its roads. Merge has the same problem. –  user26142 May 6 at 16:50

1 Answer 1

up vote 3 down vote accepted

You need to create a Sub model that does the "clipping" and call this from within Master model.

Your sub model must expose the output of the collects tool as a parameter. I think you want to do an Intersect not actually a clip as you need to pass over the polygon ID to dissolve the road network.

So the sub model (what I am calling the clip model) would be:

Sub model

The master model would be:

Master model

share|improve this answer
    
That looks like what I might need. –  user26142 May 6 at 16:47
    
How do you make a submodel? There don't seem to be any tools for making one. –  user26142 May 6 at 16:48
1  
A sub model is simply a model you create and save in a toolbox then you create a new blank "master" model and drag you sub-model from your toolbox into the master model, just like you drag other tools into modelbuilder. So it can get pretty mind bending when you have models within model within models... :) –  Hornbydd May 6 at 18:57
1  
Most people don't read the help file (I too have been guilty of that) but it does say an iterator will cause everything to execute in a model. So if you start using iterators then you often need to create sub-models, so the bottom line is you need to get your head around the sub-model and there is a whole page about it here. –  Hornbydd May 6 at 19:03
    
Thanks! That explanation makes much more sense than the directions on the help page. The help page makes it seem that they're referring to specific tool to be used for creating a submodel. –  user26142 May 6 at 19:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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