Matrix routing – Pitney Bowes MapXtreme User Manual

Page 366

Advertising
background image

Chapter 20: Routing

Calculating Routes

MapXtreme v7.1

373

Developer Guide

The following code sample shows how to create a WayPointList consisting of a startPoint, endPoint,
and ViaPoint:

Public Shared Sub New_WayPointList()
’ Create a 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(-73, 42)

Dim dpt3 As MapInfo.Geometry.DPoint = _

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

Dim startPoint As MapInfo.Geometry.Point = _

New MapInfo.Geometry.Point(coordSys, dpt1)

Dim endPoint As MapInfo.Geometry.Point = _

New MapInfo.Geometry.Point(coordSys, dpt2)

Dim intermediatePoint As MapInfo.Geometry.Point = _

New MapInfo.Geometry.Point(coordSys, dpt3)

’ Create the intermediate point object
Dim point As ViaPoint = New ViaPoint(intermediatePoint)
’ Create the collection
Dim pointList As ViaPointList = New ViaPointList
’ Append the object to the collection.
pointList.Append(point)
’ Create the WayPointList object
Dim list As WayPointList = _

New WayPointList(startPoint, endPoint, pointList)

End Sub

Matrix Routing

Matrix routing allows you to find the shortest or fastest paths between a number of start points and a
number of end points, and return the route costs. The costs are the total time and distance of the
individual routes. The matrix route feature is extremely useful for situations where you have 3 start
points and 50 destination points, where you want to find the shortest paths between all the start
points and all the destinations, and return the routes’ costs.

The order of the points and number of sequences in the response are determined by the number of
start and end points in the request. For example, if two start points and two end points are specified
in the request, the response will contain the following order of sequences (where S is start and E is
end): S1 to E1, S1 to E2, S2 to E1, S2 to E2.

Typically, this calculation can be used to determine service response time and coverages for specific
services such as a fire house or police station. You may require these calculations to ensure they
can provide adequate coverage for service level agreements such as having one or more people
who can respond to an incident within 20 minutes of first notification. At the simplest level of matrix

Advertising