geodetic2ecef#
- ahrs.common.frames.geodetic2ecef(lat: float, lon: float, h: float, a: float = 6378137.0, b: float = 6356752.3142) ndarray#
Transform geodetic coordinates to Rectangular (Cartesian) Coordinates in the Earth-Centered Earth-Fixed frame.
The cartesian coordinates of a point \(\begin{pmatrix}x & y & z\end{pmatrix}\) can be calculated from the geodetic coordinates \(\begin{pmatrix}\phi & \lambda & h\end{pmatrix}\) using the following equations [Wik15] [ZHP11] [NKG13]:
\[\begin{split}\begin{array}{rcl} x & = & (N + h) \cos\phi \cos\lambda \\ y & = & (N + h) \cos\phi \sin\lambda \\ z & = & \big(\left(1 - e^2\right)N + h\big) \sin\phi \end{array}\end{split}\]where \(\phi\) is the latitude, \(\lambda\) is the longitude, \(h\) is the height, and \(N\) is the radius of curvature in the prime vertical at the given latitude \(\phi\):
\[r = \frac{a}{\sqrt{1 - e^2 \sin^2\phi}}\]The first eccentricity of the ellipsoid squared, \(e^2\), is defined using the equatorial radius of the ellipsoid \(a\), and the polar radius of the ellipsoid \(b\):
\[e^2 = \frac{a^2-b^2}{a^2}\]These values default to Earth’s ellipsoid.
- Parameters:
lat (float) – Latitude, in degrees.
lon (float) – Longitude, in degrees.
h (float) – Height above ellipsoidal surface, in meters.
a (float, default: 6378137.0) – Ellipsoid’s equatorial radius (semi-major axis), in meters. Defaults to Earth’s.
ecc (float, default: 8.1819190842622e-2) – Ellipsoid’s first eccentricity. Defaults to Earth’s.
- Returns:
X – ECEF cartesian coordinates.
- Return type:
numpy.ndarray