Theory of Converting GPS๏ผWGS84) to Cartesian Coordinates https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates
Below I use the following:
- GPS longitude (WGS84) and Cartesian coordinates are the same.
- The latitude should be converted according to the parameters of the ellipsoid WGS 84, the half-axis - 6378137 m, and
- Mutual alignment is 298.257223563.
I attached the VB code that I wrote:
Imports System.Math 'Input GPSLatitude is WGS84 Latitude,h is altitude above the WGS 84 ellipsoid Public Function GetSphericalLatitude(ByVal GPSLatitude As Double, ByVal h As Double) As Double Dim A As Double = 6378137 'semi-major axis Dim f As Double = 1 / 298.257223563 '1/f Reciprocal of flattening Dim e2 As Double = f * (2 - f) Dim Rc As Double = A / (Sqrt(1 - e2 * (Sin(GPSLatitude * PI / 180) ^ 2))) Dim p As Double = (Rc + h) * Cos(GPSLatitude * PI / 180) Dim z As Double = (Rc * (1 - e2) + h) * Sin(GPSLatitude * PI / 180) Dim r As Double = Sqrt(p ^ 2 + z ^ 2) Dim SphericalLatitude As Double = Asin(z / r) * 180 / PI Return SphericalLatitude End Function
Note that h is the height above WGS 84 ellipsoid .
Usually GPS will give us h above MSL height. The MSL height must be converted to a height h above the WGS 84 ellipsoid using the EGM96 geopotential model (Lemoine et al, 1998).
This is done by interpolating the grid of the geoid height file with a spatial resolution of 15 minutes of arc.
Or, if you have a GPS professional level, there is a height h (msl, altitude above average sea level) and UNDULATION , the relationship between the geoid and ellipsoid (m) selected source point, derived from the internal table. you can get h = H(msl) + undulation
To XYZ Cartesian coordinates:
x = R * cos(lat) * cos(lon) y = R * cos(lat) * sin(lon) z = R *sin(lat)
Howie Jul 17 '14 at 15:11 2014-07-17 15:11
source share