UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

22 lines (17 loc) 599 B
/* * L.CRS.EPSG3857 (Spherical Mercator) is the most common CRS for web mapping * and is used by Leaflet by default. */ L.CRS.EPSG3857 = L.extend({}, L.CRS, { code: 'EPSG:3857', projection: L.Projection.SphericalMercator, transformation: new L.Transformation(0.5 / Math.PI, 0.5, -0.5 / Math.PI, 0.5), project: function (latlng) { // (LatLng) -> Point var projectedPoint = this.projection.project(latlng), earthRadius = 6378137; return projectedPoint.multiplyBy(earthRadius); } }); L.CRS.EPSG900913 = L.extend({}, L.CRS.EPSG3857, { code: 'EPSG:900913' });