Atlaslog
Atlaslog / Field Notes / Coordinates & projections
Field note · Coordinates & projections

Changing CRS to EPSG:4326 squashes the map vertically

Quick answer

L.CRS.EPSG4326 gives one degree of longitude and one degree of latitude the same pixel length, but a degree of longitude shrinks by cos(lat). China is therefore flattened, circles become ellipses, and the distortion grows with latitude.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: Leaflet 1.9.x · OpenLayers 9.x
Symptom
Checklist
  1. Draw a known 1 km x 1 km square and measure its on-screen width and height.
  2. Print map.options.crs.code to confirm whether the map is on EPSG:4326 or EPSG:3857.
  3. In a moveend handler compare map.getSize() with map.getBounds() and compute pixels-per-degree in both directions.
  4. Switch back to the default CRS and measure again; a restored shape confirms the projection choice is the cause.
Fix

Keep the default EPSG:3857 for display; use EPSG:4326 only for equal-angle gridded data such as weather rasters, and never for vector data that must keep its shape.

Code
map.on('moveend', () => {
  const b = map.getBounds(), s = map.getSize();
  const pxPerLon = s.x / (b.getEast() - b.getWest());
  const pxPerLat = s.y / (b.getNorth() - b.getSouth());
  console.log('px/度 经:', pxPerLon.toFixed(3), '纬:', pxPerLat.toFixed(3));
});
const map = L.map('map', { center: [39.909, 116.397], zoom: 10 });
const map4326 = L.map('map2', {
  crs: L.CRS.EPSG4326,
  center: [39.909, 116.397],
  zoom: 5
});
L.tileLayer('https://example.com/4326/{z}/{y}/{x}.png', {
  tileSize: 256,
  noWrap: true,
  bounds: [[-90, -180], [90, 180]]
}).addTo(map4326);
Watch out
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). Changing CRS to EPSG:4326 squashes the map vertically. https://www.jingweizhi.com/en/cookbook/leaflet-4326-stretch.html (accessed 2026-11-03).