View Full Version : converting latitude/longitude to Cartesian coords?
kronchev
Apr21-04, 08:09 PM
Does anyone have a quick method to do this?
cookiemonster
Apr22-04, 12:22 AM
It's just a straight application of the spherical coordinate transformation.
x = \rho \sin{\theta} \cos{\phi}
y = \rho \sin{\theta} \sin{\phi}
z = \rho \cos{\theta}
Where \phi is the longitude, \theta is the latitude, and \rho is the radius of the Earth.
cookiemonster
deltabourne
Apr22-04, 02:53 PM
It's just a straight application of the spherical coordinate transformation.
x = \rho \sin{\theta} \cos{\phi}
y = \rho \sin{\theta} \sin{\phi}
z = \rho \cos{\theta}
Where \phi is the longitude, \theta is the latitude, and \rho is the radius of the Earth.
cookiemonster
I believe z = \rho \cos{\phi} and x = \rho \cos{\theta} \sin{\phi} :smile:
HallsofIvy
Apr23-04, 06:51 AM
Though I suspect that our original poster wanted 2 dimensional coordinates: like a flat map. Of course, you can't do that: no flat map of the world can be an isometric representation of the sphere. You would need to specify how that is to be handled.
I believe z = \rho \cos{\phi} and x = \rho \cos{\theta} \sin{\phi} :smile:
All you're doing there deltabourne is interchanging the values of theta and phi in cookiemonsters definition. Theta is normally used to denote the angle from the positve z axis and with that definition of theta cookiemonsters equations are correct.
HallsofIvy
Apr26-04, 06:26 AM
Maybe this is an "America against the rest of the world" thing but every text I've ever seen defines φ to be the angle the straight line from (0,0,0) to the point makes with the positive z axis while θ is the angle the projection of that line onto the xy-plane makes with the positive x-axis.
Maybe this is an "America against the rest of the world" thing but every text I've ever seen defines φ to be the angle the straight line from (0,0,0) to the point makes with the positive z axis while θ is the angle the projection of that line onto the xy-plane makes with the positive x-axis.
Yes it looks like both conventions are in common use unfortunately. Here is what Mathworld has to say about it.
A system of curvilinear coordinates which is natural for describing positions on a sphere or spheroid. Define \theta to be the azimuthal angle in the xy-plane from the x-axis and \phi to be the polar angle from the z-axis with ...
Unfortunately, the convention in which the symbols and are reversed is frequently used, especially in physics, leading to unnecessary confusion. The symbol \rho is sometimes also used in place of r. Arfken (1985) uses (r, \phi, \theta), whereas Beyer (1987) uses (\rho, \theta, \phi). Be very careful when consulting the literature.
HallsofIvy
Apr27-04, 06:44 AM
Aha! So instead of "America against the world", it is "Physicists against Mathematicians"!
Richardg
May13-04, 06:47 AM
Does anyone have a quick method to do this?
The 'quick and dirty' method (assuming the Earth is a perfect sphere):
x = longitude*60*1852*cos(latitude)
y = latitude*60*1852
Latitude and longitude must be in decimal degrees, x and y are in meters.
The origin of the xy-grid is the intersection of the 0-degree meridian and the equator, where x is positive East and y is positive North.
So, why the 1852? I'm using the (original) definition of a nautical mile here: 1 nautical mile = the length of one arcminute on the equator (hence the 60*1852; I'm converting the lat/lon degrees to lat/lon minutes).
palsy2001
Oct28-08, 12:38 AM
Does anyone have a quick method to do this?
X = (N+H) cos(phi) cos(lambda)
Y = (N+H) cos(phi) sin(lambda)
Z = [N(1-e^2)+H] sin(phi)
I have solved the inverse problem analytically as well as with other better methods.
This involves solving a complicated quartic eqation. See Vanicek & Krakiwsky, Geodesy.
There are other less efficient methods online. See Mathworks, e.g.
Ben Palmer
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.