Community of VE/MapPoint Users and Developers
This is a discussion on getting the coordinates of puspins within MapPoint within the MapPoint 2006/2009 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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| getting the coordinates of puspins within MapPoint Thanks a lot Peter |
| ||||
|
The simplest way would probably be to get the Pushpin Tool: http://www.mp2kmag.com/downloads/pushpin.tool/ Eric
__________________ |
| |||
|
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. |
| |||
| 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 |
| |||
| Lat/long from location
Just remembered where I found it. It was here!!! (http://www.mp2kmag.com/articles.asp?ArticleID=13) |
![]() |
| Tags |
| coordinates, mappoint, puspins |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting a MapPoint.Location from a set of coordinates | BobFromBoston | MapPoint 2006/2009 Discussion | 2 | 07-20-2005 04:19 PM |
| Getting edge coordinates of zoomed in screen in Mappoint '04 | jliao81 | MapPoint 2006/2009 Discussion | 0 | 07-04-2005 11:17 AM |
| Extracting GPS coordinates from MapPoint | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-28-2005 01:44 AM |
| newbie wants help in getting mappoint to return coordinates | Anonymous | MapPoint 2006/2009 Discussion | 1 | 05-02-2003 03:36 PM |
| Can I use MapPoint to generate map coordinates on a book map | Anonymous | MapPoint 2006/2009 Discussion | 3 | 04-23-2003 07:33 PM |