MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Converting XY to Lat Long

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-22-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Converting XY to Lat Long

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";



}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 11-22-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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;
rgds, Wilfried
http://www.mestdagh.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
converting, lat, long


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 07:22 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54