 |
|
 |
 |
A More Compact Method for Obtaining Lat/Long
An alternate method for obtaining lat/lon was recently posted to the MapPoint newsgroup by Gilles Kohl that works with pushpins and also works in the European version.
In a previous article Chris Gebhardt provided a workaround allowing developers to determine the lat/long in MapPoint. The details are here. An alternate method for obtaining lat/lon was recently posted to the MapPoint newsgroup by Gilles Kohl that works with pushpins and also works in the European version.
The following code will return the lat/lon of a pushpin (actually, its location object) passed by reference. CalcPos is the actual working horse, Arccos is just a trigonometric helper function. Note that this approach does not require iterations nor does it require a specific units setting (miles vs. kilometers) on the users machine.
Usage: Paste the snippet below into your VB code, and call CalcPos with a Map object, your pushpin's location, and two doubles that will receive the lat and lon respectively.
The routine accepts a map object (MapPoint.Map) and a location (MapPoint.Location) as input parameters, and will return the corresponding lat/lon in two doubles passed by reference.
Here's how it works in principle:
Discuss this story in the forum.
Author: Gilles Kohl Email: gilles(AT)_deletethisincludingunderlines_compuserve.com URL: http://www.procad.de Gilles Kohl, a native of Luxembourg living in Germany, is a software development lead with PROCAD GmbH of Karlsruhe, Germany. Mapping and especially GPS-related topics are a hobby - Gilles enjoys developing solutions for Microsoft MapPoint and his favorite outdoor occupation is confluence hunting. As always, please direct questions to the newsgroup.
|
 |
 |
 |
Recent Discussion
|
 |
|
 |
 |
|
 |
Resources
|
 |
|
 |
|
 |