PDA

View Full Version : How to get latitude and longitude

ma2005pp
09-26-2005, 10:49 AM
Hi,

(1) If I have a location, is there a way to get latitude and longitude?
(2) How to implement "Location Sensor" in MapPoint 2004, which shows Latitude/Longitude in a small box?

Thanks for help.

dsswanny
09-26-2005, 02:14 PM
I need to do the same thing.

calv1ns
09-27-2005, 11:22 PM
For estimation of Lat Long

Gilles Kohl's "CalcPos" routine is what you need. It can be found in the following article:

http://www.mp2kmag.com/a13--kohl.extract.lat.lon.mappoint.html

It uses the measure distance functionality and a bit of geometry to calculate a location's coordinates.

Richard
_________________
Winwaed Software Technology
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools

As for the show Location Sensor - if you mean the one built into MapPoint I dont think there currently is a method to ShowLocationSensor in the programming language.

Ciao,

Wilfried
09-28-2005, 01:57 AM
Hi,

For the location sensor here is a code snipped from MouseMove event:

private void MP_MouseMoveEvent&#40;object sender, AxMapPoint._IMappointCtrlEvents_MouseMoveEvent e&#41;
&#123;
AxMapPoint.AxMappointControl mp = &#40;AxMapPoint.AxMappointControl&#41;sender;
Location Loc = mp.ActiveMap.XYToLocation&#40;e.x, e.y&#41;;
if &#40;Loc != null&#41; &#123;
double Lat;
double Lon;
pos.CalcPos&#40;Loc, out Lat, out Lon&#41;;
statusStripLat.Text = Lat.ToString&#40;"F4"&#41;; // is 11 meter nauwkeurigheid
statusStripLon.Text = Lon.ToString&#40;"F4"&#41;;
&#125;
&#125;

The pos.CalcPos is same routine as Gilles Kohl's one.