Merging features after iteration

3048
7
09-14-2015 06:29 AM
JosephCandella
New Contributor

Let me start with an apology.  This is actually my first attempt at model creation so it is likely one of the ugliest in the known universe.

With that said, what I've done is created the model to iterate through a layer containing a few hundred observer points.  It then creates view sheds and "non-view sheds" for a given point at three distances.  This part works fine and creates a separate layer for each view shed/distance combination (which I need).  However, I also need a layer which contains ALL view shed (and non) at all 3 distances and a final layer which combines everything.  I'm attempting to do this with a merge (seen below) which doesn't work.  I've also attempted this using an append but the result is consistently a layer with only one record (the final record in the iteration process).  I can do the merge manually after the view shed process but the merge takes a significant amount of time.  I am hoping that conducting the merge/append as part of this process will speed things up somewhat.

I've searched around for solutions and haven't managed to find anything that directly applies.  Any help would be greatly appreciated.Model.jpg

0 Kudos
7 Replies
WesMiller
Regular Contributor III

Did you clear anything selected? It sounds like to me that you have something selected or not all you want is selected.

0 Kudos
JosephCandella
New Contributor

Wes - I do make sure that I've cleared selected BEFORE running the model if that is what you mean.  As I said, if I remove the merges at the end, the model creates the individual layers (~150 x 6) perfectly.

0 Kudos
WesMiller
Regular Contributor III

I think i see it now does your merge correspond to the results of your final iteration? If this is the case you may have to set a precondition for your merges to the final iteration(i'm not sure how to do that part) or you could create a separate model that does the merge after the original model finishes

JosephCandella
New Contributor

Thanks Wes - That does make sense.  I've been playing around with preconditions but haven't found the right way to make it work in this model.  The reason(s) I was shying away from a final wholesale merge at the end was that I will have several hundred layers to be merged.  I'm unsure how to designate those multiple layers without naming ALL of them (which is unwieldy).

0 Kudos
WesMiller
Regular Contributor III

Joseph, like Darren Wiens​ says this may be a good time to think python you could then construct a list of the feature classes to merge at the end.

0 Kudos
DarrenWiens2
MVP Honored Contributor

Have you looked into using a submodel? I believe the example under "Advanced Use of Model Iterators" should point you in the right direction (i.e. run your iterator model, which feeds everything into a single variable for input into Merge in your main model).

I'll just add that using iterators is really a clue that it may be time to take the plunge into Python, which makes iterating so much simpler.

JosephCandella
New Contributor

Thanks Darren.  I have looked into submodels and had gone over that example.  Mine was repeatedly erroring out when I first tried.  However I've learned more since then and may need to revisit.  I had also tried a submodel with an append but couldn't figure out how to start the append part only AFTER the first iteration had created a layer file.

I will also check into python.  I have very limited scripting experience but possibly it's time to expand my knowledge.

Thanks again.

0 Kudos