Transient updates – Pitney Bowes MapXtreme User Manual

Page 377

Advertising
background image

Chapter 20: Routing

Updating a Request Using Routing Data

MapXtreme v7.1

384

Developer Guide

Transient Updates

In order to create more accurate and meaningful route calculations, you can make temporary
changes to the route data. The changes are submitted within each route request and are only valid
when the server or service is handling that particular request. You can use this feature to avoid a
particular highway during rush hour or lower the speed of the road segment in the request,
representing real life traffic patterns, producing more accurate time based routing. A transient
update can be included in any type of route request (point-to-point, multi-point, or matrix route). By
making these types of modifications, you have the ability to:

set the speed of a point, segment, or road type.

change (increase or decrease) the speed of a point, segment, or road type by some value.

change (increase or decrease) the speed of a point, segment, or road type by some percentage.

set the road type for a segment.

When defining speeds in transient updates, there are essentially three types, each speed value
defined differently:

Speed - specifies the new speed of the segment.

Relative - specifies an increase or decrease for the speed by a relative value. These values
represent a change in speed. For example a value of 10, will increase the default speed by 10,
while a value of -10 MPH will decrease the default speed by 10 MPH.

Percentage - specifies an increase or decrease for the speed by a percentage. Values are
between -100 and 100. For example a speed of 50 would increase the speed by 50 percent of
the default speed (a speed of 30 MPH would increase to 45 MPH), while a speed of -50 would
decrease the speed by 50 percent of the default speed (a speed of 30 MPH would decrease to
15 MPH).

Using Transient Update to Modify a Segment

After you get a route response, you may realize that the result contains a particular route segment or
group of segments (roads) where you know traffic is slower or faster, or you may want to update the
road type in a request. You can use a transient update to set the speed of the road segments or road
types, recalculating the route for more accurate results. Use the following classes to perform the
various segment transient updates:

SegmentRoadTypeUpdate - Updates the road type for the segment. The following code sample
shows how to specify a new road type for the defined segment ID “S1256”,
RoadType.MAJOR_ROAD_URBAN

SegmentSpeedUpdate - Updates the speed of the segment with a new speed.

The following sample shows how to define a new speed of 50 miles per hour (Velocity(50,
VelocityUnit.Mph)) for the specified route segment (S1256):

Public Shared Sub New_SegmentSpeedUpdate()
’ Create the velocity object
Dim velocity As Velocity = New Velocity(50, VelocityUnit.Mph)
’ Create the update object
Dim update As SegmentSpeedUpdate = New SegmentSpeedUpdate("S1256",
velocity)
End Sub

Advertising