Skip to main content

wgs84ToWebMercator

Projects a WGS 84 position (EPSG:4326) to Web Mercator (EPSG:3857). Latitude is clamped to ±MAX_MERCATOR_LATITUDE, so a pole gives the edge of the world square rather than infinity. Longitude is not wrapped: a longitude past 180 degrees lands in the next world copy, and projects back to the same value.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { wgs84ToWebMercator } from "@mapcairn/core";

function wgs84ToWebMercator(position: LatLng): WebMercatorPoint;

Parameters​

  • position (LatLng)

Returns​

WebMercatorPoint

Throws​

  • GeometryError of kind invalid when a coordinate is not finite.

See also​

Source: packages/core/src/geometry/mercator.ts:42