How To: Calculate the shortest network distance using the Origin-Destination (OD) cost matrix solver
Instructions provided describe how to calculate the shortest network distance using the Origin-Destination (OD) cost matrix solver.
The OD cost matrix finds and measures the least-cost paths along the network from multiple origins to multiple destinations.
Make a new OD cost matrix layer.
Open the attribute table for the Origins layer within the OD cost matrix layer and create a new long field called 'AddressID'. This field stores the unique ID for addresses when they are loaded as origins.
Open the attribute table for the Destination layer within the OD cost matrix layer and create a new long field named 'StopID'. This field stores the stop IDs when they are loaded as destinations.
Load the address as origins using the Add Locations tool.
Warning: For steps four and five, make sure to map the StopID property to the field from the feature class.
Load the mode of transportation (if any) as destination using the Add Locations tool.
Open the properties for the OD cost matrix layer and set the number of destinations, for example, 1, 2, and 3. Set other appropriate analysis settings.
On the Network Analyst toolbar, click Solve the OD cost matrix layer.
In ArcToolbox, open the Join Field tool from the Data Management Tools > Joins toolset.
Join Field tool
Input the following parameters in the indicated fields, and then run the tool:
• Input Table: OD Cost Matrix\Lines • Input Join Field: DestinationID • Join Table: Destinations • Output Join Field: Object ID • Join Fields: StopID (for join field parameter)
Note: This transfers the StopID field from destination to lines.
Run the Join Field tool again to transfer the StopID and the network distance field from line to the feature class containing the address ID.