Skip to content

Documentation / @interstellar-tools/maps / stereographic

Function: stereographic() ​

ts
function stereographic(
  phi: Radians,
  lambda: Radians,
  R: number,
  options?: AzimuthalOptionsInterface
): ProjectedPointInterface;

Defined in: projections/stereographic.ts:65

Project a point on a sphere with the stereographic projection: a conformal map centred on any point, the usual choice for polar maps.

cos⁡c=sin⁡φ0sin⁡φ+cos⁡φ0cos⁡φcos⁡(λ−λ0),k=21+cos⁡cx=Rkcos⁡φsin⁡(λ−λ0),y=Rk(cos⁡φ0sin⁡φ−sin⁡φ0cos⁡φcos⁡(λ−λ0))

Where:

  • φ and λ are the point's latitude and longitude (rad)
  • φ0 and λ0 are the map's centre (rad)
  • c is the point's angular distance from the centre (rad)
  • k is the map's scale at the point, the same in every direction
  • R is the sphere's radius (m)

Units

  • Inputs: angles in radians, R in m.
  • Output: { x, y } in m.

Notes

  • Conformal: angles and small shapes are kept, and every circle on the sphere is a circle (or a line) on the map. The scale is true at the centre and grows to k away from it: a point at angular distance c is 2Rtan⁡(c/2) from the centre, in its true direction.
  • With φ0=±π/2 it's the polar stereographic projection, used for polar caps, such as those of Mars, and for sea ice on Earth.
  • The whole sphere maps to the infinite plane except the centre's antipode, which is infinitely far away: it throws a RangeError, as does a point within rounding of it, about 10−15 rad.

Parameters ​

ParameterTypeDescription
phiRadiansLatitude φ in radians (finite, in [−π/2, π/2]).
lambdaRadiansLongitude λ in radians (finite).
RnumberRadius R of the sphere in m (finite, > 0).
options?AzimuthalOptionsInterfacephi0 and lambda0, the map's centre (radians, both default to 0).

Returns ​

ProjectedPointInterface

The point on the map, { x, y } in m.

Throws ​

  • If any input is not a finite number.
  • If phi or phi0 is outside [−π/2, π/2], R <= 0, or the point is the centre's antipode.

Example ​

ts
// Mars's south polar cap: 80° S, 45° E, on a map centred on the south pole
stereographic(toRad(-80), toRad(45), 3_389_500, { phi0: toRad(-90) });
// ≈ { x: 419 375, y: 419 375 } m, 593 086 m from the pole

See ​