Hi All
Can any body tell me that how can I convert XY in to Lat Long.
I m using the fallowing code butit gave me correct Lattitude and wrong Longitude.Please help me.
private void CalculateLatLong(MapPoint.Map objMap,MapPoint.Location objLoc)
{
MapPoint.Location locNorthPole=null,locSantaCruz=null ;
double dblHalfEarth=0,dblQuarterEarth=0,dblLat,dblLong,db lI,dblD;
if (locNorthPole == null)
{
locNorthPole = objMap.GetLocation(90,0,0d);
locSantaCruz = objMap.GetLocation(0,-90,0d);
dblHalfEarth = objMap.Distance(locNorthPole, objMap.GetLocation(-90, 0,0d));
dblQuarterEarth = dblHalfEarth / 2;
}
dblLat = 90 - 180 * objMap.Distance(locNorthPole, objLoc) / dblHalfEarth;
dblI = objMap.Distance(objMap.GetLocation(dblLat, 0,0d), objLoc);
dblD = (dblLat / 180) * Math.PI;
dblLong = 180 * Math.Acos((Math.Cos((dblD * 2 * Math.PI) / (2 * dblHalfEarth)) - Math.Sin(dblI) * Math.Sin(dblI)) / (Math.Cos(dblI) * Math.Cos(dblI))) / Math.PI;
if(objMap.Distance(locSantaCruz, objLoc) < dblQuarterEarth )
dblLong = -dblLong ;
lblLat.Text = dblLat.ToString()+ "LAT";
lblLong.Text = dblLong.ToString()+ "LONG";
}