Documentation / @interstellar-tools/equations / heightAboveEllipsoid
Function: heightAboveEllipsoid()
ts
function heightAboveEllipsoid(
x: number,
y: number,
z: number,
a: number,
eSquared: number
): number;Defined in: cartography/height-above-ellipsoid.ts:67
Compute a point's height above a body's reference ellipsoid: the exact height along the ellipsoid's normal, the height maps and GPS receivers give.
with the geodetic latitude
Where:
is the distance from the rotation axis (m) is the equatorial radius (m) is the first eccentricity squared
Units
- Inputs:
x,y,zandain m,eSquareddimensionless. - Output:
in m, negative below the ellipsoid.
Notes
- Exact, not the approximation
: the height is measured along the normal to the ellipsoid, which misses the centre except at the equator and the poles. - Where heightAboveSphere uses one radius, this follows the body's flattening. On Earth the two differ by up to 21.4 km at the poles if the sphere has the equatorial radius. With
they agree. - Heights on the ellipsoid are geometric. Elevations on maps are usually measured from an equipotential surface instead: the geoid on Earth, within about 100 m of the ellipsoid, or the areoid on Mars.
- The position must be in the body-fixed frame, with
along the rotation axis.
In practiceApollo 11, in Earth orbit
191.1 km up
At orbit insertion: 6 563.0 km from Earth's centre, at 32.502° N geocentric
Above the WGS84 ellipsoid, which at that latitude is 6.2 km below a sphere of the equatorial radius: heightAboveSphere gives 184.9 km.
ts
const lat = toRad(32.502);
const r = 6_563_041;
heightAboveEllipsoid(
r * Math.cos(lat),
0,
r * Math.sin(lat),
6_378_137,
0.00669437999014
);
// ≈ 191 100 mParameters
| 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
number
The 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
// On the WGS84 ellipsoid at the North Pole: the polar radius, 21.4 km short of the equatorial one
heightAboveEllipsoid(0, 0, 6_356_752.314, 6_378_137, 0.00669437999014); // ≈ 0 mSee
- bodyFixedToGeodetic
- heightAboveSphere
- https://en.wikipedia.org/wiki/Geographic_coordinate_conversion Geographic coordinate conversion