How To: Apply custom field information to the Name field in the Lines class attributes for OD cost matrix analysis


The origin-destination (OD) cost matrix finds and measures the least-cost paths along a network from multiple origins to multiple destinations. The OD cost matrix analysis outputs a Lines network analysis class, which stores information about the resulting paths from the origins to the destinations. In some instances, the Name field in the Lines class attribute table displays the attributes as 'Location 1 - Location 2', 'Location 1 - Location 3', and this pattern continues depending on the total number of the origins and destinations.

The following figure shows the Lines class attribute table. The origins and destinations are named as 'Location #' consecutively in the Name field representing the resulting paths created by the OD cost matrix.

An image of the Name field of the Line attribute table.

From the attribute table, it is difficult to determine which exact origin or destination is associated with a particular 'Location #' especially when there are too many network analysis objects in the Origins and Destinations classes.

All Network Analyst analyses use a Name field to uniquely identify each network element in a sub-layer (such as Origins in an OD Cost Matrix). When loading network locations into any point network analysis sub-layer, if a Name field is not specified, the analysis assigns a default name to the point locations (Location 1, Location 2, Location 3, etc).

To make the locations more readable and understandable, unique identifiers (unique names) can be assigned from a custom field when loading the points into the sub-layer.


The instructions provided describe how to apply custom field information to the Name field in the Origins and Destinations sub-layers so that they pass to the Lines sub-layer when running an OD Cost Matrix analysis.

These steps are specifically for an OD Cost Matrix analysis, but all Network Analyst layers (ex. Service Area, Route, etc) have a Name field, which can be mapped to a custom field when loading the locations.
  1. In ArcMap, create an OD cost matrix. Refer to the following document for Creating an OD cost matrix in ArcMap.
  2. In Step 10 from the document provided above, add the origins to the analysis using the Load Locations option.
    1. Click the Network Analyst window button on the Network Analyst toolbar.
    2. In the Network Analyst window, right-click the Origins class > Load Locations.  

      An image of the Load Locations option.
    3. In the Load Locations dialog box, click the Load From drop-down arrow and select the origins feature class. If the feature class to be used is not in the Table Of Contents, click the browse button to search for the feature class.
    4. Under Location Analysis Properties, for the Name property, select the field containing the unique identifiers of the origin features (such as names of the origin features) from the Field drop-down list. The fields under Property are populated with values from the selected fields for each point from the input data.

      An image of the Load Locations dialog box.
    5. Click OK.
  3. Repeat Step 2 for the Destinations class, and select the destinations feature class in the Load From parameter.

    An image of the Load Locations dialog box.
  4. Proceed with the next steps in the document provided in Step 1 to create the OD cost matrix.

The following figure shows the attribute table of the Lines class after running the OD cost matrix analysis. The Name field applies the custom information from the origins and locations feature classes.

An image of the Name field of the Line layer attribute table.

Related Information