OD cost matrix analysis

The OD cost matrix finds and measures the least-cost paths along the network from multiple origins to multiple destinations. When configuring an OD cost matrix analysis, you can specify the number of destinations to find and a maximum distance to search.

In the graphic below, the OD cost matrix found the least-cost paths from each origin to the four nearest destinations. The output shape type was set to produce straight lines.

OD cost matrix result that was set to find the four closest destinations

Even though the OD cost matrix solver doesn't output lines that follow the network, the values stored in the Lines attribute table reflect the network distance, not the straight-line distance.

The attribute table showing the least-cost paths

TipTip:

The closest facility and OD cost matrix solvers perform very similar analyses; the main difference, however, is in the output and the computation speed. OD cost matrix generates results more quickly but cannot return the true shapes of routes or their driving directions. It is designed to quickly solve large M x N problems and, as a result, does not internally contain the information required to generate route shapes and driving directions. Alternatively, the closest facility solver returns routes and directions but performs the analysis more slowly than the OD cost matrix solver. If you need driving directions or true shapes of routes, use the closest facility solver; otherwise, use the OD cost matrix solver to reduce the computation time.

NoteNote:

Consider using the Point Distance geoprocessing tool instead if finding the straight-line distances better fits your needs.

The results of OD cost matrix analyses often become input for other spatial analyses where the network cost is more appropriate than straight-line cost. For example, predicting the movement of people in a built environment is better modeled with network costs, since people tend to travel on roads and pedestrian paths.

Creating an OD cost matrix follows the same workflow as other network analyses.

Learn more about the network analysis workflow

OD cost matrix analysis layer

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

Creating an OD cost matrix analysis layer

You can create an OD cost matrix analysis layer from the Network Analyst toolbar by clicking Network Analyst > New OD Cost Matrix.

The Network Analyst toolbar

When you create an OD cost matrix analysis layer, it appears on the Network Analyst window along with its six network analysis classes: Origins, Destinations, Lines, Point Barriers, Line Barriers, and Polygon Barriers.

The Network Analyst window

The OD cost matrix analysis layer also appears in the Table Of Contents as a composite layer, which is named OD Cost Matrix or, if an OD cost matrix layer with the same name already exists in the map document, OD Cost Matrix 1 (subsequent layers would be OD Cost Matrix 2, and so on). There are six feature layers—Origins, Destinations, Lines, Point Barriers, Line Barriers, and Polygon Barriers. Each of the six feature layers has default symbology that can be modified on its Layer Properties dialog box.

The Table Of Contents

OD cost matrix analysis classes

The OD cost matrix analysis layer is composed of six network analysis classes.

Learn more about network analysis classes

An overview of each class and descriptions of their properties are provided in the following sections.

Origins class

This network analysis class stores the network locations that function as starting points in generating the paths to destinations.

When an OD cost matrix analysis layer is created, the Origins class is empty. It is populated only when network locations are added to it. A minimum of one origin and one destination is required to solve an analysis.

Origin properties

Input fields of Origins

Input field

Description

ObjectID

The system-managed ID field.

Shape

The geometry field indicating the geographic location of the network analysis object.

Name

The name of the network analysis object.

TargetDestinationCount

This property stores the number of destinations that must be found for the origin. If the value for this property is null, the analysis uses the number of destinations to find from the Analysis Settings tab on the analysis layer's Layer Properties dialog box.

Cutoff_[Impedance]

(for instance Cutoff_DriveTime, where DriveTime is the impedance for the network)

This property lets you limit how far out the OD cost matrix will search for destinations. Any destination beyond the cutoff value will not be considered.

If the Cutoff_[Impedance] is not set for an origin, the analysis will use the default cutoff value set in the Analysis Settings tab on the Layer Properties dialog box. If a default cutoff value is not set there either, then all destinations will be used for analysis.

Network location fields

  • SourceID
  • SourceOID
  • PosAlong
  • SideOfEdge

Together, these four properties describe the point on the network where the object is located.

