Add multiple locations in Model builder

596
5
01-23-2013 01:01 AM
OlofOlsson
New Contributor
Hi,

I have to run Closest facility for 47 cities separately. I have a model for this but dont want to run it manually for each city. Is there a way, for example by using Select or Select by attribute, to add the facilities and incidents for each city in a single model in model builder?

/Olle
Tags (2)
0 Kudos
5 Replies
AlexeyTereshenkov
Regular Contributor III
Hi Olle,

This scenario is possible to implement by using the Add Locations or Make Closest Facility Layer GP tools (depending on your needs) and the Iterate Feature Selection iterator in ModelBuilder. Check how the iterator works here.
0 Kudos
OlofOlsson
New Contributor
Hi Olle,

This scenario is possible to implement by using the Add Locations or Make Closest Facility Layer GP tools (depending on your needs) and the Iterate Feature Selection iterator in ModelBuilder. Check how the iterator works here.


Thank you for your quick reply. I have already built the model in model builder but since I have two feature classes for facilities and origins I dont think I can use an interator to solve this (since model builder only supports one iterator per model). But maybe I didnt understand you correctly?

/Olle
0 Kudos
AlexeyTereshenkov
Regular Contributor III
You are right, a model can contain only one iterator. How you can create a model which will contain a model (just drag and drop the model from Catalog window to the canva) and add another iterator if needed.
0 Kudos
OlofOlsson
New Contributor
Thanks, I will look into that. I am currently using submodels (building my main model for the closest facility analysis and then adding that 47(!) times in a new model, then manually specifying the incidents and facilities for each city before I run the model). It never occured to me to use iterators like you suggested. This is off course a much more elegant solution 🙂

You are right, a model can contain only one iterator. How you can create a model which will contain a model (just drag and drop the model from Catalog window to the canva) and add another iterator if needed.
0 Kudos
JaySandhu
Esri Regular Contributor
Depending on how your problem/data is structured, you could solve for all the 47 cities at the same time. That is, the closest facility solver can take multiple incidents (your 47 cities) and solve the for the closest facility from the set of facilities that you have loaded.

Jay Sandhu
0 Kudos