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 4 of 4

Creating multiple point-to-point lines

This is a discussion on Creating multiple point-to-point lines within the Products: Pushpin Tool, Single State Mapper forums, part of the Map Forums category; Hi, I am a regular user of mappopint, but not a programmer. I am looking for a program or add-in ...

  1. #1
    TLog is offline Junior Member White Belt
    Join Date
    Jan 2010
    Posts
    1

    Creating multiple point-to-point lines

    Hi, I am a regular user of mappopint, but not a programmer. I am looking for a program or add-in that will allow me to create multiple lines originating from a single point to multiple destinations.

    For example, I have a single distribution centre, and want to send parcels to multiple customers, so the effect is many straight lines coming from the source, to the destinations - like a starburst.

    Any suggestions?

    Thanks.

  2. #2
    dgilchrist is offline Junior Member White Belt
    Join Date
    Jan 2010
    Posts
    3

    Re: Creating multiple point-to-point lines

    I'm a new user and do not know how to do this in MapPoint, but after to get your map into a jpeg file format, you could do it using MS Paint.

    I have not found an easy way to "save as" a jpeg to get my map into a power point presentation. Rigfht now I'm emailing as a picture, copying and pasting the .gif image into power point, than right clicking and "saving as" a jpeg in my pictures. What a pain. But once you have a jep of pdf you can add the lines.

    Drew

  3. #3
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,069
    Blog Entries
    4

    Re: Creating multiple point-to-point lines

    I just posted a little Excel tool which does this --

    Drawing Lines with MapPoint from Coordinates in Excel

    Screenshot attached. The zipped Excel file with the macro is in the MapForums Downloads section ($19.95) but as you can imagine the code is pretty simple:

    Code:
    Dim MPApp As MapPoint.Application
    Dim objMap As MapPoint.Map
     
    Public Sub DrawLines()
    
      Dim timeStart As Date
      timeStart = Now()
    
      Set MPApp = GetObject(, "MapPoint.Application")
      MPApp.Visible = False
      Set objMap = MPApp.ActiveMap
    
      Dim startingLat, startingLon As Double
      Dim endLat, endLon As Double
      Dim startLoc, endLoc As MapPoint.Location
      Dim objShape As MapPoint.Shape
    
      Dim row, locs As Integer
      row = 2
      
      Dim minlat, minlon, maxlat, maxlon As Double
      maxlat = Cells(2, 1)
      minlat = Cells(2, 1)
      maxlon = Cells(2, 2)
      minlon = Cells(2, 2)
      
      Do While Cells(row, 1) <> ""
        
        Set startLoc = objMap.GetLocation(Cells(row, 1), Cells(row, 2))
        Set endLoc = objMap.GetLocation(Cells(row, 3), Cells(row, 4))
        maxlat = Application.Max(maxlat, Cells(row, 1), Cells(row, 3))
        minlat = Application.Min(minlat, Cells(row, 1), Cells(row, 3))
        maxlon = Application.Max(maxlon, Cells(row, 2), Cells(row, 4))
        minlon = Application.Min(minlon, Cells(row, 2), Cells(row, 4))
        
        Set objShape = objMap.Shapes.AddLine(startLoc, endLoc)
        objShape.Line.ForeColor = Cells(row, 5)
        objShape.Line.Weight = Cells(row, 6)
        objShape.Line.EndArrowhead = Cells(row, 7)
      
        row = row + 1
        If row Mod 100 = 0 Then
          Debug.Print row
        End If
      Loop
      
      objMap.Union(Array(objMap.GetLocation(minlat, minlon), objMap.GetLocation(maxlat, maxlon))).Goto
      objMap.Altitude = objMap.Altitude * 1.2
      objMap.MapStyle = geoMapStyleData
    
      MPApp.Visible = True
      
      MsgBox ("Finished in " & Int((Now() - timeStart) * 24 * 60 * 60) & " seconds.")
      
    End Sub
    For the ZoomTo or Goto bit at the end, I had tried doing a union of all the location objects in an array, but gave up on it. :-/ I actually wrote VB6 code that does this last year, but didn't bother to hunt it down. Just keeping track with max/min variables ended up being less code anyway.

    The maxlat/maxlon, etc. part uses the MAX and MIN worksheets functions (they are not part of VBA) by referencing the Application object.

    Have fun! I'm sure some people could come up with some crazy looking maps using this tool !

    Eric
    Attached Images Attached Images
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  4. #4
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,069
    Blog Entries
    4

    Re: Creating multiple point-to-point lines

    I realize I'm probably the only person who thinks this is interesting, but here's another screenshot and ptm file created using this tool.

    You can download Excel macro and see the formulas used to generate the data in Excel here --

    Drawing Lines with MapPoint from Coordinates in Excel

    Eric
    Attached Images Attached Images
    Attached Files Attached Files
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Creating Shapes and finding point within
    By therbert in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-02-2008, 04:12 AM
  2. Get direction from point a to point b???
    By jonknapek in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 07-09-2005, 04:33 PM
  3. Route Planning (Multiple Point to Points)
    By robertuva in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-15-2004, 04:19 PM
  4. Creating an MST that does a Map Point 2002 Full Install?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-19-2003, 11:35 AM
  5. Does Map Point 2002 have multiple profiles for dif....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-15-2001, 04:50 AM

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