Adding Transient Updates to GetRouteCostMatrix
What are Transient Updates?
These are changes you can make to the routing date for each request, that will not persist past that request. For instance, you can request that the server attempt to avoid all of the major road types, or change the speed of a particular point based on some criteria. Each request can contain one or more updates. For speed updates, positive speed value is a speed increase and negative speed value is a speed decrease. There are three main types of updates:
- Point (supports percentage, speed, speed adjustment, and exclude updates)
- Segment (supports percentage, speed, speed adjustment, exclude, and road type updates)
- Road Type (supports percentage, speed, and speed adjustment updates)
Point updates are changes applied to a corresponding point (Latitude, Longitude). For a particular point, you can: exclude the point, set the speed of the point or change (increase or decrease) the speed of the point by a value or percentage. Segment updates are changes applied to a corresponding segment ID. For a particular segment, you can: exclude the segment, set the speed of the segment, change (increase or decrease) the speed of the segment by a value or percentage, or change the road type of the segment. Road type updates are changes applied to a corresponding road type. For a particular road type, you can: set the speed of the roadtype, or change (increase or decrease) the speed of the road type by a value or percentage.
For more information on systax and options, see TransientUpdates in the routing schema.
The following are descriptions for the various types of updates:
Update Type |
Description |
---|---|
percentage |
This is a speed update where you define an increase in the speed by specifying a percentage to increase(positive value) or decrease(negative value) the speed. |
speed |
This is a speed update where you define the new speed by specifying the velocity unit and new velocity. For speed updates, the velocity unit can have one of the following values: kph (kilometers per hour), mph (miles per hour), mtps (meters per second), mtpm (meters per minute). |
speed adjustment |
This is a speed update where you define a change in the speed by specifying the change in velocity (unit and value). Speed values can be increased(positive value) or decreases(negative value). For speed updates, the velocity unit can have one of the following values: kph (kilometers per hour), mph (miles per hour), mtps (meters per second), mtpm (meters per minute). |
exclude |
This is a boolean value to exclude the specified part of the route from the calculation. |
road type |
This is a string value to change the value of the road type for the route calculation. |
Examples
A complete cost matrix request including a point update containing a speed adjustment of 45 kph.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/routing/service/v1" xmlns:v11="http://www.mapinfo.com/midev/service/geometries/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:RouteCostMatrixRequest id="?" locale="?">
<v1:StartPoints srsName="epsg:4326">
<v11:Point srsName="epsg:4326">
<v11:Pos>
<v11:X>-73.972033</v11:X>
<v11:Y>40.794928</v11:Y>
</v11:Pos>
</v11:Point>
</v1:StartPoints>
<v1:EndPoints srsName="epsg:4326">
<v11:Point srsName="">
<v11:Pos>
<v11:X> -73.985617</v11:X>
<v11:Y>40.747</v11:Y>
</v11:Pos>
</v11:Point>
</v1:EndPoints>
<v1:DistanceUnit>Meter</v1:DistanceUnit>
<v1:TimeUnit>Second</v1:TimeUnit>
<v1:ReturnOptimalRoutesOnly/>
<v1:TransientUpdates>
<v1:PointUpdateList>
<v1:Point srsName="epsg:4326">
<v11:Pos>
<v11:X>-73.985516</v11:X>
<v11:Y>40.747157</v11:Y>
</v11:Pos>
</v1:Point>
<v1:PointTypeUpdates>
<v1:SpeedUpdate>
<v1:SpeedAdjustment uom="KPH">45</v1:SpeedAdjustment>
</v1:SpeedUpdate>
</v1:PointTypeUpdates>
</v1:PointUpdateList>
</v1:TransientUpdates>
<v1:DatasetResourceName>US_NE</v1:DatasetResourceName>
</v1:RouteCostMatrixRequest>
</soapenv:Body>
</soapenv:Envelope>
Only the TransientUpdates section of a cost matrix request including a segment update containing a decrease speed percentage change of 50.
<v1:TransientUpdates>
<v1:SegmentUpdateList>
<v1:SegmentID>7e3396fc:1511c75</v1:SegmentID>
<v1:SegmentTypeUpdates>
<v1:SpeedUpdate>
<v1:Percentage>-50</v1:Percentage>
</v1:SpeedUpdate>
</v1:SegmentTypeUpdates>
</v1:SegmentUpdateList>
</v1:TransientUpdates>
Only the TransientUpdates section of a cost matrix request including a road type update containing an increase speed adjustment of 13 mps.
<v1:TransientUpdates>
<v1:RoadTypeUpdateList>
<v1:RoadType>normal road dense urban</v1:RoadType>
<v1:RoadTypeUpdates>
<v1:SpeedUpdate>
<v1:SpeedAdjustment uom="MPS">13</v1:SpeedAdjustment>
</v1:SpeedUpdate>
</v1:RoadTypeUpdates>
</v1:RoadTypeUpdateList>
</v1:TransientUpdates>