beautypg.com

Multi-point routing – Pitney Bowes MapXtreme User Manual

Page 365

background image

Chapter 20: Routing

Calculating Routes

MapXtreme v7.1

372

Developer Guide

Updating a Request using Routing Data

A point-to-point route is created using the RouteRequest class. Refer to the Developer Reference
for API-level syntax and descriptions.

The following code sample is an example of a simple point-to-point route:

Public Shared Sub New_RouteRequest()
’ Create the start point and end point
Dim coordSys As MapInfo.Geometry.CoordSys = _

Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")

Dim dpt1 As MapInfo.Geometry.DPoint = _

New MapInfo.Geometry.DPoint(-74, 42)

Dim dpt2 As MapInfo.Geometry.DPoint = _

New MapInfo.Geometry.DPoint(-74, 41)

Dim startPoint As MapInfo.Geometry.Point = _

New MapInfo.Geometry.Point(coordSys, dpt1)

Dim endPoint As MapInfo.Geometry.Point = _

New MapInfo.Geometry.Point(coordSys, dpt2)

’ Create the point list
Dim pointList As WayPointList = _

New WayPointList(startPoint, endPoint)

’ Create the route plan object
Dim plan As RoutePlan = _

New RoutePlan(pointList)

’ Create the request object
Dim request As RouteRequest = _

New RouteRequest(plan, DistanceUnit.Mile)

End Sub

Multi-Point Routing

Multi-point routing is the ability to route via points. The routing server will find the shortest time or
distance through all the points. This can be used for complex directions. These directions are a
requirement for customers who wish to plan daily drop-offs, or customer visits such as distribution
and repair companies, or general field sales. Typically, a start and end point are defined plus a series
of stops are added into the calculation. There is no difference between multi-point route and point-to-
point route except for the via points between the start and end locations.

Similar to point-to-point routes, there are numerous additions you can make to a multi-point route
request to return additional information in the response. These additions are:

Routing Preferences

Driving Directions

Route Geometry

Avoiding Points, Features, and Segments

Time-Based Routing

A multi-point route is created using the RouteRequest class. To add intermediate points to a route,
WayPointList must consist of at least one ViaPoint. Refer to the Developer Reference for API-level
syntax and descriptions.