@@ -22,7 +22,8 @@ def __init__(self, location=None, width='100%', height='100%',
2222 left = "0%" , top = "0%" , position = 'relative' ,
2323 tiles = 'OpenStreetMap' , API_key = None , max_zoom = 18 , min_zoom = 1 ,
2424 zoom_start = 10 , attr = None , min_lat = - 90 , max_lat = 90 ,
25- min_lon = - 180 , max_lon = 180 , detect_retina = False ):
25+ min_lon = - 180 , max_lon = 180 , detect_retina = False ,
26+ crs = 'EPSG3857' ):
2627 """Create a Map with Folium and Leaflet.js
2728
2829 Generate a base map of given width and height with either default
@@ -63,6 +64,20 @@ def __init__(self, location=None, width='100%', height='100%',
6364 If true and user is on a retina display, it will request four
6465 tiles of half the specified size and a bigger zoom level in place
6566 of one to utilize the high resolution.
67+ crs : str, default 'EPSG3857'
68+ Defines coordinate reference systems for projecting geographical points
69+ into pixel (screen) coordinates and back.
70+ You can use Leaflet's values :
71+ * EPSG3857 : The most common CRS for online maps, used by almost all
72+ free and commercial tile providers. Uses Spherical Mercator projection.
73+ Set in by default in Map's crs option.
74+ * EPSG4326 : A common CRS among GIS enthusiasts. Uses simple Equirectangular
75+ projection.
76+ * EPSG3395 : Rarely used by some commercial tile providers. Uses Elliptical
77+ Mercator projection.
78+ * Simple : A simple CRS that maps longitude and latitude into x and y directly.
79+ May be used for maps of flat surfaces (e.g. game maps). Note that the y axis
80+ should still be inverted (going from bottom to top).
6681
6782 Returns
6883 -------
@@ -106,6 +121,8 @@ def __init__(self, location=None, width='100%', height='100%',
106121 self .min_lon = min_lon
107122 self .max_lon = max_lon
108123
124+ self .crs = crs
125+
109126 self .add_tile_layer (tiles = tiles , min_zoom = min_zoom , max_zoom = max_zoom ,
110127 attr = attr , API_key = API_key ,
111128 detect_retina = detect_retina )
@@ -135,7 +152,8 @@ def __init__(self, location=None, width='100%', height='100%',
135152 center:[{{this.location[0]}},{{this.location[1]}}],
136153 zoom: {{this.zoom_start}},
137154 maxBounds: bounds,
138- layers: []
155+ layers: [],
156+ crs: L.CRS.{{this.crs}}
139157 });
140158 {% endmacro %}
141159 """ )
0 commit comments