Skip to content

Documentation / @interstellar-tools/maps / inverseEquirectangular

Function: inverseEquirectangular() ​

ts
function inverseEquirectangular(
  x: number,
  y: number,
  R: number,
  options?: EquirectangularOptionsInterface
): GeographicCoordinatesInterface;

Defined in: projections/equirectangular.ts:150

Find the point on a sphere for a point on an equirectangular map: the inverse of equirectangular.

φ=φ0+yR,λ=λ0+xRcos⁡φ1

Units

  • Inputs: x, y and R in m, the options in radians.
  • Output: { phi, lambda } in radians, with λ in (−π, π].

Notes

  • The map ends at the poles: a y beyond them throws a RangeError.
  • λ is wrapped to (−π, π]: the map repeats east–west.

Parameters ​

ParameterTypeDescription
xnumberDistance east of the origin in m (finite).
ynumberDistance north of the origin in m (finite, on the map).
RnumberRadius R of the sphere in m (finite, > 0).
options?EquirectangularOptionsInterfacelambda0, phi0 and phi1, as for equirectangular.

Returns ​

GeographicCoordinatesInterface

The point on the sphere, { phi, lambda } in radians.

Throws ​

  • If any input is not a finite number.
  • If y is beyond a pole, phi0 is outside [−π/2, π/2], phi1 outside (−π/2, π/2), or R <= 0.

Example ​

ts
inverseEquirectangular(836_620, 591_579, 3_389_500, { phi1: toRad(45) });
// ≈ { phi: 10° N, lambda: 20° E }, in radians

See ​