Available with Network Analyst license.
ArcGIS Pro provides geoprocessing functionality through the Network Analyst toolbox. These geoprocessing tools, when chained in a model, can help automate repetitive tasks and reduce the probability of error. In a model, the output of one tool is used as input to another tool.
In this tutorial, you will create a model for generating the fastest delivery route connecting 21 stores.
Note:
This tutorial can be completed using as the network data source 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. Learn more about network analysis with a service.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
To create a map, complete the following steps:
- Open ArcGIS Pro.
- Create a new project based on the Map.aptx template.
A new project with a map appears.
Add the tutorial data to the project
In this set of steps, you'll add a network dataset to the map.
- In the Catalog pane, which is on the 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 > Paris.gdb > Transportation.
- Drag ParisMultimodal_ND, which has a network dataset icon , onto the map.
The network dataset is added to the Contents pane and to the map.
- In the Catalog pane, expand Folders > Tutorial > Paris.gdb > Analysis.
- Drag the Stores feature class onto the map.
The point feature class is added to the Contents pane and to the map.
Next, add one of the network datasets contained within the folder to the map.
Note:
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.
Create and run a model
Follow the steps below in ModelBuilder to create a model and run it.
- On the Analysis tab in the Geoprocessing group, click the ModelBuilder button .
A new model is opened for editing.
- On the Analysis tab in the Geoprocessing group, click Tools.
The Geoprocessing pane appears.
- Click Toolboxes and expand the Network Analyst Tools toolbox.
- Click the Analysis toolset and drag the Make Route Analysis Layer tool into the new model window.
- Double-click Network Data Source in the model window.
- From the Network Data Source drop-down list, select ParisMultimodal_ND and click OK.
- Double-click the Make Route Analysis Layer tool in the model window.
The Make Route Analysis Layer dialog box appears.
- From the Sequence drop-down menu, choose Preserve both first and last stop.
- Click OK.
- In the Analysis toolset, drag the Add Locations tool into the model window.
- Select the Stores feature layer in the Contents pane and drag it into the model window to the left of Add Locations.
- Connect Stores to Add Locations and click Input locations on the context menu that appears.
- Connect Route to Add Locations and click Input Network Analysis Layer on the context menu that appears.
- Click the ModelBuilder tab on the ribbon.
- In the View group, click the Auto Layout button .
The model is arranged in a logical order and resembles the example below:
- In the Geoprocessing pane, in the Analysis toolset, drag the Solve tool into the model window.
- Connect the output from the Add Locations tool, Updated Input Network Analysis Layer, to Solve. Click Input Network Analysis Layer on the context menu that appears.
- On the ModelBuilder ribbon, from the Insert section, click the Utilities drop-down menu and choose the Select Data option.
- Connect Updated Input Network Analysis Layer(2) to Select Data. Click Input Network Analysis Layer on the context menu that appears.
- Open Select Data and from the Child Data Element drop-down menu, select the Routes sublayer.
- Click OK.
- Right-click the child data element Routes and select Add to Display to display the extracted sublayer after the solve.
- Click the Auto Layout button to arrange the model elements.
- Right-click the output layer of the Solve tool, Updated Input Network Analysis Layer (2), and click Add To Display.
- Click the Save button to save the model.
- Click the Validate button to ensure that all the elements of the model are valid.
- Click the Run button .
- When completed, close the status window and switch to the map view so you can inspect the results.
A new route layer is added to the Contents pane. Also, the sublayer Routes is extracted and added to the Contents pane.
Note:
If the Network Data Source input variable is not present, double-click the Make Route Analysis Layer tool and provide the network data source. Once the network data source is provided, the model resembles the image above.
Note:
You can also specify ArcGIS Online or ArcGIS Enterprise portal as the network data source.
Note:
You can also use a feature layer hosted in an ArcGIS Online or ArcGIS Enterprise portal to load your input features.
Run the model as a geoprocessing tool
As with other geoprocessing tools, you can open and run a model tool in the Geoprocessing pane. Variables that are set as model parameters show as tool parameters when the model is run as a geoprocessing tool, allowing you to specify different data or values for your model to process than what was specified when the model was created.
- Switch to the model view and right-click Stores. Select Parameter from the context menu that appears.
The variable is set as a parameter, which is indicated by the letter P next to the variable in the model.
- Repeat step 1 for the ParisMultimodel_ND and Updated Input Network Analysis Layer (2) variables in the model.
The model resembles the example below:
- Save and close the model.
The model is saved as a geoprocessing tool in a toolbox.
- Browse to the location where the model is saved and double-click it, or right-click it and choose Open.
The model appears in the Geoprocessing pane.
- Populate the parameters, if necessary, and click the Run button at the lower right.
A new route layer is added to the map view and the Contents pane.
Tip:
You can add the Package Layer and Share Package tools to the model to create a layer package of the final output and share the layer package using your ArcGIS Online account.You can also create a project package or project template to share the model, so it can be used by any user in your organization or through ArcGIS Online or ArcGIS Enterprise.