So that formula you gave would convert it to Radians? On Mar 12, 8:47 am, Ralph B <[email protected]> wrote: > You need the formulas for converting from Cartesian to Spherical > coordinate systems. There is a good discussion of this at > athttp://en.wikipedia.org/wiki/Spherical_coordinates. > > In their notation: > r = radius of the earth > theta = latitude > phi = longitude > > Then > var r = Math.sqrt(x*x + y*y + z*z); // radius from center of the earth > to your point > var theta = Math.acos( z / r); // LAT in radians > var phi = Math.atan2(y, x); // LON in radians > > You will have to do the radians-to-degrees conversion, and also check > that the +/- sign conventions of your x/y/z match the +/- and E/W for > longitude and latitude. > > Good luck! > Ralph > > On Mar 12, 1:15 am, dyc <[email protected]> wrote: > > > Hey guys, > > > I am currently trying to go from an XYZ coordinate to a lon/lat > > coordinate. > > > The formula to go from lon/lat to XYZ is as follows: > > > LAT = latitude * pi/180 > > LON = longitude * pi/180 > > x = -R * cos(LAT) * cos(LON) > > y = R * sin(LAT) > > z = R * cos(LAT) * sin(LON) > > > Can anyone help me figure out how to reverse that formula so I can get > > lon/lat from xyz? > > > Thanks so much! > > > `Scott
To unsubscribe from this group, send email to away3d-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
