Find the shortest path and generate directions with Route

Available with Network Analyst license.

Routes represent the quickest or shortest path along roads to visit stops or point locations. They can be basic point-to-point routes visited in the order you specify or in the order that minimizes overall travel time or distance. A route is associated with a local network dataset or a network service hosted in ArcGIS Online or ArcGIS Enterprise. This tutorial first shows how to use a local network dataset and then shows how to use the online service.

Caution:
If you run the tutorial using ArcGIS Online, credits will be consumed.

Get the data

The data for this tutorial is available for download.

  1. Go to the data download page.
  2. Click the Download button, and save the file locally.
  3. Unzip the downloaded file.

Create a map

Complete the following steps to create a map:

  1. Start ArcGIS Pro.
  2. 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 route solver references the network dataset to determine the shortest path between stops.

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.

  1. In the Catalog pane, which is on the right 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 in the folder to the map.

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

    The network dataset is added to the Contents pane and to the map.

  7. If needed, right-click Streets_ND in the Contents pane and choose Zoom To Layer 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.

  8. In the Contents pane, uncheck Streets_ND to display the basemap only.

Create the route layer

A route layer provides the structure and properties needed to set up and solve route problems. It also contains the results after solving.

  1. On the Analysis tab, in the Workflows group, click Network Analysis > Route Route.

    The Route layer is added to the Contents pane. It includes several sublayers that hold the inputs and outputs of the analysis.

    The route is referencing the San Francisco network dataset because the network was in Contents when the route 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 menu and look under Network Data Source.
  2. In the Contents pane, click Route to select the group layer.

    The Route Layer tab appears.

  3. Click Route Layer to see the tab's controls.

    Route Layer tab

    You will use these controls to define the route you want to generate.

    Tip:

    The Route Layer tab appears only when you select a route layer in the Contents pane. Also, if you have multiple route 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.

Create stops

Think of a stop as a point you need to visit along a journey. The route solver finds the optimal path through the network, connecting the stops you designate.

You could use a feature class of existing stops for your analysis by clicking the Import Stops button Import Stops; however, in this exercise, you'll draw your stops directly on the map.

  1. In the Input Data section, click the Create Features Create Features button.

    The Create Features pane appears, showing a list of layers that can be edited.

  2. Under Route: Stops, click Stops.
  3. Use the Point tool Point to create a few stops on the map in the area covered by the network dataset.
  4. On the Edit tab, click Attributes Attributes.

    The Attributes pane appears.

  5. Optionally, select any of the stops you created using the Select tool and edit their attributes, such as Name. If you want to indicate that a stop can only be accessed from the right side of a vehicle, click the CurbApproach drop-down list and choose Right side of vehicle.

Run the analysis

  1. On the Route Layer tab, click Run Run.

    The results show the fastest path through the network, connecting all the stops you created. The stop symbol on the map will show the sequence number in the order the stops were entered and visited by the route solver.

  2. To create a route that finds the best way to visit all the stops (also known as the traveling salesperson problem), on the Route Layer tab, in the Travel Settings group, choose the Sequence drop-down menu and select the Find Best option.
  3. Click Run Run. The resulting route will now show the best sequence to visit all the stops.

Create a barrier

The route you created shows the fastest path through the network that obeys the constraints built into your network dataset. The network may, for instance, have information about speed limits, one-way streets, forbidden turns, and live or historical traffic data. You can modify the behavior of the network by editing your network dataset and also make temporary changes to your analysis using barriers. A barrier is useful for modeling temporary road closures. In this exercise, you'll draw a polygon barrier to simulate an area of road closures and observe how your route changes.

  1. In the Input Data section, click the Create Features Create Features button.

    The Create Features pane appears, showing a list of layers that can be edited.

  2. Under Route: Polygon Barriers, click Restrictions.
  3. Use the Polygon tool Polygon to draw a polygon on the map. Make sure the polygon covers at least one street used by the route you already solved.
  4. On the Route Layer tab, click Run Run.

    The map shows a different route that avoids the area covered by the barrier you created.

Generate directions

To generate turn-by-turn directions, ensure that the Output on Solve option is checked by default. The directions will not be generated on running analysis if the option is not checked.

  1. On the Route Layer tab, in the Directions group, click Show Directions Directions.

    Driving directions display in the Directions pane. Individual maneuvers are listed in the order performed, and the total time and distance of the route displays at the end of the list.

    Explore directions further by using a variety of actions in the Directions pane. These actions are described in the following table:

    ActionResult

    Click a route name

    The map zooms to the extent of the route.

    Point to a stop or maneuver

    The location of the stop or maneuver highlights on the map.

    Click a stop

    The map pans to the stop.

    Click a maneuver

    The map pans to the starting location of the maneuver.

    Double-click a stop

    The map zooms in toward the stop.

    Double-click a maneuver

    The map zooms to the extent of the maneuver.

Route using ArcGIS Online

Routes can be created without using a local network dataset. Follow the steps below to create a Route layer based on an online service. Routes created this way use credits to solve the route.

Note:

To use online services, you must be a member of an organization with privileges to perform network analysis.

  1. Use your ArcGIS Online or ArcGIS Enterprise organization credentials to sign in in ArcGIS Pro.
  2. Note:
    Make sure you've saved all edits made so far. To save your edits, click Save on the Edit tab.
  3. On the Analysis tab, in the Workflows group, click Network Analysis > Data Source.

    The Select Network Data source dialog box appears.

  4. Click https://www.arcgis.com/ and click OK.
  5. On the Analysis tab, in the Workflows group, click Network Analysis > Route Route.

    The Route layer is added to the Contents pane. It includes several sublayers that hold the inputs and outputs of the analysis.

    This second route layer is referencing the ArcGIS Online route service based on a network dataset hosted in the cloud.

  6. In the Contents pane, click Route2 to select the group layer.

    The Route Layer tab appears in the Network Analyst group at the top of ArcGIS Pro.

  7. Click Route Layer to see the tab's controls.
  8. Repeat the steps from the above sections to create stops, run the analysis, and generate directions.
    The Run button has a cloud icon indicating the service area will be solved using ArcGIS Online, not a local network dataset. You can estimate the number of credits that will be consumed by the analysis by clicking the Estimate Credits button Credit Tools. Learn more about credit consumption.