Available with Network Analyst license.
The closest facility solver finds one or more facilities that are closest to an incident based on travel time or travel distance and outputs the best routes as driving directions between the incidents and the chosen facilities. In this tutorial, you'll use this tool to find the closest hospital to an accident.
Note:Ensure you are signed in to your ArcGIS Online account. This tutorial can be completed using the network data source as either the designated tutorial network dataset, ArcGIS Online, or an ArcGIS Enterprise routing service published using a network dataset that covers the geography of the input data of the analysis. If you use ArcGIS Online, credits will be consumed.
Get the data
The data for this tutorial is available for download.
- Go to the data download page.
- Click the Download button, and save the file locally.
- Unzip the downloaded file.
Create a map
Complete the following steps to create a map:
- Start ArcGIS Pro.
- Create a new project by clicking the Map template. Optionally, change the name of your project and location.
A new project with a map appears.
Add the tutorial data to the project
A network dataset is an intelligent model of the road system. It contains not only the location and attributes of roads, but also information about how roads relate to one another, such as which roads are connected, which turns between connected roads are allowed or prohibited, and other information that affects what travel paths are possible and how long travel takes. The closest facility solver references the network dataset to determine nearby locations.
Note:If you perform an analysis using ArcGIS Online, the solver references a high-quality, worldwide network dataset stored in the ArcGIS Online cloud and uses ArcGIS Online credits. You can also use your own network dataset stored locally on your machine or use ArcGIS Enterprise to publish routing services using your own network dataset and configure the services with your enterprise portal to consume them from ArcGIS Pro.
In this set of steps, add a network dataset to the map.
- In the Catalog pane, which is on the right side of the application by default, right-click Folders and choose Add Folder Connection .
The Add Folder Connection dialog box appears.
- Browse to the folder where you placed the tutorial data, double-click Network Analyst, and click Tutorial to select the folder.
- Click OK.
A connection to the Tutorial folder is created.
- In the Catalog pane, expand Folders > Tutorial > SanFrancisco.gdb > Transportation.
- Drag Streets_ND, which has a network dataset icon , onto the map.
The network dataset is added to the Contents pane and to the map.
- If needed, right-click Streets_ND in the Contents pane and choose Zoom To Layer to view the San Francisco area.
By default, network datasets built with traffic data show traffic conditions for the current time when they are added to the map. This network dataset includes historical traffic, so you are seeing typical traffic conditions for the current time and day of the week. Not all roads in this network dataset include traffic, so only the ones that do are shown by default.
The area covered by the network dataset is where you can perform network analyses.
Viewing the network dataset isn't required to perform an analysis, so next, you will hide it.
- In the Contents pane, uncheck Streets_ND to display the basemap only.
- In the Catalog pane, browse to Tutorial > SanFrancisco.gdb > Analysis.
- Right-click the Hospitals layer and choose Add to Current Map.
The Hospitals layer is added to the Contents pane as well as to the map.
Next, add one of the network datasets contained in the folder to the map.
You do not need to add the network dataset to the map if you intend to use ArcGIS Online or an ArcGIS Enterprise routing service as the network data source.
You can also add a layer to the map by dragging it from the Catalog pane onto the map.
Create the closest facility layer
The closest facility analysis layer stores all the inputs, parameters, and results of a closest facility analysis.
- On the Analysis tab, in the Workflows group, click Network Analysis > Closest Facility .
The Closest Facility layer is added to the Contents pane. It includes sublayers that hold the inputs and outputs of the analysis.
The Closest Facility layer references the San Francisco network dataset because the network was in the Contents pane when the layer was created.
Note:To see or change the network data source that will be used to create the network analysis layer, on the Analysis tab, in the Workflows group, you can click the Network Analysis drop-down arrow and look under Network Data Source.
- In the Contents pane, click Closest Facility to select the group layer.
The Closest Facility Layer tab appears.
- Click Closest Facility Layer to see the settings located on the tab .
You'll use these settings to define the closest facility results you want to generate.
The Closest Facility Layer tab appears only when you select a closest facility layer in the Contents pane. Also, if you have multiple closest facility layers, you can change the settings of the layers individually or select the multiple layers to edit the settings for all the selected layers if they share the same network data source.
You'll use the Hospitals feature class to load the Facilities sublayer network analysis class.
- On the Closest Facility Layer tab, in the Input Data group,
click Import Facilities .
The Add Locations window appears.
- Make sure Input Network Analysis Layer is set to Closest Facility and Sub Layer is set to Facilities.
- Click the drop-down menu below Input Locations and choose Hospitals. This is the point feature class you previously added to the map.
- Leave the default settings for the rest of the parameters and click the OK button.
A total of 22 hospitals load as facilities.
Add an incident
Consider an accident site as an incident. The closest facility solver finds one or more hospitals that are closest to the accident location.
You could use a feature class of existing incidents for your analysis by clicking the Import Incidents button ; however, in this exercise, you'll add the incident by geocoding the address.
- On the Map tab, click the Locate button .
The Locate pane appears.
- In the Locate text box, type 2350 Pine St, San Francisco and press Enter.
- Right-click 2350 Pine St, San Francisco, California, 94115 under the ArcGIS World Geocoding Service and select Add To Feature Class from the context menu.
Using the ArcGIS World Geocoding Service as the locator uses credits.
- From the Add To Feature Class dialog box, expand Closest Facility : Incidents and select Incidents.
- Click OK.
The address is added to the Incidents sublayer of the Closest Facility analysis layer.
Set up properties for the closest facility analysis
The Closest Facility Layer ribbon includes a Travel Settings section, where you can specify properties for the analysis.
- On the Closest Facility Layer tab,
in the Travel Settings group, in the Facilities text box, increase the value to 3.
The closest facility solver will search for a maximum of three hospitals from the accident site.
- In the Cutoff text box, type 2.
The closest facility solver will look for hospitals that can be reached within 2 minutes from the incident site. Hospitals outside the cutoff time are ignored. Since the current impedance is TravelTime, the units are in minutes.
- From the Direction drop-down list, select Towards Facilities.
The Driving Time travel mode uses the TravelTime cost attribute, which has units of minutes. Consequently, the Cutoff value is interpreted in units of minutes.
Run the process to identify the closest facilities
- On the Closest Facility Layer tab, in the Directions group, check the Output on Solve check box.
Clicking this option will generate directions upon solve.
- Click Run .
When the solve process is complete, routes appear in the map display and in the Routes sublayer of the Closest Facility group layer.
- In the Directions group, click Show Directions .
The Directions pane appears with the driving directions from the accident site to three hospitals that the closest facility solver has determined to be the closest.