PDA

View Full Version : Is Batch Process Route Calculations Possible?



Anonymous
09-19-2002, 05:58 AM
I am considering purchasing MP -- I would like to use it to batch calculate 2000+ routes for drive distance. Can I easily automate this in MP?

I only care about the drive distance; I don't want the map, I want a data file.

I can convert my input data into any form required.

Sorry if this is an obvious question.... I'm new at this...

John Meyer
09-19-2002, 07:30 AM
Yes, it is easy to do with Visual Basic and MapPoint.

Just in case you use VB here is a slightly modified sample from the help file. It will give you the drive distance in a message box for a route and of course you could write it to a file insted of sending it to a msgbox.

Private Sub Command1_Click()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objRoute As MapPoint.Route

'Set up the application
Set objMap = objApp.ActiveMap
Set objRoute = objMap.ActiveRoute
objApp.Visible = False
objApp.UserControl = True

'Add route stops and calculate the route
objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)
objRoute.Calculate

'Find the seventh direction item

n = objRoute.Directions.Count
MsgBox objRoute.Directions.Item(n).ElapsedDistance

End Sub