Transformations between geographic coordinate systems

Perform various coordinate transformations

This module performs various coordinate transformations, based on some well-known formulas.

class sapphire.transformations.geographic.WGS84Datum

Definition of the WGS84 datum

These definitions are taken from https://en.wikipedia.org/wiki/Geodetic_system, believing that enough editors have gone over them to make sure they are correct.

a = 6378137.0
f = 0.0033528106647474805
b = 6356752.314245179
e = 0.08181919084262149
eprime = 0.08209443794969568
class sapphire.transformations.geographic.FromWGS84ToENUTransformation(ref_llacoordinates)

Convert between various geographic coordinate systems

This class converts coordinates between LLA, ENU, and ECEF.

Initialize the transformation object.

Parameters:

ref_llacoordinates – reference latitude, longitude, and altitude coordinates. These are used as origin for ENU coordinates.

geode = <sapphire.transformations.geographic.WGS84Datum object>
transform(coordinates)

Transform WGS84 coordinates to ENU coordinates

lla_to_enu(coordinates)

Transform WGS84 coordinates to ENU coordinates

enu_to_lla(coordinates)

Transform WGS84 coordinates to ENU coordinates

lla_to_ecef(coordinates)

Convert from LLA coordinates to ECEF coordinates

LLA: Latitude, Longitude, Altitude ECEF: Earth-Centered, Earth-Fixed

The conversion formulas are taken from https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates but slightly reworked.

Mind that the input is expected to be in degrees, as is standard in coordinate notation.

Parameters:

coordinates – tuple of latitude, longitude (both in degrees) and altitude (in meters).

Returns:

ECEF coordinates (in meters).

ecef_to_lla(coordinates)

Convert from ECEF coordinates to LLA coordinates

ECEF: Earth-Centered, Earth-Fixed LLA: Latitude, Longitude, Altitude

The conversion formulas are taken from https://gist.github.com/klucar/1536054

Parameters:

coordinates – tuple of X, Y, and Z (in meters).

Returns:

latitude, longitude (in degrees) and altitude (in meters).

ecef_to_enu(coordinates)

Convert from ECEF coordinates to ENU coordinates

ECEF: Earth-Centered, Earth-Fixed ENU: East, North, Up

The conversion formulas are taken from https://en.wikipedia.org/wiki/Geodetic_system#From_ECEF_to_ENU

Parameters:

coordinates – a tuple containing the ECEF coordinates (in meters) of the point to transform

Returns:

east, north, and up (in meters).

enu_to_ecef(coordinates)

Convert from ENU coordinates to ECEF coordinates

ENU: East, North, Up ECEF: Earth-Centered, Earth-Fixed

Parameters:

coordinates – a tuple containing the ENU coordinates (in meters).

Returns:

ECEF coordinates (in meters).