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

getting the coordinates of puspins within MapPoint

This is a discussion on getting the coordinates of puspins within MapPoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have a set of customer-defined pushpins and I want the coordinates of them. I have some code-snipplet (com-addin .dll ...

  1. #1
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39

    getting the coordinates of puspins within MapPoint

    I have a set of customer-defined pushpins and I want the coordinates of them. I have some code-snipplet (com-addin .dll with VB) for one pushpin. Everybody out there who did the stuff I explained before. Or has an idea where to start?

    Thanks a lot

    Peter

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    The simplest way would probably be to get the Pushpin Tool: http://www.mp2kmag.com/downloads/pushpin.tool/

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

  3. #3
    brianmcg is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Posts
    17
    How about if you want to get the Lat/Long of pushpins programatically?

    I have considered using the .LocationToX and .LocationToY methods and interpolating values by referencing a set of pushpins with known coordinates, but this would be approximate at best. MapPoint for .NET has API calls which allow access to the Lat/Long of a location.

    Any ideas? Please?

    Brian.

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

    Lon/Lat from Location

    Picked this up from the web somewhere:

    Option Explicit

    Const PI = 3.14159265358979
    Dim locNorthPole As MapPoint.Location
    Dim locSantaCruz As MapPoint.Location ' Center of western hemisphere
    Dim dblHalfEarth As Double ' Half circumference of the earth (as a sphere)
    Dim dblQuarterEarth As Double ' Quarter circumference of the earth (as a sphere)

    ' Compute latitude and longitude given a location object
    ' Author: Gilles Kohl
    ' (gilles@compuserve.com)
    '
    ' This code is copyrighted freeware - use freely, but please leave this
    ' header intact. Suggestions and comments welcome.

    Function Arccos(x As Double) As Double
    If x = 1 Then
    Arccos = 0
    Exit Function
    End If
    Arccos = Atn(-x / Sqr(-x * x + 1)) + 2 * Atn(1)

    End Function

    Function CalcPos(objMap As MapPoint.Map, locX As MapPoint.Location, dblLat As Double, dblLon As Double) As Boolean

    Dim l As Double
    Dim d As Double

    On Error GoTo CalcPosError

    ' Check if initialization already done
    If locNorthPole Is Nothing Then
    Set locNorthPole = objMap.GetLocation(90, 0)
    Set locSantaCruz = objMap.GetLocation(0, -90)

    ' Compute distance between north and south poles == half earth circumference
    dblHalfEarth = objMap.Distance(locNorthPole, objMap.GetLocation(-90, 0))

    ' Quarter of that is the max distance a point may be away from locSantaCruz and still be in western hemisphere
    dblQuarterEarth = dblHalfEarth / 2
    End If

    ' Compute latitude from distance to north pole
    dblLat = 90 - 180 * objMap.Distance(locNorthPole, locX) / dblHalfEarth

    ' Compute great circle distance to locX from point on Greenwich meridian and computed Latitude
    d = objMap.Distance(objMap.GetLocation(dblLat, 0), locX)

    ' convert latitude to radian
    l = (dblLat / 180) * PI

    ' Compute Longitude from great circle distance
    dblLon = 180 * Arccos((Cos((d * 2 * PI) / (2 * dblHalfEarth)) - Sin(l) * Sin(l)) / (Cos(l) * Cos(l))) / PI

    ' Correct longitude sign if located in western hemisphere
    If objMap.Distance(locSantaCruz, locX) < dblQuarterEarth Then dblLon = -dblLon

    CalcPos = True

    CalcPosExit:
    Exit Function

    CalcPosError:
    CalcPos = False
    MsgBox Err.Description, , "CalcPos"
    Resume CalcPosExit

    End Function

    Function InitialiseCalcPos() As Boolean
    '1.1
    On Error Resume Next

    Set locNorthPole = Nothing
    Set locSantaCruz = Nothing

    End Function

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

    Lat/long from location

    Just remembered where I found it. It was here!!! (http://www.mp2kmag.com/articles.asp?ArticleID=13)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Getting edge coordinates of zoomed in screen in Mappoint '04
    By jliao81 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-05-2010, 06:40 AM
  2. Getting a MapPoint.Location from a set of coordinates
    By BobFromBoston in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 07-20-2005, 03:19 PM
  3. Extracting GPS coordinates from MapPoint
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-28-2005, 12:44 AM
  4. newbie wants help in getting mappoint to return coordinates
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-02-2003, 02:36 PM
  5. Can I use MapPoint to generate map coordinates on a book map
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-23-2003, 06:33 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