Learn more about network location fields

CurbApproach

This property lets you specify which side of the vehicle you want the origin to be on when the vehicle departs. You can use the Right side of vehicle (1) or Left side of vehicle (2) values for any analysis that requires the vehicle to depart an origin from one side only. If departing is permitted from either side of the vehicle, use Either side of vehicle (0).

For OD cost matrix analyses, the No U-turn (3) value functions the same as Either side of vehicle.

Learn more about U-turn policies

Input/output fields for Origins

Input/Output field

Description

Status

This field is constrained by a domain of values, which are listed below (their coded values are shown in parentheses).

  • OK (0)—The network location is valid.
  • Not located (1)—The location on the network can't be determined.
  • Network element not located (2)—The network element that the network location is supposed to be on can't be found. This can occur when a network edge is deleted and the network location is not recalculated.

After a solve operation, the status can be modified using one of the following status values:

  • OK (0)—The network location was successfully evaluated.
  • Element not traversable (3)—The network element that the network location is on is not traversable. This can occur when the network element is restricted by a restriction attribute.
  • Invalid field values (4)—The field values of the network location fall outside the analysis layer's coded or range domains. For example, a negative number may exist where positive numbers are required.
  • Not reached (5)—The network location can't be arrived at by the solver.

Destinations class

This network analysis class stores the network locations that function as ending points in generating the paths from origins.

When a new OD cost matrix analysis layer is created, the Destinations class is empty. It is populated only when network locations are added to it. A minimum of one origin and one destination is necessary to solve an analysis.

Destination properties

Input fields of Destinations

Input field

Description

ObjectID

The system-managed ID field.

Shape

The geometry field indicating the geographic location of the network analysis object.

Name

The name of the network analysis object.

Network location fields

  • SourceID
  • SourceOID
  • PosAlong
  • SideOfEdge

Together, these four properties describe the point on the network where the object is located.

Learn more about network location fields

CurbApproach

This property lets you specify which side of the vehicle you want the destination to be on when the vehicle arrives. You can use the Right side of vehicle (1) or Left side of vehicle (2) values for any analysis that requires the vehicle to arrive at a destination from one side only. If the arrival is permitted from either side of a vehicle, use Either side of vehicle (0).

For OD cost matrix analyses, the No U-turn (3) value functions the same as Either side of vehicle.

Learn more about U-turn policies

Input/output fields for Destinations

Input/Output field

Description

Status

This field is constrained by a domain of values, which are listed below (their coded values are shown in parentheses).

  • OK (0)—The network location is valid.
  • Not located (1)—The location on the network can't be determined.
  • Network element not located (2)—The network element that the network location is supposed to be on can't be found. This can occur when a network edge is deleted and the network location is not recalculated.

After a solve operation, the status can be modified using one of the following status values:

  • OK (0)—The network location was successfully evaluated.
  • Element not traversable (3)—The network element that the network location is on is not traversable. This can occur when the network element is restricted by a restriction attribute.
  • Invalid field values (4)—The field values of the network location fall outside the analysis layer's coded or range domains. For example, a negative number may exist where positive numbers are required.
  • Not reached (5)—The network location can't be arrived at by the solver.

Lines class

The Lines network analysis class stores information about the resulting paths from the origins to the destinations. As with other feature layers, its symbology can be accessed and altered from its Layer Properties dialog box.

The Lines class is an output-only class; it is empty until the analysis is complete. Since OD cost matrix analyses tend to result in a multitude of lines, the line objects are not displayed in the Network Analyst window; rather, only a count of the lines is displayed there. You can inspect the individual lines in the attribute table of the Lines feature class.

When you choose to display lines in the OD cost matrix analysis layer, they appear as straight lines. They are generalized. However, their cost attributes always report the least-cost network path.

Line properties

Output fields of Lines

Output field

Description

ObjectID

The system-managed ID field.

Shape

The geometry field indicating the geographic location of the network analysis object.

Name

The name of the network analysis object.

OriginID

