gnssvod.geodesy

gnssvod.geodesy.cart2ell(x, y, z, ellipsoid='GRS80')[source]

Convert 3D Cartesian coordinates to geodetic coordinates (latitude, longitude, height).

This function transforms ECEF Cartesian coordinates into geodetic coordinates on a specified ellipsoid. Special handling is included for points near the poles.

Parameters:
  • x (float) – Cartesian coordinates in meters in an ECEF reference frame.

  • y (float) – Cartesian coordinates in meters in an ECEF reference frame.

  • z (float) – Cartesian coordinates in meters in an ECEF reference frame.

  • ellipsoid (str, optional) – Ellipsoid to use for the transformation. Default is 'GRS80'.

Returns:

lat, lon, h – Geodetic coordinates in degrees and meters: latitude, longitude, height.

Return type:

float

Notes

  • If (x, y) = (0, 0), the longitude is set to 0 by convention and a warning is issued.

  • The function iteratively solves for latitude when not at the poles.

Examples

Convert the Eiffel Tower coordinates back to geodetic:

x, y, z = 4201197.602, 168347.839, 4780461.69 lat, lon, h = cart2ell(x, y, z) # lat, lon, h -> 48.858093, 2.294694, 360

gnssvod.geodesy.ell2cart(lat, lon, h, ellipsoid='GRS80')[source]

Convert geodetic coordinates (latitude, longitude, height) to 3D Cartesian coordinates.

This function transforms geodetic coordinates expressed on a specified ellipsoid into Earth-Centered, Earth-Fixed (ECEF) Cartesian coordinates.

Parameters:
  • lat (float) – Latitude in degrees.

  • lon (float) – Longitude in degrees.

  • h (float) – Ellipsoidal height in meters.

  • ellipsoid (str, optional) – Ellipsoid to use for the transformation. Default is 'GRS80'.

Returns:

x, y, z – Cartesian coordinates in meters in an ECEF reference frame.

Return type:

float

Examples

Build Cartesian coordinates for the Eiffel Tower:

lat, lon, h = 48.858093, 2.294694, 360 x, y, z = ell2cart(lat, lon, h) # x, y, z -> 4201197.602, 168347.839, 4780461.69