Modeling New Closest Facility:

3683
4
05-26-2011 10:46 AM
MarkEnglish
New Contributor II
I am familiar with running a New Closest Facility Analysis using Network Analysis in ArcMap, but am looking ot streamline the process in model builder.  Basically, I have 120 x,y locations (facilities), and a single incident.  I simply want to map the 20 closest facilities to that incidence.  This is rather easy in Network Analyst.  In ArcMap, steps include setting up a 'New Closest Facility' in Network Analyst, Loading the facilities and incident to appropriate layers, and 'Solve'.

My problem is modeling this.  I found the make facility layer tool, but it doesn't contain parameters to load facilities and my incident.  Thanks in advance for any help you may have.
Best, Mark
Tags (2)
0 Kudos
4 Replies
RobertGarrity
Esri Contributor
Hi, Mark. After adding the Make CF tool to your model, you'll need to use the Add Locations tool to load facilities and then use Add Locations again to load incidents. After the inputs are loaded, you can link up the Solve tool.

Exercise 6 in the Network Analyst tutorial shows how Add Locations is used with the Make Route Layer tool, so you might want to reference that. Just keep in mind that the only real difference between the model in exercise 6 and a simple CF model is that routes only require stops as input so Add Locations is used once, while CF requires facilities and incidents as inputs so Add Locations is used twice.

One other note--if you need to load barriers for any analysis layer, use Add Locations for them as well.
0 Kudos
MarkEnglish
New Contributor II
Thanks...  Once the Add Locations are added twice for the incident and facilities, do I need two Solve tools?  I"m not sure how the resulting datasets from the two add locations come back together for the Solve.  Thanks again... 

Also, I would like to retain the fields from the input facilities.  I noticed it generates a unique identifier allowing me to join/combine, but is their a way to carry over all facility input fields to avoid the extra steps?  Thanks again!!!
0 Kudos
RobertGarrity
Esri Contributor
Thanks... Once the Add Locations are added twice for the incident and facilities, do I need two Solve tools?

No problem, Mark. You would just need one Solve tool for the analysis. To illustrate, here is what a basic CF model would look like this: Make Closest Facility Layer --> Add Locations --> Add Locations --> Solve.

All network analysis layers (e.g., a closest facility analysis layer) are made up of several sublayers, which in turn contain the input and output features for the overall network analysis layer. These sublayers are created automatically whenever you create a network analysis layer so that you don't have to do that work of creating all the input/output feature classes yourself. All you need to do is load data into the sublayers (using Add Locations) and possibly set their properties.

Closest facility requires the Facilities and Incidents sublayers to be populated with features before solving--they are required input data. If either of these two sublayers aren't populated, the closest facility solver won't have enough information to generate a solution. You use Add Locations once to add input data to Facilities and run it again to add input data into Incidents. You use the Solve tool once and only once to solve the entire closest facility analysis layer.

Also, I would like to retain the fields from the input facilities. I noticed it generates a unique identifier allowing me to join/combine, but is their a way to carry over all facility input fields to avoid the extra steps?

Check out the Add Field to Analysis Layer tool. This adds a field to one of the sublayers of an overall analysis layer. For example, use this tool immediately after Make Closest Facility Layer, specifying the sublayer you want to add the field to (for instance, Facilities). You can even chain a series of Add Field to Analysis Layer tools if you need to add several fields.
Once you've set up all the fields you want to add, link up your Add Locations tools. You can map fields using Add Locations so that the data from your original feature classes are carried over to your sublayers. (If you use the same field names and data types the fields you add are mapped automatically.)
0 Kudos
MarkEnglish
New Contributor II
I edited my reply, but I guess it didn't catch.  I was able to successfully run the model, based on adding the facilities, followed by incidents.  Thanks for your help!  I'll look in to your advice on the add fields to retrieve the desired results.  I'd like to kick out a database of the results, and am not as interested in the geographic display.  I'll attempt to add some type of report to the final result, but am not sure what is compatible with model builder?  Crystal reports?

I want the input for the incident to be an xy field, created from an existing template (filegdb table).  The user would basically need only add the xy coordinates to the template before running the model.  I ran across an issue with using Making xy, which generates an event layer.  Unfortunately, the model didn't recognize the coordinates of the event layer.  I completed my testing on a fabricated feature class.  I tried importing the export data tool in to model builder, but it wouldn't stick.  Any ideas on a user friendly input?  I may be creating multiple versions of the model, one with xy, one with a tangible GIS layer, maybe one that takes polygons, lines, etc. (if thats feasible).  Anyhow, thanks again for your input.
Regards,
Mark
0 Kudos