Documentation / @interstellar-tools/maps / inverseMercator
Function: inverseMercator()
ts
function inverseMercator(
x: number,
y: number,
R: number,
options?: ProjectionOptionsInterface
): GeographicCoordinatesInterface;Defined in: projections/mercator.ts:127
Find the point on a sphere for a point on a Mercator map: the inverse of mercator.
Units
- Inputs:
x,yandRin m,lambda0in radians. - Output:
{ phi, lambda }in radians, within (−π, π].
Notes
- Every
has a latitude, so the whole map inverts; the poles are never reached. is wrapped to (−π, π]: the map repeats every east–west. - A square map,
on each side, reaches north and south: the limit of web map tiles.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Distance east of the origin in m (finite). |
y | number | Distance north of the origin in m (finite). |
R | number | Radius |
options? | ProjectionOptionsInterface | lambda0, the central meridian (radians, defaults to 0). |
Returns
GeographicCoordinatesInterface
The point on the sphere, { phi, lambda } in radians.
Throws
- If any input is not a finite number.
- If
R <= 0.
Example
ts
// The top of a square web map
inverseMercator(0, Math.PI * 6_378_137, 6_378_137).phi; // ≈ 1.4844 rad, 85.0511°See
- mercator
- https://doi.org/10.3133/pp1395 Snyder (1987), Map projections: a working manual, ch. 7