Geodetic and Geocentric Coordinates¶
Functions for converting between geodetic, geocentric, and ECEF coordinates.
Geodetic Conversions¶
position_geodetic_to_ecef
builtin
¶
position_geodetic_to_ecef(x_geod: ndarray, angle_format: AngleFormat) -> Any
Convert geodetic position to ECEF Cartesian coordinates.
Transforms a position from geodetic coordinates (latitude, longitude, altitude) using
the WGS84 ellipsoid model to Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_geod
|
ndarray
|
Geodetic position |
required |
angle_format
|
AngleFormat
|
Angle format for input angular coordinates ( |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Example
position_ecef_to_geodetic
builtin
¶
position_ecef_to_geodetic(x_ecef: ndarray, angle_format: AngleFormat) -> Any
Convert ECEF Cartesian position to geodetic coordinates.
Transforms a position from Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates
to geodetic coordinates (latitude, longitude, altitude) using the WGS84 ellipsoid model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_ecef
|
ndarray
|
|
required |
angle_format
|
AngleFormat
|
Angle format for output angular coordinates ( |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Geodetic position |
Example
import brahe as bh
import numpy as np
# Convert ECEF to geodetic coordinates (GPS-like)
x_ecef = np.array([-1275936.0, -4797210.0, 4020109.0]) # Example location
x_geod = bh.position_ecef_to_geodetic(x_ecef, bh.AngleFormat.DEGREES)
print(f"Geodetic: lat={x_geod[0]:.4f}°, lon={x_geod[1]:.4f}°, alt={x_geod[2]:.0f}m")
Geocentric Conversions¶
position_geocentric_to_ecef
builtin
¶
position_geocentric_to_ecef(x_geoc: ndarray, angle_format: AngleFormat) -> Any
Convert geocentric position to ECEF Cartesian coordinates.
Transforms a position from geocentric spherical coordinates (latitude, longitude, radius)
to Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_geoc
|
ndarray
|
Geocentric position |
required |
angle_format
|
AngleFormat
|
Angle format for input angular coordinates ( |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Example
position_ecef_to_geocentric
builtin
¶
position_ecef_to_geocentric(x_ecef: ndarray, angle_format: AngleFormat) -> Any
Convert ECEF Cartesian position to geocentric coordinates.
Transforms a position from Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates
to geocentric spherical coordinates (latitude, longitude, radius).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_ecef
|
ndarray
|
|
required |
angle_format
|
AngleFormat
|
Angle format for output angular coordinates ( |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Geocentric position |
Example
import brahe as bh
import numpy as np
# Convert ECEF to geocentric coordinates
x_ecef = np.array([6378137.0, 0.0, 0.0]) # Point on equator, prime meridian
x_geoc = bh.position_ecef_to_geocentric(x_ecef, bh.AngleFormat.DEGREES)
print(f"Geocentric: lat={x_geoc[0]:.2f}°, lon={x_geoc[1]:.2f}°, r={x_geoc[2]:.0f}m")