@@ -21,7 +21,8 @@ def __init__(self, location=None, width='100%', height='100%',
21
21
left = "0%" , top = "0%" , position = 'relative' ,
22
22
tiles = 'OpenStreetMap' , API_key = None , max_zoom = 18 , min_zoom = 1 ,
23
23
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' ):
25
26
"""Create a Map with Folium and Leaflet.js
26
27
27
28
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%',
62
63
If true and user is on a retina display, it will request four
63
64
tiles of half the specified size and a bigger zoom level in place
64
65
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).
65
80
66
81
Returns
67
82
-------
@@ -105,6 +120,8 @@ def __init__(self, location=None, width='100%', height='100%',
105
120
self .min_lon = min_lon
106
121
self .max_lon = max_lon
107
122
123
+ self .crs = crs
124
+
108
125
self .add_tile_layer (tiles = tiles , min_zoom = min_zoom , max_zoom = max_zoom ,
109
126
attr = attr , API_key = API_key ,
110
127
detect_retina = detect_retina )
@@ -134,7 +151,8 @@ def __init__(self, location=None, width='100%', height='100%',
134
151
center:[{{this.location[0]}},{{this.location[1]}}],
135
152
zoom: {{this.zoom_start}},
136
153
maxBounds: bounds,
137
- layers: []
154
+ layers: [],
155
+ crs: L.CRS.{{this.crs}}
138
156
});
139
157
{% endmacro %}
140
158
""" )
0 commit comments