I have a file consist of some latitude/ longitudes and am looking forward to converting those geographical coordinates to cartesian coordinates. Has anyone any experience on this issue ?. There are plenty of scripts that convert the UTM format to cartesian coordinates, however, there are lack of scripts for converting latitude/longitude to cartesian coordinates...
To make it clear I want to know if you just want to convert a latitude(-90° to 90°) and a longitude(-180° to 180°) into coordinates in a 3D space where the origin is the center of the earth of radius r.
I this case this should work:
1 2 3
x = r * cos(latitude) * cos(longitude);
y = r * cos(latitude) * sin(longitude);
z = r * sin(latitude);
This is accepted with the approximation that the earth is really a sphere. Realistically, the earth is a ellipsoid, and r is different for each compnent; i.e.,
1 2 3
x = a * sin(theta) * cos(phi);
y = b * sin(theta) * sin(phi);
z = c * cos(theta);
Your conversion is simply from spherical coordinates to cartesian coordinates. Refer to wikipedia for more information. You have to be good in trigonometric identities to do the conversions for earth.