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

Import Data to be used to create Routes

This is a discussion on Import Data to be used to create Routes within the MapPoint Desktop Discussion forums, part of the Map Forums category; Is there the capibility to import data and then use it to create a route? Any help would be great. ...

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

    Import Data to be used to create Routes

    Is there the capibility to import data and then use it to create a route?

    Any help would be great.
    thanks
    Rick@ricklewis.com

  2. #2
    sthurlock is offline Junior Member Yellow Belt
    Join Date
    Dec 2003
    Posts
    12
    Here is one way to do it. I open a text file in excel, pull the fields into an array and then add each one as a way point. This way I have control over each address in case it is a bad address. My start & end are always the same, so that is set up in separate arrays.


    Code:
    ' note: arrays Route_Start, Route_End and AddrInfo are already populated
    
    AddWaypoint Route_Start(1), Route_Start(2), Route_Start(3), Route_Start(4), Route_Start(5)
      
      '''''''''''''''''''''''''''''''''''''''''''''''''''''''
      'need to skip first header column, start at 2
      For rowIndex = 2 To nrow
         AddWaypoint AddrInfo(rowIndex, 1), AddrInfo(rowIndex, 2), _
                     AddrInfo(rowIndex, 3), AddrInfo(rowIndex, 4), _
                     AddrInfo(rowIndex, 5)
         Label_total.Caption = rowIndex
        
      Next rowIndex
    
      AddWaypoint Route_End(1), Route_End(2), Route_End(3), Route_End(4), Route_End(5)
      
      Set objDataSet = MPApp.ActiveMap.DataSets("My Pushpins")
    
      'Retrieve all records
      Set objRecordset = objDataSet.QueryAllRecords
      objDataSet.ZoomTo
      ' optimize & get directions:
      MPMap.ActiveRoute.Waypoints.Optimize
      MPMap.ActiveRoute.Calculate
    Code:
    Private Sub AddWaypoint(Name As String, Street As String, _
          City As String, State As String, Zip As String)
    
    Dim l As Location
    Dim p As Pushpin
    Dim w As Waypoint
    Dim bad_address As Integer
    
    ' Find the address on the map.
    
    Set l = MPMap.FindAddress(Street, City, State, Zip)
    If l Is Nothing Then
       bad_address = 1
       'If Check_debug.Value = 1 Then
       MsgBox "BAD ADDRESS: " & Street & " " & City & " " & Zip
       'End If
       nBadAddr = nBadAddr + 1
       BadAddrInfo(nBadAddr, 1) = Name
       BadAddrInfo(nBadAddr, 2) = Street
       BadAddrInfo(nBadAddr, 3) = City
       BadAddrInfo(nBadAddr, 4) = State
       BadAddrInfo(nBadAddr, 5) = Zip
    End If
    
    If YaddPushpins = 1 And bad_address = 0 Then
       Set p = MPMap.AddPushpin(l, Name)
       MPMap.ActiveRoute.Waypoints.Add p, Name & " " & Street
    End If
    
    ' Destroy the objects before returning.
    
    Set l = Nothing
    Set p = Nothing
    Set w = Nothing
    
    End Sub
    Hope this is helpful.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Spatial Data Import
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-25-2006, 07:19 AM
  2. Data Import
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-04-2004, 06:34 PM
  3. Can you create multiple routes in MapPoint 2002? ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-17-2002, 04:15 PM
  4. I want to create a pushpin data map that displays ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-06-2001, 01:32 PM
  5. I appreciate your telling me I can create routes a....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-01-2001, 09:23 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96