You are viewing an older version of Mapbox.js. Check out v3.0.1 for the latest.

ICRS

Defines coordinate reference systems for projecting geographical points into pixel (screen) coordinates and back (and to coordinates in other units for WMS services). See Spatial reference system.

Methods

Method Returns Description
latLngToPoint( <LatLng> latlng, <Number> zoom ) Point Projects geographical coordinates on a given zoom into pixel coordinates.
pointToLatLng( <Point> point, <Number> zoom ) LatLng The inverse of latLngToPoint. Projects pixel coordinates on a given zoom into geographical coordinates.
project( <LatLng> latlng ) Point Projects geographical coordinates into coordinates in units accepted for this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
scale( <Number> zoom ) Number Returns the scale used when transforming projected coordinates into pixel coordinates for a particular zoom. For example, it returns 256 * 2^zoom for Mercator-based CRS.
getSize( <Number> zoom ) Point Returns the size of the world in pixels for a particular zoom.

Properties

Property Type Description
projection IProjection Projection that this CRS uses.
transformation Transformation Transformation that this CRS uses to turn projected coordinates into screen coordinates for a particular tile service.
code String Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857').

Defined CRS

Leaflet comes with a set of already defined CRS to use out of the box:

Projection Description
L.CRS.EPSG3857 The most common CRS for online maps, used by almost all free and commercial tile providers. Uses Spherical Mercator projection. Set in by default in Map's crs option.
L.CRS.EPSG4326 A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
L.CRS.EPSG3395 Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
L.CRS.Simple A simple CRS that maps longitude and latitude into x and y directly. May be used for maps of flat surfaces (e.g. game maps). Note that the y axis should still be inverted (going from bottom to top).

If you want to use some obscure CRS not listed here, take a look at the Proj4Leaflet plugin.