Documentation / @interstellar-tools/equations / bodyFixedToGeodetic
Function: bodyFixedToGeodetic()
ts
function bodyFixedToGeodetic(
x: number,
y: number,
z: number,
a: number,
eSquared: number
): GeodeticCoordinatesInterface;Defined in: cartography/body-fixed-to-geodetic.ts:82
Convert a body-fixed Cartesian position (ECEF for Earth) to geodetic coordinates: latitude, longitude and height.
There's no closed form for the latitude. This uses Bowring's iteration on the parametric latitude
and then
Where:
is the distance from the rotation axis (m) is the equatorial radius, the polar radius (m) is the first eccentricity squared, the second
Units
- Inputs:
x,y,zandain m,eSquareddimensionless. - Output:
phiandlambdain radians,hin m.
Notes
- Starting from
, two iterations reach sub-millimetre accuracy for points near Earth's surface; the loop runs until stops changing, to at most 10 iterations. - The height formula is stable everywhere, the poles included. On the rotation axis,
phiis ±π/2 andlambdais 0. - For a point on the surface,
phiequals planetographicLatitudeOblate; this one also handles points above and below it. - geodeticToBodyFixed goes the other way.
In practiceApollo 11, in Earth orbit
32.672° N, 191.1 km up
At orbit insertion: 6 563.0 km from Earth's centre, at 32.502° N geocentric
Seen from Earth's centre, the insertion point was at 32.502°, the latitude that fixes the orbit's inclination. On a map it was 0.170° further north, the latitude the flight evaluation report gives.
ts
const lat = toRad(32.502);
const r = 6_563_041;
bodyFixedToGeodetic(
r * Math.cos(lat),
0,
r * Math.sin(lat),
6_378_137,
0.00669437999014
);
// phi ≈ 32.672°, h ≈ 191.1 kmParameters
| Parameter | Type | Description |
|---|---|---|
x | number | Body-fixed |
y | number | Body-fixed |
z | number | Body-fixed |
a | number | Equatorial radius |
eSquared | number | First eccentricity squared |
Returns
The geodetic latitude, longitude and height.
Throws
- If any input is not a finite number.
- If
a <= 0,eSquaredis outside [0, 1), or the point is at the centre.
Example
ts
// 1 km above the North Pole on WGS84
const { phi, h } = bodyFixedToGeodetic(
0,
0,
6_357_752.314,
6_378_137,
0.00669437999014
);
// phi = π/2, h ≈ 1 000 mSee
- geodeticToBodyFixed
- planetographicLatitudeOblate
- https://en.wikipedia.org/wiki/Geographic_coordinate_conversion Geographic coordinate conversion