Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 2 of 2

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 Desktop 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 ...

  1. #1
    petemarkham is offline 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?

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59