Skip to content

Documentation / @interstellar-tools/maps / equirectangular

Function: equirectangular() ​

ts
function equirectangular(
  phi: Radians,
  lambda: Radians,
  R: number,
  options?: EquirectangularOptionsInterface
): ProjectedPointInterface;

Defined in: projections/equirectangular.ts:91

Project a point on a sphere with the equirectangular projection: the simple cylindrical map, with latitude and longitude spaced evenly.

x=R(λ−λ0)cos⁡φ1,y=R(φ−φ0)

Where:

  • φ and λ are the point's latitude and longitude (rad)
  • λ0 is the central meridian and φ0 the latitude of the origin (rad)
  • φ1 is the standard parallel, where the scale is true (rad)
  • R is the sphere's radius (m)

Units

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

Notes

  • The usual format for global mosaics and elevation models, where it's called simple cylindrical: a grid in degrees is a grid on the map. With φ1=0 it's the plate carrée, twice as wide as tall.
  • Distances are true along every meridian, and along the standard parallels ±φ1 east–west. Elsewhere east–west distances are stretched by cos⁡φ1/cos⁡φ, so it keeps neither angles nor areas.
  • Choose φ1 near the latitude of interest for a regional map: Mars mosaics of mid-latitude sites, for example.
  • λ−λ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?EquirectangularOptionsInterfacelambda0, the central meridian, phi0, the latitude of the origin, and phi1, the standard parallel (radians, all 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], phi1 outside (−π/2, π/2), or R <= 0.

Example ​

ts
// 10° N, 20° E on a 3 389.5 km Mars, true to scale at 45°
equirectangular(toRad(10), toRad(20), 3_389_500, { phi1: toRad(45) });
// ≈ { x: 837 km, y: 592 km }

See ​