Exercise 6: Creating a model for route analysis

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data Setup Data Path: C:\ArcGIS\ArcTutor\Network Analyst\Tutorial Goal: Create a geoprocessing model using ModelBuilder and ArcGIS Network Analyst tools.

In this exercise, you will create a model for finding the fastest delivery route connecting 21 stores in Paris.

Preparing your display

Steps:
  1. If you have Exercise06.mxd open in ArcMap, skip to step 6.
  2. Start ArcMap by clicking Start > All Programs > ArcGIS > ArcMap 10.
  3. On the ArcMap - Getting Started dialog box, click Existing Maps > Browse for more.
  4. Browse to C:\ArcGIS\ArcTutor\Network Analyst\Tutorial.

    This is the default installation location for the tutorial data.

  5. Double-click Exercise06.mxd.

    The map document opens in ArcMap.

  6. Enable the Network Analyst extension.
    1. Click Customize > Extensions.

      The Extensions dialog box opens.

    2. Check Network Analyst.
    3. Click Close.
  7. If the Network Analyst toolbar is not displayed, you need to add it.

  8. Click Customize > Toolbars > Network Analyst.

    The Network Analyst toolbar is added to ArcMap.

    The Network Analyst toolbar

  9. If the Network Analyst window is not displayed, you need to add it.

  10. On the Network Analyst toolbar, click the Show/Hide Network Analyst Window button Show/Hide Network Analyst Window.

    The dockable Network Analyst window opens.

    The Network Analyst window

  11. You can dock or undock the Network Analyst window. In this exercise, it is docked below the Table Of Contents window.

Creating the model

Steps:
  1. Click the Catalog window button Catalog Window on the Standard toolbar.

    The dockable Catalog window opens.

  2. In the Catalog window, expand Toolboxes.
  3. Right-click My Toolboxes and choose New > Toolbox.

    Creating a toolbox

  4. Type NetworkModel and press ENTER to name the newly added toolbox.
  5. Right-click the NetworkModel toolbox and click New > Model.

    Creating a model

    A new model appears in the toolbox, and the Model dialog box opens.

    The new model
    The Model dialog box

Creating a route layer in the model

Next, you will create the route layer within the model. The workflow for using Network Analyst in a model is the same as the workflow for using Network Analyst in ArcMap. First, you create a route layer and set properties. Next, you add the network locations (stops) to be used as inputs. Last, you solve and display the results.

Steps:
  1. On the menu bar, click Geoprocessing > Search For Tools.

    The dockable Search window opens with the Tools category selected.

    The Search window

  2. Click Network Analyst Tools in the list of toolboxes in the Search window.

    A list of toolsets and tools related to the ArcGIS Network Analyst extension are listed.

  3. Click Analysis in the Search window.

    Only tools related to network analysis are displayed in the Search window.

    The analysis tools

  4. Drag the Make Route Layer link onto the Model dialog box.

    Adding Make Route Layer to the model

  5. On the Model dialog box, double-click Make Route Layer.

    The Make Route Layer dialog box opens so you can set its properties.

  6. Click the Input analysis network drop-down arrow and choose ParisMultimodal_ND.
  7. In the Impedance attribute drop-down list, click DriveTime.
  8. Check the Reorder stops to find optimal route check box.
  9. In the Preserve ordering of stops drop-down list, click PRESERVE_BOTH.
  10. The tool dialog box should look like the one in the graphic below.
    Make Route Layer dialog box
  11. Click OK.

    The input analysis layer is now added to the model. The Make Route Layer tool turns yellow, and the output turns green.

  12. Click the Full View button Full View.

    The entire model is displayed.

Adding stops to the route layer

Next, you will add the stores as stops by using the Add Locations tool.

Steps:
  1. Drag the Add Locations tool from the Search window onto the Model dialog box.

    Dragging the Add Locations tool into the model

  2. Select the Stores feature layer in the Table Of Contents window and drag it onto the model to the left of Add Locations.

    Dragging the Stores feature layer into the model

  3. On the Model dialog box, click the Connect tool Add Connection.
  4. Click Stores and click Add Locations to connect them. Click Input locations on the context menu that appears.

    Connecting Stores to Add Locations

  5. Using the Connect tool Add Connection, connect Route to Add Locations. Click Input network analysis layer on the context menu that appears.

    Connecting Route to Add Locations

  6. Click the Auto Layout button Auto Layout.

    The model is arranged in a logical order.

  7. Click the Full View button Full View.

    Overview of the model

Adding the Solve tool

Steps:
  1. Drag the Solve tool from the Search window onto the Model dialog box.

    Adding the Solve tool to the model

  2. Using the Connect tool Add Connection, connect the output layer, Network Analyst Layer, to Solve. Click Input network analysis layer on the context menu that appears.

    The Solve tool turns yellow, the output layer turns green, and Solve succeeded turns cyan.

  3. Click the Auto Layout button Auto Layout.
  4. Click the Full View button Full View.

    Overview of the model

  5. Click the Select tool Select.
  6. Right-click the output layer of the Solve tool, which is labeled Network Analyst Layer (2), and click Add To Display.

    Choosing Add To Display

    This tells the model to add the final output to the map display.

Running the model to find the best route

Steps:
  1. Click the Save button Save to save the model.
  2. Click the Run button Run.

    A status window appears while ArcGIS performs the route analysis.

  3. When completed, close the status window and close the Model dialog box so you can inspect the results.

    A message appears prompting you to save the model.

  4. Click Yes.
  5. A new route layer is added to the Table Of Contents window. The Network Analyst window has all the stops and the resultant route. The map displays the stops that were loaded and the resultant route.
    Model Results

Configuring the model to save the results to disk

Steps:
  1. In the Catalog window, expand the NetworkModel toolbox, right-click Model, then choose Edit.
  2. To access the shortest path feature class for further analysis, you will need to copy features from memory onto disk.
  3. Type Select Data in the Search window text box and press ENTER.
  4. Drag the Select Data tool from the search results and drop it in the Model window.
  5. Using the Connect tool Add Connection, connect the final output layer to Select Data. Click Input Data Element on the context menu that appears.

    Connecting the output to Select Data

  6. In the Model window, double-click Select Data.

    The Select Data dialog box opens.

  7. Choose Routes from the Child Data Element drop-down list.
  8. Click OK.

    The dialog box closes.

  9. Type Copy Features in the Search window text box and press ENTER.
  10. Drag the Copy Features tool from the search results onto the Model dialog box.
  11. Using the Connect tool Add Connection, connect the final output layer to Copy Features. Click Input Features on the context menu that appears.

    Connecting the output layer to Copy Features

  12. On the Model dialog box, double-click Copy Features.

    The Copy Features dialog box opens.

  13. Enter an output location for saving the route as a feature class or shapefile.

    For example, you might type C:\arcgis\ArcTutor\Network Analyst\Tutorial\Paris.gdb\path.

  14. Click OK.
  15. Now running the model will solve the best route, select the route sublayer, and export it to a feature class. You can run the model by clicking the Run button Run.

Deleting the model

Steps:
  1. In the Catalog window, navigate to the NetworkModel toolbox, right-click Model, then choose Delete.

    Deleting the model

    A message appears prompting you to confirm deletion.

  2. If you ran the model, you may also want to navigate to the location that you specified for the output of the Copy Features tool and delete the feature class that was created.
  3. Click Yes.
  4. Exit ArcMap and do not save any changes to Exercise06.mxd.

2/2/2012