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

Does the distance function btw 2 locations get correct #

This is a discussion on Does the distance function btw 2 locations get correct # within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am using Mappoint 2004 control in VB. I have the following code but it appears that I am getting ...

  1. #1
    spideybud is offline Junior Member Yellow Belt
    Join Date
    Jul 2003
    Posts
    13

    Does the distance function btw 2 locations get correct #

    I am using Mappoint 2004 control in VB. I have the following code but it appears that I am getting what I believe to be an incorrect response. In this example I am displaying the distance from Charleston, SC to Columbia, SC as the crow flys.


    Dim TestLocation As Location
    Dim TestLocation2 As Location
    Dim objMap As MapPointCtl.Map


    Set TestLocation = objMap.GetLocation(-80.03, 32.9)
    Set TestLocation2 = objMap.GetLocation(-81.12, 33.95)
    MsgBox "Distance between Charleston and Columbia is " & objMap.Distance(TestLocation2, TestLocation)



    This returns approx 76.32488.......But the distance from Charleston, SC to Columbia, SC is nearer to 100 Miles.

    Is there something I am missing here? Any help will be greatly appreciated.

  2. #2
    tanguy_laverdure is offline Junior Member Yellow Belt
    Join Date
    Dec 2003
    Posts
    17

    Distance function

    Hi,
    using the part of the following code, I also find there is a bug wit hthis distance function. The returned value seems to be less than it should be. I tought it was from the unit (beetween kilometers and miles) but nothing better. If you find a turn arround, i'll be interresting

    'Get a location on the map
    Dim objLoc1 As MapPoint.Location
    Set objLoc1 = oMap.FindResults("MAIRIE d'ENNEZAT, AUVERGNE")(1)

    'Get a location on the map
    Dim objLoc2 As MapPoint.Location
    Set objLoc2 = oMap.FindResults("MAIRIE de GERZAT, AUVERGNE")(1)

    'Find the distance to objLoc2 from that objLoc1
    MsgBox "Distance from location to 0,0: " + CStr(objLoc1.DistanceTo(objLoc2))

  3. #3
    Martel is offline Junior Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    28
    Try looking at the values you are passing to the GetLocation method. The order is latitude then longitude. If you reverse your parameters, you get the same distance as when you calculate the distance using FindResults("Columbia, South Carolina, United States") and FindResults("Charelston, South Carolina, United States").

    If you plot a pushping using the coordinates in your example, you will find it gets placed somewhere in Antarctica.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Utility to move pushpins to correct side of street
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 07-07-2008, 08:59 AM
  2. PushPin not set on correct location but shown with line
    By Anonymous in forum Bing Maps and MapPoint Web Service
    Replies: 1
    Last Post: 03-29-2005, 09:13 AM
  3. pushpin sets pick random spot NOT correct address?????
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-15-2004, 01:53 AM
  4. Someone other then MS working to correct roads on maps?
    By Apollyon in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-22-2004, 08:48 PM
  5. AGPS in MP2k2 shows wrong long/lat but yet plots correct pos
    By Jamez_Warner in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-17-2003, 10:18 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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96