CRS
Quick answer
L.CRS bundles projection, transformation and wrapping rules into one object that converts latitude and longitude into plane and pixel coordinates. Pick L.CRS.EPSG3857 for standard tiles, or swap in EPSG4326, EPSG3395 or L.CRS.Simple through the map's crs option. Its code property also feeds WMS request parameters.
L.map( id , { crs: L.CRS. EPSG4326 }) → Map
Key points
- L.CRS.EPSG4326 keeps raw longitude and latitude, matching WMS 1.3.0 axis order.
- L.CRS.Simple accepts arbitrary numbers, which suits indoor plans and image slices.
- distance exists only on Earth-derived CRS objects, so Simple returns undefined.
Example
var map4326 = L.map('map', {
crs: L.CRS.EPSG4326,
center: [39.907, 116.391],
zoom: 4
});
L.tileLayer.wms('https://example.com/geoserver/wms', {
layers: 'demo:province',
format: 'image/png',
transparent: true,
crs: L.CRS.EPSG4326
}).addTo(map4326);var MeterCRS = L.Util.extend({}, L.CRS.Simple, {
code: 'LOCAL:METER',
transformation: new L.Transformation(1, 0, -1, 0)
});
var indoor = L.map('map', {
crs: MeterCRS,
minZoom: -2,
maxZoom: 4
});
indoor.setView([0, 0], 0);
Notes
- CRS is fixed at map creation and cannot be swapped later; build separate maps instead.
- A mismatched CRS with WMS shows up as a shifted or vertically flipped layer.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). CRS. https://www.jingweizhi.com/en/leaflet/api/crs.html (accessed 2026-11-03).