# Thread: Converting Longitude/Latitude/Altitude to Cartesian Coords

1. ## Converting Longitude/Latitude/Altitude to Cartesian Coords

Hi,

I want to convert Longitude/Latitude/Altitude coordinates of a point to x,y,z coordinates. Can anybody point to some mathematical formulae to do the same?

Actually, I have some 3D models in Google Earth's .KMZ format; all vertices stored in GE format are in Longitude/Lat./Alt. coordinate system, and I want them in cartesian coordinates.

2. I would go to this site on wikipedia that is about the spherical coordinate system, the equations for converting both ways should be right there. Just remember that those equations use radians as opposed to degrees.

3. I think that you'd have to know a bit more about this particular type of format, as I don't know that just knowing the math for spherical coordinates would necessarily be enough (e.g. do they include the actual radius of the earth in the format? I doubt it) Understanding spherical coordinates is, however, the fundamental thing you'd need to know to solve this problem.

Let us know if you make any progress.

4. Originally Posted by BobMcGee123
I think that you'd have to know a bit more about this particular type of format, as I don't know that just knowing the math for spherical coordinates would necessarily be enough (e.g. do they include the actual radius of the earth in the format? I doubt it) Understanding spherical coordinates is, however, the fundamental thing you'd need to know to solve this problem.

Let us know if you make any progress.
Since he has the altitude, the longitude, the latitude and the radius, using the formulas on the site gives the following:

Code:
```x = (altitude+radius) * sin( longitude ) * cos( altitude )
y = (altitude+radius) * sin( longitude ) * sin( altitude )
z = (altitude+radius) * cos( longitude )```
So yeah, it does take the actual radius of the Earth into consideration... to some extend.

5. I'm sure longitude and lattitude must be in form 0 to PI and 0 to 2 * PI. That is the equation of a sphere.

x = sin(alpha) * cos(beta) * radius
y = sin(alpha) * sin(beta) * radius