Skip to content

@ue-too/border / inverseMercatorProjection

Function: inverseMercatorProjection()

inverseMercatorProjection(point, centerLongitude): GeoCoord

Defined in: projection.ts:85

Converts a Mercator projection point back to geographic coordinates.

Parameters

point

Point

The point in Mercator projection (in meters)

centerLongitude

number = 0

The central meridian in degrees (must match the forward projection)

Returns

GeoCoord

The geographic coordinate

Remarks

This is the inverse of mercatorProjection. Given a point in Mercator projection space (in meters), it returns the corresponding latitude/longitude.

Example

typescript
const point = { x: -14232.4, y: 6711665.7 };
const coord = inverseMercatorProjection(point);
console.log(coord); // { latitude: ~51.5, longitude: ~-0.13 }