CRS
Abstract class that 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. Leaflet defines the most usual CRSs by default. If you want to use a CRS not defined by default, take a look at the Proj4Leaflet plugin.
Methods
Method | Returns | Description |
---|---|---|
latLngToPoint( |
Point |
Projects geographical coordinates into pixel coordinates for a given zoom. |
pointToLatLng( |
LatLng |
The inverse of |
project( |
Point |
Projects geographical coordinates into coordinates in units accepted for this CRS (e.g. meters for EPSG:3857, for passing it to WMS services). |
unproject( |
LatLng |
Given a projected coordinate returns the corresponding LatLng.
The inverse of |
scale( |
Number |
Returns the scale used when transforming projected coordinates into
pixel coordinates for a particular zoom. For example, it returns
|
zoom( |
Number |
Inverse of |
getProjectedBounds( |
Bounds |
Returns the projection's bounds scaled and transformed for the provided |
distance( |
Number |
Returns the distance between two geographical coordinates. |
wrapLatLng( |
LatLng |
Returns a |
Properties
Property | Type | Description |
---|---|---|
code
| ||
wrapLng
| ||
wrapLat
| ||
infinite
|
Defined CRSs
CRS | Description |
---|---|
L.CRS.EPSG3395 |
Rarely used by some commercial tile providers. Uses Elliptical Mercator projection. |
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.Earth |
Serves as the base for CRS that are global such that they cover the earth.
Can only be used as the base for other CRS and cannot be used directly,
since it does not have a code , projection or transformation . distance() returns
meters. |
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). distance() returns
simple euclidean distance. |