Community of VE/MapPoint Users and Developers
This is a discussion on Converting XY to Lat Long within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi All Can any body tell me that how can I convert XY in to Lat Long. I m using ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Converting XY to Lat Long 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"; } |
| |||
|
Hi, > dblI = objMap.Distance(objMap.GetLocation(dblLat, 0,0d), objLoc); > dblD = (dblLat / 180) * Math.PI; I _think_ this has to be: Code: dblD = objMap.Distance(objMap.GetLocation(dblLat, 0,0d), objLoc); dblI = (dblLat / 180) * Math.PI; http://www.mestdagh.biz |
![]() |
| Tags |
| converting, lat, long |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| converting lat lon to x y | Dazzer | MapPoint 2006/2009 Discussion | 6 | 08-14-2008 06:03 AM |
| Converting my Windows app. to ASP | BobFromBoston | MapPoint 2006/2009 Discussion | 7 | 10-17-2005 01:43 PM |
| Converting Lat/Long to x,y Pixels | Anonymous | MapPoint 2006/2009 Discussion | 2 | 09-08-2004 05:24 PM |
| Converting to PDF for large printing | jhnywall | MapPoint 2006/2009 Discussion | 3 | 11-10-2003 09:21 AM |
| Converting Zip Codes to Lat/Long | Anonymous | MapPoint 2006/2009 Discussion | 2 | 06-01-2003 01:27 PM |