I have created a model for closest facility analysis. Now I would like to add an iterator to it. Specifically, I need to iterate through 448 "Incidents" (the closest facility model is structured so that it solves from incidents to facilities). Each of the incidents is stored as a shapefile in a folder (one feature per shapefile). So, I would use the "Files" iterator, presumably. But not sure how. Below is a screenshot of the model as currently constructed.
-
2Before answering your question, why do you have one feature per shapefile? Would it be possible to merge all your incidents features into one shapefile? If so, you would be able to calculate the closest facility for each feature in one go. Afterwards you could split the faetures again in different files if desired.– JelleCommented Apr 7, 2015 at 13:55
-
As I understand closest facility, if I ran it in one go, it would find the nearest incident relative to each facility. That's not what I want. I want a discrete closest facility analysis for every building at the site. That is, from every building to a given destination. Then iterate to the next destination, etc until every building has its own closest facility map. Later, I will combine them all for a from everywhere-to everywhere aggregate traffic map of the site (archaeological simulation of foot traffic).– Steve WernkeCommented Apr 7, 2015 at 14:12
-
Can you do a "for loop" from the model builder that iterates over every records in your feature class?– dassoukiCommented Apr 7, 2015 at 14:43
-
I can't get that to work. Never worked with the For iterator. Don't think that it is the correct iterator. I need a single point to be the incident in the model. One at a time. I believe Closest Facility does not limit analysis only to selected point(s). Rather, it will run them on all loaded locations.– Steve WernkeCommented Apr 7, 2015 at 15:57
-
I'm not sure I have my head around your problem... but since you mention "everywhere-to-everywhere," I wonder if you might be able to use an OD Cost Matrix. (You would still need to merge your shapefiles into one, as Jelle suggested.) See resources.arcgis.com/en/help/main/10.2/index.html#//…– AndyCommented Apr 7, 2015 at 18:42
2 Answers
Totally crazy how easy the answer is. One doesn't even need to use model builder to iterate through all possible routes. In my case, I have a feature class (points) that represents every doorway at the archaeological site (N=448 doorways). I simply pointed Network Analyst to that feature class for both Facilities and Incidents, while indicating in the Network Analyst Layer Properties (Analysis Settings tab) to find 448 facilities. That way, for each incident, it will find all 448 facilities. Thus, 448 x 448 = 200,704 routes. Done.
It looks like you should be using "Iterate Datasets" instead of "Iterate Files". I can't tell if "Iterate Datasets" requires GDB feature classes or if it will work on your current shapefiles.
From esri help: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00400000001n000000.htm
"Iterate Files" specifically skips datasets that are recognized in ArcCatalog (such as shapefiles). http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Iterate_Files/00400000000v000000/
A previous question found a similar solution: Iterating shapefiles using ModelBuilder or Python?