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