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 of 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 of 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 in different ways:

Learn more 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.

By choosing a traffic-enabled cost attribute and specifying a time of day and date (or day) under Use Start Time, the resulting cost matrix accounts for variable traffic speeds at that time and date.

Learn more about cost attributes

Restrictions

You can choose which restriction attributes should be respected while solving the analysis. In most cases, restrictions cause roads to be prohibited, but they can also cause them to be avoided or preferred. A restriction attribute, such as Oneway, should be used when finding solutions for vehicles that must obey one-way streets (for instance, nonemergency vehicles). Other common restriction attributes include height or weight limits that prohibit some vehicles from traversing certain roads or bridges; hazardous materials restrictions that hazmat drivers need to completely bypass or at least try to avoid; and designated truck routes that truck drivers should try to follow. You can choose which restriction attributes should be respected while solving the analysis. (You can further specify whether the elements that use the restriction should be prohibited, avoided, or preferred in the Attribute Parameters tab.)

Use Start Time

Use Start Time, in conjunction with the Time of Day and Day of Week or Specific Date properties, lets you specify what the start time from the origins is.

Note that specifying a start time doesn't require a traffic-enabled cost attribute; yet, if the network dataset includes traffic data, the solver creates a time-dependent OD cost matrix. This allows you to see how individual and overall travel times change for different starting times due to traffic.

Time of Day

The value you enter here represents the time that you want the analysis to start from its origins.

The time you specify in Time of Day must be associated with a date. You can choose between entering a floating day (Day of Week) or a calendar date (Specific Date).

Specific Date

For a calendar date, you provide the day, month, and year that the Time of Day value is associated with.

Day of Week

For a floating day, you can choose Today or any day of the week (Sunday through Saturday) relative to the current date. Floating days enable you to configure an analysis layer that can be reused, without having to remember to change the date.

You can solve up to six days ahead relative to the current date when choosing Day of Week.

Using a start time with traffic data and time zones

If you use a time-based impedance attribute or accumulate attribute, the start time and date refers to the time zone of the edge or junction that the origin is located on.

Note that all origins must be in the same time zone when solving an analysis across multiple time zones and using a time-based impedance attribute.

Default cutoff value

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

Individual origins can have their own cutoff values that override the default cutoff value. Entering a non-null value in the Cutoff_[Impedance] property of an origin overrides the default.

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 by entering a value for Destinations to find.

Individual origins can have their own values that override the Destinations to find property. Entering a non-null value in the TargetDestinationCount property of an origin overrides the default destinations to find.

U-turns at Junctions

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, which represent least-cost routes along the network. 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 lines that are output by the solver, where [Impedance] is replaced with the name of the accumulated cost attribute.

Assume you set the impedance attribute to Minutes because you want to base the analysis on routes that minimize travel time. Even though minimizing travel time is most important to you, you would also like to know the length of the quickest routes. Suppose you have another cost attribute, Miles, that you check on in the Accumulation tab. After solving, the output line features have properties named Total_Minutes and Total_Miles, which provide the time to travel along the quickest route and the distance of that route, respectively.

Conversely, you can base the analysis on shortest routes and accumulate travel time to determine how long it takes to complete each trip. If you have a traffic-enabled network dataset, you can even find this information for a specific time of day and account for variable traffic speeds. To do this, choose a distance-based cost attribute for the impedance of the analysis layer, use a start time, and accumulate time using a time-dependent cost attribute.

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

7/2/2014