Smooth Proj4js integration with Leaflet
Proj4Leaflet uses Leaflet 1.0.3, for compatibility with Leaflet 0.7.x use the 0.7.2 release.
Leaflet comes with built in support for tiles in Spherical Mercator and a few other projections. If you need support for tile layers in other projections, the Proj4Leaflet plugin lets you use tiles in any projection supported by Proj4js, which means support for just about any projection commonly used.
Proj4Leaflet also adds support for GeoJSON in any projection, while Leaflet by itself assumes GeoJSON to always use WGS84 as its projection.
Image overlays with bounds set from projected coordinates rather than
LatLngs are also supported by Proj4Leaflet plugin.
For more details, see this blog post on tiling and projections.
Common use means making a new CRS instance for the projection you want to use.
// RT90 with map's pixel origin at RT90 coordinate (0, 0)var crs =;var map = L;L;
Using options when constructing the CRS, you can set the tile set's origin.
// SWEREF 99 TM with map's pixel origin at (218128.7031, 6126002.9379)var crs =;
Proj4js has breaking changes introduced after version 1.1.0. The current version of Proj4Leaflet uses Proj4js 2.3.14 or later. If you for some reason need Proj4js version 1.1.0 compatibility, you can still use Proj4Leaflet version 0.5.
The plugin extends Leaflet with a few classes that helps integrating Proj4's projections into Leaflet's CRS abstract class.
A CRS implementation that uses a Proj4 definition for the projection. This is likely to be the only class you need to work with in Proj4Leaflet.
var map = L;
codeis the projection's SRS code (only used internally by the Proj4js library)
proj4defis the Proj4 definition string for the projection to use
optionsis an options object with these possible parameters:
origin- the projected coordinate to use as the map's pixel origin; overrides the
transformationoption if set
transformation- an L.Transformation that is used to transform the projected coordinates to pixel coordinates; default is
L.Transformation(1, 0, -1, 0)
scales- an array of scales (pixels per projected coordinate unit) for each corresponding zoom level; default is to use Leaflet's native scales. You should use
resolutions, not both.
resolutions- an array of resolutions (projected coordinate units per pixel) for each corresponding zoom level; default is to use Leaflet's native resolutions. You should use
resolutions, not both.
bounds- an L.Bounds providing the bounds of CRS in projected coordinates. If defined, Proj4Leaflet will use this in the
getSizemethod, otherwise reverting to Leaflet's default size for Spherical Mercator.
Extends L.GeoJSON to add CRS support. Unlike the TileLayer extension, the
CRS is derived from the
name property of a
crs defined directly on the GeoJSON object per the spec.
Linked CRSs are not supported.
Note: The relevant Proj4 definition should be defined directly via
proj4.defs before loading the GeoJSON object.
If it is not, Proj4leaflet will throw an error.
Also, note that future versions of the GeoJSON spec may not include explicit CRS support. See https://github.com/GeoJSONWG/draft-geojson/pull/6 for more information.
proj4;var geojson =type: "Feature"geometry:type: "Point"coordinates: 481650 4980105crs:type: "name"properties:name: "urn:ogc:def:crs:EPSG::26915";var map = L;LProj;
Works like L.ImageOverlay, but accepts bounds in the map's projected coordinate system instead of latitudes and longitudes. This is useful when the projected coordinate systems axis do not align with the latitudes and longitudes, which results in distortion with the default image overlay in Leaflet.
// Coordinate system is EPSG:28992 / Amersfoort / RD Newvar imageBounds = L;LProj;