MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




How do you loop through the stops on a route?

This is a discussion on How do you loop through the stops on a route? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I need to associate the address to the stop number on the route so that I can then print a ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-02-2003
Junior Member
White Belt
 
Join Date: Dec 2002
Posts: 1
How do you loop through the stops on a route?

I need to associate the address to the stop number on the route so that I can then print a separate report, which would need to be in stop sequence order?

Is there a way to see what address has which stop number?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 11-11-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
You need to loop through the Waypoints collection of the Rou

If you're using the Mappoint Object model in your own APP:
Here's how I do it: (VB psuedocode)

'Declare and initialize a new Map
Dim MyMap As MapPoint.Map
Set MyMap = MPC.NewMap(geoMapNorthAmerica)

'Now Declare and initialize a Route on that map
Dim MyRoute As MapPoint.Route

'Tie the two things together. Now you've got a Route to work with
Set MyRoute = MyMap.ActiveRoute

'Now clear the Route
MyRoute.Clear

'You can now begin Adding WayPoints to your new clean Route
'A Waypoint consists of a Location and a Name
'I use a Ticket# - Description for the name of my waypoints

MyRoute.WayPoints.Add "Location Address...", "Ticket 12345 - Someplace"
'Keep adding waypoints till your done.

'Now your route is polulated with Waypoints, you can optimize and recalc

MyRoute.Waypoints.Optimize '...This could take a while...

MyRoute.Calculate 'This will create new driving directions


'Now your route contains a collection of waypoints in the optimized order.
'You can loop back through them.
'In this example, I have a table of Ticket #'s that I'm going to update with the optimized Order. Then I can just print the data from the table sorted in that order

'You need a counter. The waypoints are in ordinal position in an array

CountWaypoints = 1
Do While CountWaypoints < MyRoute.Waypoints.Count

'ThisTicket is a function that strips the Ticket# that's been embedded into the Name property for each waypoint.

StopTicket = ThisTicket(MyRoute.Waypoints.Item(CountWaypoints). Name)

'MarkRouteOrder is a subroutine that actually updates the Access table with the counter for the given Ticket#

MarkRouteOrder StopTicket, CountWaypoints


'Now move forward in the collection
CountWaypoints = CountWaypoints + 1

Loop


Done! You can now print your stuff from the table in the optimized order.

I would strongly suggest some sort of identifier on the items you want to sort (like I used Ticket #). Trying to update the table with some sort of matching on an address could be problematic.

As always, YMMV.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
loop, route, stops


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
retrieving directions in a route with stops couso MapPoint 2006/2009 Discussion 3 11-04-2006 04:19 PM
Route Optimizing with 2 identical stops cwrude MapPoint 2006/2009 Discussion 0 01-19-2005 02:28 PM
Connect Route Stops? swberman MapPoint 2006/2009 Discussion 1 01-11-2003 10:29 PM
I have been using MapPoint to sequence route stops.... Anonymous MapPoint 2006/2009 Discussion 1 02-04-2002 11:31 AM
We created a route of 700+ stops and optimized it..... Anonymous MapPoint 2006/2009 Discussion 1 09-07-2001 06:27 PM


All times are GMT -5. The time now is 04:02 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54