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

Newbie needs help calculating distance

This is a discussion on Newbie needs help calculating distance within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello all. I stumbled across this forum while looking for MapPoint help on the web. I am trying to come ...

  1. #1
    Tom S. is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    1

    Newbie needs help calculating distance

    Hello all. I stumbled across this forum while looking for MapPoint help on the web. I am trying to come up with a way to access MapPoint (2001) via a function in an Excel module and calculate the distance between locations in two different cells. I can use the Distance method in conjunction with GetLocation method only if I start with lat,long,alt. Problem is, I want to use city,state,country and this seems to require the Find method. Is there a way to work around this? Thanks for any ideas that you can offer. Here is a general idea. strPoint1 and strPoint2 will eventually be Excel cell addresses. Thanks, Tom

    Function StraightLineDist(strPoint1, strPoint2)
    Dim objApp As New MapPoint.Application
    Dim objMap As MapPoint.Map
    Dim objLoc(1 To 4) As MapPoint.Location

    Dim dblDistance As Double

    Set objMap = objApp.NewMap

    'Get two known locations
    Set objLoc(3) = objMap.Find("Seattle, WA, United States") 'Seattle, WA
    Set objLoc(4) = objMap.Find("Redmond, WA, United States") 'Redmond, WA

    Set objLoc(1) = objMap.GetLocation(47.75399, -121.97436, 100) 'Seattle, WA
    Set objLoc(2) = objMap.GetLocation(47.6779, -122.11032, 100) 'Redmond, WA

    'Retrieve the distance
    StraightLineDist = objMap.Distance(objLoc(1), objLoc(2))

    End Function

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    This article http://www.mp2kmag.com/articles.asp?...xtract.lat.lon describes how to calculate coordinates from a location object. I think this is what you need.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calculating travel time between two locations
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 08-04-2003, 02:47 PM
  2. Calculating distances from a route
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-18-2003, 12:23 PM
  3. Calculating distance without direction-list
    By rbarthels in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-13-2003, 10:57 AM
  4. Calculating Distances For Dummies
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-20-2002, 06:26 PM
  5. Trouble calculating distances
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-03-2002, 12:15 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