Exercise 6: Creating a model for route analysis
In this exercise, you will create a model for finding the fastest delivery route connecting 21 stores in Paris.
Preparing your display
- If you have Exercise06.mxd open in ArcMap, skip to step 6.
- Start ArcMap by clicking Start > All Programs > ArcGIS > ArcMap 10.
- On the ArcMap - Getting Started dialog box, click Existing Maps > Browse for more.
-
Browse to C:\ArcGIS\ArcTutor\Network Analyst\Tutorial.
This is the default installation location for the tutorial data.
-
Double-click Exercise06.mxd.
The map document opens in ArcMap.
-
Enable the Network Analyst extension.
-
Click Customize > Extensions.
The Extensions dialog box opens.
- Check Network Analyst.
- Click Close.
-
Click Customize > Extensions.
-
Click Customize > Toolbars > Network Analyst.
The Network Analyst toolbar is added to ArcMap.
-
On the Network Analyst toolbar, click the Show/Hide Network Analyst Window button .
The dockable Network Analyst window opens.
If the Network Analyst toolbar is not displayed, you need to add it.
If the Network Analyst window is not displayed, you need to add it.
You can dock or undock the Network Analyst window. In this exercise, it is docked below the Table Of Contents window.
Creating the model
-
Click the Catalog window button on the Standard toolbar.
The dockable Catalog window opens.
- In the Catalog window, expand Toolboxes.
-
Right-click My Toolboxes and choose New > Toolbox.
- Type NetworkModel and press ENTER to name the newly added toolbox.
-
Right-click the NetworkModel toolbox and click New > Model.
A new model appears in the toolbox, and the Model dialog box opens.
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.
-
On the menu bar, click Geoprocessing > Search For Tools.
The dockable Search window opens with the Tools category selected.
-
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.
- Click Analysis in the Search window.
Only tools related to network analysis are displayed in the Search window.
-
Drag the Make Route Layer link onto the Model dialog box.
-
On the Model dialog box, double-click Make Route Layer.
The Make Route Layer dialog box opens so you can set its properties.
- Click the Input analysis network drop-down arrow and choose ParisMultimodal_ND.
- In the Impedance attribute drop-down list, click DriveTime.
- Check the Reorder stops to find optimal route check box.
- In the Preserve ordering of stops drop-down list, click PRESERVE_BOTH.
-
Click OK.
The input analysis layer is now added to the model. The Make Route Layer tool turns yellow, and the output turns green.
-
Click the Full View button .
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.
-
Drag the Add Locations tool from the Search window onto the Model dialog box.
-
Select the Stores feature layer in the Table Of Contents window and drag it onto the model to the left of Add Locations.
- On the Model dialog box, click the Connect tool .
-
Click Stores and click Add Locations to connect them. Click Input locations on the context menu that appears.
-
Using the Connect tool , connect Route to Add Locations. Click Input network analysis layer on the context menu that appears.
-
Click the Auto Layout button .
The model is arranged in a logical order.
-
Click the Full View button .
Adding the Solve tool
-
Drag the Solve tool from the Search window onto the Model dialog box.
-
Using the Connect tool , 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.
- Click the Auto Layout button .
-
Click the Full View button .
- Click the Select tool .
-
Right-click the output layer of the Solve tool, which is labeled Network Analyst Layer (2), and click Add To Display.
This tells the model to add the final output to the map display.
Running the model to find the best route
- Click the Save button to save the model.
-
Click the Run button .
A status window appears while ArcGIS performs the route analysis.
-
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.
- Click Yes.
Configuring the model to save the results to disk
- In the Catalog window, expand the NetworkModel toolbox, right-click Model, then choose Edit.
- Type Select Data in the Search window text box and press ENTER.
- Drag the Select Data tool from the search results and drop it in the Model window.
-
Using the Connect tool , connect the final output layer to Select Data. Click Input Data Element on the context menu that appears.
-
In the Model window, double-click Select Data.
The Select Data dialog box opens.
- Choose Routes from the Child Data Element drop-down list.
-
Click OK.
The dialog box closes.
- Type Copy Features in the Search window text box and press ENTER.
- Drag the Copy Features tool from the search results onto the Model dialog box.
-
Using the Connect tool , connect the final output layer to Copy Features. Click Input Features on the context menu that appears.
-
On the Model dialog box, double-click Copy Features.
The Copy Features dialog box opens.
-
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.
- Click OK.
Deleting the model
-
In the Catalog window, navigate to the NetworkModel toolbox, right-click Model, then choose Delete.
A message appears prompting you to confirm deletion.
- Click Yes.
- Exit ArcMap and do not save any changes to Exercise06.mxd.