Atlaslog
Atlaslog / Leaflet / API reference / Transformation
Leaflet · API reference

Transformation

Quick answer

L.Transformation maps projected plane coordinates into pixel space using four coefficients, producing x prime equals a x plus b and y prime equals c y plus d before scaling. Custom CRS objects define their scale and axis orientation here. Leaflet's built-in CRS objects each expose one transformation that fixes the axis direction and origin.

Last verified 2026-11-03 · Leaflet 1.9.4 · Cite this page
new L.Transformation( a , b , c , d ) → Transformation
Key points
Example
var t = L.CRS.EPSG3857.transformation;

/* 投影原点的归一化像素值 */
var p0 = t.transform(L.point(0, 0));
console.log(p0.x, p0.y);          // 0.5 0.5

/* 缩放级别 0 时世界宽度 256 像素 */
var p1 = t.transform(L.point(0, 0), L.CRS.EPSG3857.scale(0));
console.log(p1.x, p1.y);          // 128 128
function toPixel(crs, latlng, zoom) {
  var projected = crs.projection.project(latlng);   // 度 → 米
  return crs.transformation.transform(projected, crs.scale(zoom));
}

var zoom = map.getZoom();
var px = toPixel(L.CRS.EPSG3857, L.latLng(39.907359, 116.391263), zoom);
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). Transformation. https://www.jingweizhi.com/en/leaflet/api/transformation.html (accessed 2026-11-03).