MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Import Data to be used to create Routes

This is a discussion on Import Data to be used to create Routes within the MapPoint 2006/2009 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. ...


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 12-14-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
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 12-15-2003
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.
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
create, data, import, routes


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
Spatial Data Import Dazzer MapPoint 2006/2009 Discussion 2 04-25-2006 07:19 AM
Data Import Anonymous MapPoint 2006/2009 Discussion 0 05-04-2004 06:34 PM
Can you create multiple routes in MapPoint 2002? .... Anonymous MapPoint 2006/2009 Discussion 1 06-17-2002 04:15 PM
I want to create a pushpin data map that displays .... Anonymous MapPoint 2006/2009 Discussion 1 09-06-2001 01:32 PM
I appreciate your telling me I can create routes a.... Anonymous MapPoint 2006/2009 Discussion 1 08-01-2001 09:23 PM


All times are GMT -5. The time now is 03:45 PM.


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