Atlaslog
Atlaslog / Leaflet / API reference / Projection
Leaflet · API reference

Projection

Quick answer

L.Projection converts geographic coordinates into plane coordinates, exposing project and unproject on the LonLat, SphericalMercator and Mercator implementations. Each projection carries bounds and constants that clamp extreme latitudes before results diverge. The SphericalMercator and Mercator variants differ only in how they treat the ellipsoid.

Last verified 2026-11-03 · Leaflet 1.9.4 · Cite this page
L.Projection.Mercator. project ( latlng ) → Point
Key points
Example
var latlng = L.latLng(39.907359, 116.391263);

var meters = L.Projection.Mercator.project(latlng);
console.log(meters.x, meters.y);        // 单位米

var back = L.Projection.Mercator.unproject(meters);
console.log(back.equals(latlng));       // true

/* 纬度接近极区时先钳制,再投影 */
var safe = L.latLng(
  Math.max(-85, Math.min(85, latlng.lat)),
  latlng.lng
);
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Projection. https://www.jingweizhi.com/en/leaflet/api/projection.html (accessed 2026-11-03).