Pitney Bowes MapXtreme User Manual

Page 379

Advertising
background image

Chapter 20: Routing

Updating a Request Using Routing Data

MapXtreme v7.1

386

Developer Guide

PointRelativeSpeedUpdate - Updates the speed of the closest segment to the point with a
change in speed.

The following sample shows how to increase the speed by 5 miles per hour (Velocity(5,
VelocityUnit.Mph)) for the road closest to the defined point (pt):

Public Shared Sub New_PointRelativeSpeedUpdate()
’ Create a point
Dim coordSys As MapInfo.Geometry.CoordSys =
Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")
Dim dpt As MapInfo.Geometry.DPoint = New MapInfo.Geometry.DPoint(-74,
42)
Dim pt As MapInfo.Geometry.Point = New
MapInfo.Geometry.Point(coordSys, dpt)
’ Create the velocity object
Dim velocity As Velocity = New Velocity(5, VelocityUnit.Mph)
’ Increase the speed by 5 mph.
Dim update As PointRelativeSpeedUpdate = New
PointRelativeSpeedUpdate(pt, velocity)
End Sub

PointPersentageSpeedUpdate - Updates the speed of the closest point to the location by a
percentage of the default speed.

The following sample shows how to increase the speed for the road closest to the define point by 20
percent (pt, 20):

Public Shared Sub New_PointPercentageSpeedUpdate()
’ Create a point
Dim coordSys As MapInfo.Geometry.CoordSys =
Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")
Dim dpt As MapInfo.Geometry.DPoint = New MapInfo.Geometry.DPoint(-74,
42)
Dim pt As MapInfo.Geometry.Point = New
MapInfo.Geometry.Point(coordSys, dpt)
’ Increase the speed by 20 percent.
Dim update As PointPercentageSpeedUpdate = New
PointPercentageSpeedUpdate(pt, 20)
End Sub

Using Transient Update to Modify Road Type Speeds

Before determining a route, you may already know some travel information (for example.
construction, accident, or rush hour), and want to reduce or increase the speed of a particular road
type. For example, you can lower the speed for all highways. Taking into consideration holiday
weekend travel. You also have the option to lower the chance of a particular road type being used in
the route calculation. When determining the fastest route, you can decrease the travel speed for a

Advertising