I have some global data (seismic data from earthquakes) that was provided as geocentric (cartesian) coordinates. Basically, the coordinates range from +1 to -1 for x, y and z axes. The center of the earth is at coordinates 0, 0, 0. I need to convert these to latitude, longitude and elevation (altitude). . I believe I have been able to convert the coordinates to latitude and longitude using the equations provided in this link and applying them in Field Calculator.
Basically, the logic is as follows:
latitude(r, x, y, z) = arcsin(z/r)(180/π)
longitude(r, x, y, z) =
if (x > 0) {
arctan(y/x)(180/π)
} else if (y > 0) {
arctan(y/x)(180/π) + 180
} else {
arctan(y/x)(180/π) - 180
}
But I'm not sure how to calculate the elevation or depth. I tried using the equation below to calculate the depth (from the earth's surface in meters (using the radius of the earth = 6378km)
6378100 - ((sqrt(x^2 + y^2 + z^2)*6378100)
However, for the shallow points (with elevations near 0), the points cover the entire earth but for points at 2800km depth, the number of points are much less and do not cover the entire earth when mapped in a geographic or projected coordinate system. Therefore, I'm suspecting that my elevation (depth) calculations are not correct. Any advice would be greatly appreciated.
Solved! Go to Solution.
I haven't looked at your algorithm in depth. Are you multiplying XYZ by the radius before starting? That may help with the height calculation.
Hi Melita. Thanks for your reply. I did try multiplying the XYZ by the radius before starting and got the same result. However, on further inspection, I am now thinking that my equations for calculating the "latitude" are not correct. They only appear to be working for the near surface points but not the points at greater depths. What I've found is that, when I plot all the samples in 3D, as I look at the samples at greater depths, the extent of the points in the latitude direction decreases. Basically, as the depth increases, the extent of the points or latitudes are shrinking. For example, the points around 3578km depth that I expect to be near the north and south poles (latitudes +90 and -90) appear at +35 and -35 degrees. Could you suggest any equations for correctly calculating the latitudes from the geocentric Cartesian coordinates?
There are equations here: https://gssc.esa.int/navipedia/index.php/Ellipsoidal_and_Cartesian_Coordinates_Conversion
Thank you Melita. I'll try out these equations.
Hi Melita, Thanks again for providing the link to the equations. The equation for latitudes was different from what I had used before and it worked. I simply converted the equation to a python friendly format and converted it from radians to degrees.
(math.atan( (!Points_2!)/math.sqrt((!Points_0!)**2+ (!Points_1!)**2 ) ) ) *180/math.pi
Good morning everyone! I would like to ask if there is a way to define my coordinates, taking into account that I don't know their coordinates system. Is there a way to determine it? All I have is an xls file. Thank you very much for your collaboration!