Skip to content

Documentation / @interstellar-tools/maps / mollweide

Function: mollweide() ​

ts
function mollweide(
  phi: Radians,
  lambda: Radians,
  R: number,
  options?: ProjectionOptionsInterface
): ProjectedPointInterface;

Defined in: projections/mollweide.ts:107

Project a point on a sphere with the Mollweide projection: an equal-area map of the whole sphere inside an ellipse twice as wide as tall.

2θ+sin⁡2θ=πsin⁡φ,x=22πR(λ−λ0)cos⁡θ,y=2Rsin⁡θ

Where:

  • φ and λ are the point's latitude and longitude (rad)
  • θ is an auxiliary angle, found with Newton's method (rad)
  • λ0 is the central meridian (rad)
  • R is the sphere's radius (m)

Units

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

Notes

  • Equal-area: a region's area on the map is its area on the sphere. The whole sphere fills an ellipse 42R wide and 22R tall, with straight parallels and elliptical meridians, which distorts shapes less near the edges than sinusoidal. Sky surveys, such as maps of the cosmic microwave background, use it.
  • Newton's method slows down near the poles, where 2θ+sin⁡2θ flattens out; the solver starts closer there and falls back to bisection, so it always converges. The poles themselves are solved directly.
  • λ−λ0 is wrapped to (−π, π]. −π itself stays on the left edge, so a line that ends there, like a ground track split at the antimeridian, isn't drawn across the map.

Parameters ​

ParameterTypeDescription
phiRadiansLatitude φ in radians (finite, in [−π/2, π/2]).
lambdaRadiansLongitude λ in radians (finite).
RnumberRadius R of the sphere in m (finite, > 0).
options?ProjectionOptionsInterfacelambda0, the central meridian (radians, defaults to 0).

Returns ​

ProjectedPointInterface

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

Throws ​

  • If any input is not a finite number.
  • If phi is outside [−π/2, π/2], or R <= 0.

Example ​

ts
// The edge of the map: 180° E on the equator, and the north pole
mollweide(0 as Radians, Math.PI as Radians, 1); // { x: 2√2, y: 0 }
mollweide((Math.PI / 2) as Radians, 0 as Radians, 1); // { x: 0, y: √2 }

See ​