Available with Network Analyst license.
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.
Note:
This tutorial can be completed using as the network data source either the designated tutorial network dataset, ArcGIS Online, or an ArcGIS Enterprise routing service published using a network dataset that covers the geography of the input data of the analysis. If you use ArcGIS Online, credits will be consumed. Learn more about network analysis with a service.Get the data
The data for this tutorial is available for download.
- Go to the data download page.
- Click the Download button, and save the file locally.
- Unzip the downloaded file.
Create a map
- Open ArcGIS Pro.
- 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.
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.
- In the Catalog pane, which is on the side of the application by default, right-click Folders and choose Add Folder Connection .
The Add Folder Connection dialog box appears.
- Browse to the folder where you placed the tutorial data, double-click Network Analyst, and click Tutorial to select the folder.
- Click OK.
A connection to the Tutorial folder is created.
- In the Catalog pane, expand Folders > Tutorial > Paris.gdb > Transportation.
- Drag ParisMultimodal_ND, which has a network dataset icon , onto the map.
The network dataset is added to the Contents pane as well as to the map.
- In the Catalog pane, browse to Tutorial > Paris.gdb > Analysis.
- Right-click the Warehouses layer and choose Add to Current Map.
The Warehouses layer is added to the Contents pane as well as to the map.
- Right-click the Stores layer and choose Add to Current Map.
The Stores layer is added to the Contents pane as well as to the map.
Next, add one of the network datasets contained within the folder to the map.
Note:
You do not need to add the network dataset to the map if you intend to use ArcGIS Online or an ArcGIS Enterprise routing service as the network data source.
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.
- On the Analysis tab, in the Workflows group, click Network Analysis > Origin-Destination 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 Workflows group, you can click the Network Analysis drop-down arrow and look under Network Data Source. - In the Contents pane, click OD Cost Matrix to select the group layer.
The OD Cost Matrix Layer tab appears.
- Click the OD Cost Matrix Layer tab to see the tab's controls.
You'll use these controls to define the OD cost matrix results you want to generate.
Tip:
The OD Cost Matrix Layer tab appears only when you select the OD Cost Matrix layer in the Contents pane. Also, if you have multiple OD cost matrix 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.
Add origins
You'll use the Warehouses feature class to load the Origins sublayer network analysis class.
- On the OD Cost Matrix Layer tab, in the Input Data group,
click Import Origins .
The Add Locations window appears.
- Make sure Input Network Analysis Layer is set to OD Cost Matrix and Sub Layer is set to Origins.
- Click the drop-down menu below Input Locations and choose Warehouses.
- Leave the default settings for the rest of the parameters and click the OK button.
Six warehouses load as origins.
Add destinations
You'll use the Stores feature class to load the Destinations sublayer network analysis class.
- On the OD Cost Matrix Layer tab, in the Input Data group,
click Import Destinations .
The Add Locations window appears.
- Make sure Input Network Analysis Layer is set to OD Cost Matrix and Sub Layer is set to Destinations.
- Click the drop-down menu below Input Locations and choose Stores.
- From the Field Name drop-down list, select NOM.
- Leave the default settings for the rest of the parameters and click the OK button.
Twenty-one stores load as destinations.
Set parameters for OD cost matrix analysis
The OD Cost Matrix Layer ribbon includes a Travel Settings section, where you can specify properties for the analysis.
- On the OD Cost Matrix Layer tab, in the Travel Settings group, ensure that Driving Time is selected for Mode.
- In the Cutoff text box, type 10.
- Make sure in the Output Geometry section, output is set to Straight Lines.
- Open the layer properties dialog box by clicking the Launch Travel Mode Properties button on the right corner of the Travel Settings section.
The Layer Properties: OD Cost Matrix dialog box appears.
- Expand the Restrictions section and ensure that the DrivingAVehicle and Oneway options are checked.
- Expand the U-Turns section and from the drop-down list, select All, if not already selected.
- Click OK.
Run the analysis to create the OD cost matrix
- On the OD Cost Matrix Layer tab, click Run .
When the solve process is complete, origin-destination lines appear on the map.
- In the Contents pane, expand the OD Cost Matrix group layer if not already expanded.
- Right-click the OD Cost Matrix:Lines sublayer and click Attribute Table.