GetTravelCostMatrix (Deprecated)
GetTravelCostMatrix calculates the travel time and distances between an array of start and end locations. You can use GetTravelCostMatrix to find the shortest or fastest paths between a number of start points and a number of end points, and determine the total time and distance of the individual routes (the route costs). For example if you input four start points (S1 through S4) and four end points (E1 through E4), a total of 16 routes will be returned as illustrated in the following diagram:
GetTravelCostMatrix is part of the Enterprise Routing Module.
Resource URL
http://server:port/soap/GetTravelCostMatrix
https://OnDemandServer/soap/GetTravelCostMatrix
For a list of Spectrum OnDemand servers, see ../../../OnDemand/source/GettingStarted/AccessingServices.dita#AccessingServices.
Example
The following shows a SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:get="http://<server>:<port>/spectrum/services/GetTravelCostMatrix"
xmlns:spec="http://spectrum.com/"
xmlns:get1="http://www.g1.com/services/GetTravelCostMatrix"
xmlns:typ="http://www.g1.com/services/erm/types
<soapenv:Header/>
<soapenv:Body>
<get:GetTravelCostMatrixRequest>
<get:input_port>
<get:RouteMatrixRequest>
<get:StartPoints>
<get:StartPoint>
<get:Latitude>33.751748</get:Latitude>
<get:Longitude>-84.364014</get:Longitude>
</get:StartPoint>
<get:StartPoint>
<get:Latitude>33.870416</get:Latitude>
<get:Longitude>-78.62915</get:Longitude>
</get:StartPoint>
<get:StartPoint>
<get:Latitude>35.025498</get:Latitude>
<get:Longitude>-80.864868</get:Longitude>
</get:StartPoint>
</get:StartPoints>
<get:EndPoints>
<get:EndPoint>
<get:Latitude>33.664925</get:Latitude>
<get:Longitude>-80.90332</get:Longitude>
</get:EndPoint>
<get:EndPoint>
<get:Latitude>34.40691</get:Latitude>
<get:Longitude>-80.062866</get:Longitude>
</get:EndPoint>
<get:EndPoint>
<get:Latitude>34.921971</get:Latitude>
<get:Longitude>-81.013184</get:Longitude>
</get:EndPoint>
</get:EndPoints>
</get:RouteMatrixRequest>
</get:input_port>
</get:GetTravelCostMatrixRequest>
</soapenv:Body>
</soapenv:Envelope>
This would be the response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns5:GetTravelCostMatrixResponse xmlns:ns2="http://spectrum.precisely.com/"
xmlns:ns3="http://www.g1.com/services/erm/types"
xmlns:ns4="http://www.g1.com/services/GetTravelCostMatrix"
xmlns:ns5="http://<server>:<port>/spectrum/services/GetTravelCostMatrix">
<ns5:output_port>
<ns5:RouteMatrixResponse>
<ns5:TimeUnits>Minutes</ns5:TimeUnits>
<ns5:DistanceUnits>Miles</ns5:DistanceUnits>
<ns5:RouteCosts>
<ns5:RouteCost>
<ns5:StartPointRef>1</ns5:StartPointRef>
<ns5:EndPointRef>1</ns5:EndPointRef>
<ns5:Time>215.82</ns5:Time>
<ns5:Distance>218.441</ns5:Distance>
</ns5:RouteCost>
<ns5:RouteCost>
<ns5:StartPointRef>2</ns5:StartPointRef>
<ns5:EndPointRef>2</ns5:EndPointRef>
<ns5:Time>124.82</ns5:Time>
<ns5:Distance>103.437</ns5:Distance>
</ns5:RouteCost>
<ns5:RouteCost>
<ns5:StartPointRef>3</ns5:StartPointRef>
<ns5:EndPointRef>3</ns5:EndPointRef>
<ns5:Time>22.53</ns5:Time>
<ns5:Distance>15.005</ns5:Distance>
</ns5:RouteCost>
</ns5:RouteCosts>
<ns5:user_fields/>
</ns5:RouteMatrixResponse>
</ns5:output_port>
</ns5:GetTravelCostMatrixResponse>
</soap:Body>
</soap:Envelope>