geodetic2enu#
- ahrs.common.frames.geodetic2enu(lat: float, lon: float, h: float, lat0: float, lon0: float, h0: float, a: float = 6378137.0, b: float = 6356752.3142) ndarray#
Transform geodetic coordinates to east-north-up (ENU) coordinates [NKG13].
Transform local geodetic coordinates \(\begin{pmatrix}\phi & \lambda & h\end{pmatrix}\) to local East-North-Up (ENU) coordinates \(\begin{pmatrix}x & y & z\end{pmatrix}\).
The origin of the local ENU frame has to be defined by the geodetic coordinates \(\begin{pmatrix}\phi_0 & \lambda_0 & h_0\end{pmatrix}\).
The transformation is performed in two steps:
Convert both geodetic coordinates to ECEF coordinates.
\[\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}\]\[\begin{split}\begin{array}{rcl} x_0 & = & (N_0 + h_0) \cos\phi_0 \cos\lambda_0 \\ y_0 & = & (N_0 + h_0) \cos\phi_0 \sin\lambda_0 \\ z_0 & = & \big(\left(1 - e^2\right)N_0 + h_0\big) \sin\phi_0 \end{array}\end{split}\]Convert the difference between the two ECEF coordinates to ENU.
where \(N_1\) and \(N_2\) are the radius of curvature in the prime vertical at the given latitude \(\phi_1\) and \(\phi_2\), respectively, and \(e^2\) is the square of the first eccentricity of the ellipsoid.
The ENU coordinates are computed as follows:
\[\begin{split}\begin{array}{rcl} x_{\mathrm{ENU}} & = & -\sin\lambda_0 \, (x_0 - x) + \cos\lambda_0 \, (y_0 - y) \\ y_{\mathrm{ENU}} & = & -\sin\phi_0 \, \cos\lambda_0 \, (x_0 - x) - \sin\phi_0 \, \sin\lambda_0 \, (y_0 - y) + \cos\phi_0 \, (z_0 - z) \\ z_{\mathrm{ENU}} & = & \cos\phi_0 \, \cos\lambda_0 \, (x_0 - x) + \cos\phi_0 \, \sin\lambda_0 \, (y_0 - y) + \sin\phi_0 \, (z_0 - z) \end{array}\end{split}\]- Parameters:
lat (float) – Latitude of local origin, in degrees.
lon (float) – Longitude of local origin, in degrees.
h (float) – Height above ellipsoidal surface of local origin, in meters.
lat0 (float) – Latitude of point of interesr, in degrees.
lon0 (float) – Longitude of point of interest, in degrees.
h0 (float) – Height above ellipsoidal surface of point of interest, 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:
enu (numpy.ndarray) – ENU cartesian coordinates [east, north, up].
The ENU coordinates are computed as follows