The unique ID of the line's associated origin.

DestinationID

The unique ID of the line's associated destination.

DestinationRank

The rank of the destination among all destinations found for the associated origin. The destination that is closest to the origin has a rank of 1.

Total_[Impedance]

(for instance, Total_Minutes, where Minutes is the impedance for the network)

The cumulative cost of traveling along the network between the associated origin and destination. This field is generated for the impedance attribute and any accumulation attributes.

Point, line, and polygon barriers

Barriers serve to temporarily restrict, add impedance to, and scale impedance on parts of the network. When a new network analysis layer is created, the barrier classes are empty. They are populated only when you add objects into them—but adding barriers is not required.

Barriers are available in all network analysis layers; therefore, they are described in a separate topic.

Learn more about barriers

OD cost matrix analysis parameters

Analysis parameters are set on the Layer Properties dialog box for the analysis layer. The dialog box can be accessed different ways:

Learn about opening the network analysis Layer Properties dialog box

The Analysis Settings tab

The Analysis Settings tab

The following subsections list parameters that you can set on the analysis layer. They are found on the Analysis Settings tab of the analysis layer's Layer Properties dialog box.

Impedance

Any cost attribute can be chosen as the impedance, which is minimized when determining the routes between origins and destinations. For instance, choosing the Minutes attribute results in the quickest route from origin to destination.

Learn more about cost attributes

Restrictions

You can choose which restriction attributes should be respected while solving the analysis. Restrictions, such as Oneway, should be used when finding solutions for vehicles that must obey one-way streets (for instance, nonemergency vehicles). If your network dataset contains additional restriction attributes, such as weight limit or height limit, those could be used as well.

Learn more about restrictions

Restriction attributes can also be used in conjunction with dynamic attributes. For example, an edge could be restricted if the vehicle is taller than the height of a tunnel.

Learn more about routing with parameterized attributes

Default cutoff value

While finding destinations, ArcGIS Network Analyst can use the default cutoff value of impedance. Any destination beyond the cutoff value will be ignored.

Destinations to find

You can choose to generate a cost matrix from each origin to all destinations. Alternatively, you can limit the number of destinations to find per origin.

U-turns at Junctions

ArcGIS Network Analyst can allow U-turns everywhere, nowhere, only at dead ends (or culs-de-sac), or only at intersections and dead ends. Allowing U-turns implies the vehicle can turn around at a junction and double back on the same street.

Learn more about U-turn policies

Output shape type

The resulting lines of an OD cost matrix can be represented with either straight-line geometry or no geometry at all. In both cases, the route is always computed along the network and returns the same total cost in the attribute table as a route analysis would.

  • Straight Line—Straight lines connect origins and destinations.
  • None—Line objects don't have a geometry. This is useful when you have a large number of origins and destinations and are interested only in the OD cost matrix table (and not the output line shapes).

Use Hierarchy

If the network dataset has a hierarchy attribute, you can use the hierarchy during the analysis. Using a hierarchy results in the solver preferring higher-order edges to lower-order edges. Hierarchical solves are faster, and they can be used to simulate the driver preference of traveling on freeways instead of local roads—even if that means a longer trip. Not using a hierarchy, however, yields an exact route for the network dataset.

Learn more about routing with hierarchy

Ignore Invalid Locations

This property allows you to ignore invalid network locations and solve the analysis layer from valid network locations only. If this option is not checked and you have unlocated network locations, the solve may fail. In either case, the invalid locations are ignored in the analysis.

The Accumulation tab

Under the Accumulation tab, you can choose cost attributes from the network dataset to be accumulated on the line objects. These accumulation attributes are purely for reference; the solver only uses the cost attribute specified by the analysis layer's Impedance parameter to calculate the OD cost matrix.

For each cost attribute that is accumulated, a Total_[Impedance] property is added to the routes that are output by the solver.

The Network Locations tab

The parameters on the Network Locations tab are used to find network locations and set values for their properties.

Learn more about network locations

Related Topics


2/2/2012