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(object sender, AxMapPoint._IMappointCtrlEvents_MouseMoveEvent e)
{
AxMapPoint.AxMappointControl mp = (AxMapPoint.AxMappointControl)sender;
Location Loc = mp.ActiveMap.XYToLocation(e.x, e.y);
if (Loc != null) {
double Lat;
double Lon;
pos.CalcPos(Loc, out Lat, out Lon);
statusStripLat.Text = Lat.ToString("F4"); // is 11 meter nauwkeurigheid
statusStripLon.Text = Lon.ToString("F4");
}
}

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