Response

The output from GetTravelCostMatrix contains a number of route sequences, each containing the start and end points for the candidates used in the matrix route as well as the time and distance for each route that has been calculated. The output may contain all routes in the matrix, or only the optimal route between each start/end point, depending on how you configure the OptimizeBy option.

If GetTravelCostMatrix cannot find a route between a start and end point in the matrix, an error will be logged in the server log but the routes that could be determined will be returned. For example, if you have start point A and end points 1 and 2, and GetTravelCostMatrix can find a route from A to 1 but not from A to 2, GetTravelCostMatrix will return the route from A to 1 and log an error that the route from A to 2 could not be determined.

GetTravelCostMatrix output is either in list format or object format depending on how you configure the ReturnRouteCostMatrix option. You cannot interact directly with object output.

Table 1. Get Travel Cost Matrix Output

Response Element

Format

Description

Distance String

The distance from the start point to the end point. The value is in the units indicated in the DistanceUnits element.

DistanceUnits String

The unit of measurement used for distance. One of the following:

Feet
The distance is in feet.
Kilometers
The distance is in kilometers.
Meters
The distance is in meters.
Miles
The distance is in miles. Default.
Yards
The distance is in yards.
EndPointRef String

A reference ID that corresponds to the order in which the end points were specified in the input. The first end point specified has a reference ID of 1, the second has an ID of 2, and so on. You must develop your own process for associating the latitude/longitude coordinates in the input with the reference ID returned by Get Travel Cost Matrix.

EndPointID String

An identification you assigned to the corresponding end point in the ID field of the Input stage. For example, the first end point could have an EndPointID of N, the second end point could have an EndPointID of O, and so on.

Note: This field is active only when the Route Cost Matrix Format field is set to "Hierarchy."
StartPointRef String

A reference ID that corresponds to the order in which the start points were specified in the input. The first start point specified has a reference ID of 1, the second has an ID of 2, and so on. You must develop your own process for associating the latitude/longitude coordinates in the input with the reference ID returned by Get Travel Cost Matrix.

StartPointID String

An identification you assigned to the corresponding start point in the ID field of the Input stage. For example, the first start point could have a StartPointID of A, the second start point could have a StartPointID of B, and so on.

Note: This field is active only when the Route Cost Matrix Format field is set to "Hierarchy."
Time String

The total time from the start point to the end point. The value is in the units indicated in the TimeUnits element.

TimeUnits String

The unit of measurement used for time. One of the following:

Hours
The time is in hours.
Minutes
The time is in minutes. Default.
Seconds
The time is in seconds.
Milliseconds
The time is in milliseconds.

Status

String [1]

Reports the success or failure of the match.

null
Success
F
Failure

Status.Code

String [100]

Reason for failure, if there is one.

Status.Description

String

A description of failure indicated in Status.Code.