Skip To Content

Tutorial: Generate Origin Destination Cost Matrix

Available with Network Analyst license.

Complexity: BeginnerData Requirement: ArcGIS Tutorial Data for Desktop

The origin-destination (OD) cost matrix solver finds and measures the least-cost paths along the network from multiple origins to multiple destinations. The best path on the street network is discovered for each origin-destination pair, and the travel times and travel distances are stored as attributes of the output lines. In this tutorial, you'll use this tool to create an OD cost matrix for delivery of goods from the warehouses to all stores within a 10-minute drive time. Creating an OD cost matrix can be associated with a local network dataset or a network service hosted in ArcGIS Online or ArcGIS Enterprise.

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 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

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 OD cost matrix solver references the network dataset to determine nearby locations.

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.

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, browse to Tutorial > Paris.gdb > Analysis.
  8. Right-click the Warehouses layer and choose Add to Current MapAdd Data.

    The Warehouses layer is added to the Contents pane as well as to the map.

  9. Right-click the Stores layer and choose Add to Current MapAdd Data.

    The Stores layer is added to the Contents pane as well as to the map.

Create the OD Cost Matrix layer

The OD cost matrix analysis layer stores all the inputs, parameters, and results of an OD cost matrix analysis.

  1. On the Analysis tab, in the Tools group, click Network Analysis > Origin-Destination Cost Matrix OD Cost Matrix.

    The OD Cost Matrix layer is added to the Contents pane. It includes several sublayers that contain the inputs and outputs of the analysis.

    The OD Cost Matrix layer references the Paris network dataset because the network was in the Contents pane when the 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 Tools group, you can click the Network Analysis drop-down and look under Network Data Source.
  2. In the Contents pane, click OD Cost Matrix to select the group layer.

    The OD Cost Matrix tab appears in the Network Analyst group at the top of ArcGIS Pro.

  3. Click OD Cost Matrix to see the tab's controls.
    OD Cost Matrix tab

    You'll use these controls to define the OD cost matrix results you want to generate.

    Tip:

    The OD Cost Matrix tab appears only when you select the OD Cost Matrix layer in the Contents pane. Also, if you have multiple OD cost matrix layers present, they each have their own tab.

Add origins

You'll use the Warehouses feature class to load the Origins sublayer network analysis class.

  1. On the OD Cost Matrix tab, in the Input Data group, click Import Origins Import Origins.

    The Geoprocessing pane appears showing the Add Locations tool.

  2. Make sure Input Network Analysis Layer is set to OD Cost Matrix and Sub Layer is set to Origins.
  3. Click the drop-down menu below Input Locations and choose Warehouses.
  4. Leave the default settings for the rest of the tool parameters and click the Run button Run at the bottom of the Geoprocessing pane.

    Run button on Add Locations

    Six warehouses load as origins.

Add destinations

You'll use the Stores feature class to load the Destinations sublayer network analysis class.

  1. On the OD Cost Matrix tab, in the Input Data group, click Import Destinations Import Destinations.

    The Geoprocessing pane appears showing the Add Locations tool.

  2. Make sure Input Network Analysis Layer is set to OD Cost Matrix and Sub Layer is set to Destinations.
  3. Click the drop-down menu below Input Locations and choose Stores.
  4. From the Field Name drop-down list, select NOM.
  5. Leave the default settings for the rest of the tool parameters and click the Run button Run at the bottom of the Geoprocessing pane.

    Run button on Add Locations

    Twenty-one stores load as destinations.

Set parameters for OD cost matrix analysis

The OD Cost Matrix ribbon includes a Travel Settings section, where you can specify properties for the analysis.

  1. On the OD Cost Matrix tab, in the Travel Settings group, ensure that Driving Time is selected for Mode.
  2. In the Cutoff text box, type 10.
  3. Make sure in the Output Geometry section, output is set to Straight Lines.
  4. Open the layer properties dialog box by clicking the Launch Travel Mode Properties Launcher button located on the right corner of the Travel Settings section.

    Launch travel mode properties

    The Layer Properties: OD Cost Matrix dialog box appears.

  5. Expand the Restrictions section and ensure that the RestrictedTurns and Oneway options are checked.
  6. Expand the U-Turns section and from the drop-down list, select All, if not already selected.
  7. Click OK.

Run the analysis to create the OD cost matrix

  1. On the OD Cost Matrix tab, click Run Run.

    When the solve process is complete, origin-destination lines appear on the map.

  2. In the Contents pane, expand the OD Cost Matrix group layer if not already expanded.
  3. Right-click OD Cost Matrix:Lines sublayer and click Attribute Table.
  4. The attribute table represents the origin-destination cost matrix from each warehouse to the stores within a 10-minute drive time. Some stores are within a 10-minute accessibility zone of more than one warehouse and can be served by any one of them.