Skip To Content

Create a model for route analysis

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 at the same time reduce the probability of error. In a model, the output of one tool is used as an input to another tool.

In this tutorial, you will create a model for generating the fastest delivery route connecting 21 stores.

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 will use ArcGIS Online credits. If you're using your own data, no online credits are used, but you need to associate your network dataset with the project.

If you follow the specific instructions in this tutorial, you will not use any credits.

Get the data

The data for this tutorial is available for download on arcgis.com.

  1. Go to the item description web page of the Network Analyst tutorial data on arcgis.com.
  2. Click the Download button, and save the file locally.
  3. Unzip the downloaded file.

Create a map

  1. Open ArcGIS Pro.
  2. 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, add a network dataset to the map.

  1. In the Catalog pane, which is on the side of the application by default, right-click Folders and choose Add Folder Connection Add Folder Connection.

    The Add Folder Connection dialog box appears.

  2. Browse to the folder where you placed the tutorial data, double-click Network Analyst, and click Tutorial to select the folder.
  3. Click OK.

    A connection to the Tutorial folder is created.

  4. Next, add one of the network datasets contained within the folder to the map.

  5. In the Catalog pane, expand Folders > Tutorial > Paris.gdb > Transportation.
  6. Drag ParisMultimodal_ND, which has a network dataset icon Network Dataset, onto the map.

    The network dataset is added to the Contents pane as well as to the map.

  7. In the Catalog pane, expand Folders > Tutorial > Paris.gdb > Analysis.
  8. Drag the Stores feature class onto the map.

    The point feature class is added to the Contents pane as well as to the map.

Create and run a model

Follow the steps below in ModelBuilder to create a new model and run it.

  1. On the Analysis tab in the Geoprocessing group, click ModelBuilder button Model.

    A new model is opened for editing.

  2. On the Analysis tab in the Geoprocessing group, click Tools.

    The Geoprocessing pane opens.

  3. Click Toolboxes and expand the Network Analyst Tools toolbox.
  4. Click the Analysis toolset and drag the Make Route Analysis Layer tool into the new model window.
  5. The model should resemble the example below in the model builder window.
    Make Route Analysis Layer
  6. Double-click the Network Data Source in the model window.
  7. From the Network Data Source drop-down list, select ParisMultimodal_ND and click OK.
  8. Double-click the Make Route Analysis Layer tool in the model window.

    The Make Route Analysis Layer dialog box opens.

  9. From the Sequence drop-down menu, choose Preserve both first and last stop.
  10. Click OK.
  11. The model should resemble the example below:
    Make Route Analysis Layer tool in ModelBuilder
  12. From the Analysis toolset, drag the Add Locations tool into the model window.
  13. Select the Stores feature layer in the Contents pane and drag it onto the model to the left of Add Locations.
  14. Connect Stores to Add Locations and click Input locations on the context menu that appears.
  15. Connect Route to Add Locations and click Input Network Analysis Layer on the context menu that appears.
  16. Click the ModelBuilder tab on the ribbon.
  17. In the View group, click the Auto Layout button Auto Layout.

    The model is arranged in a logical order. The model should resemble the example below:

    Add Locations tool in ModelBuilder

  18. In the Geoprocessing pane, from the Analysis toolset, drag the Solve tool into the model window.
  19. 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.
  20. Click the Auto Layout button Auto Layout.

    The model should resemble the example below:

    Solve the Model

  21. Right-click the output layer of the Solve tool, Updated Input Network Analysis Layer (2), and click Add To Display.
  22. The model adds the final output to the map display when run from the model view.
  23. Click the Save button Save to save the model.
  24. Click the Validate button Validate to ensure that all the elements of the model are valid.
  25. Click the Run button Run.
  26. A status window appears while the route analysis is performed.
  27. When completed, close the status window and switch to the Map window so you can inspect the results.

    A new route layer is added to the Contents window.

    Route analysis result

Run the model as a geoprocessing tool

Like any other geoprocessing tool, 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.

  1. Switch to the model view and right-click Stores. Select Parameter from the context menu that appears.

    The variable is made into a parameter that is indicated by the letter P next to the variable in the model.

  2. Follow the above step with ParisMultimodel_ND and Updated Input Network Analysis Layer (2) variables in the model.

    The model should resemble the example below:

    Set variables as parameters

  3. Save and close the model.
  4. The model is saved as a geoprocessing tool in a toolbox.
    Model saved as geoprocessing tool in toolbox
  5. Browse to the location where the model is saved and double-click it, or right-click it and choose Open.

    The model opens in the Geoprocessing pane.

  6. If required, populate the parameters and click the Run button Run to the lower right.

    A new route layer is added to the Map view and the Contents window. This route layer overwrites the one that was created by running the model from model view in previous steps.

    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.
    Create and share layer package

    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.