MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth 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

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



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/converting-xy-lat-long-3496.html

Posted By For Type Date
lat lon xy - Zuula Search This thread Refback 12-24-2008 02:57 PM

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 7 02-10-2009 10:12 PM
Converting my Windows app. to ASP BobFromBoston MapPoint 2006/2009 Discussion 7 10-17-2005 12:43 PM
Converting Lat/Long to x,y Pixels Anonymous MapPoint 2006/2009 Discussion 2 09-08-2004 04:24 PM
Converting to PDF for large printing jhnywall MapPoint 2006/2009 Discussion 3 11-10-2003 08:21 AM
Converting Zip Codes to Lat/Long Anonymous MapPoint 2006/2009 Discussion 2 06-01-2003 12:27 PM


All times are GMT -5. The time now is 11:42 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Taba Heights Holiday
Visit Egypt with your Taba Heights holiday. Book through UlookUbook and save!



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 55 56 57 58 59