@@ -78,6 +78,8 @@ class LegacyMap(MacroElement):
78
78
* Simple : A simple CRS that maps longitude and latitude into x and y directly.
79
79
May be used for maps of flat surfaces (e.g. game maps). Note that the y axis
80
80
should still be inverted (going from bottom to top).
81
+ control_scale : bool, default False
82
+ Whether to add a control scale on the map.
81
83
82
84
Returns
83
85
-------
@@ -100,7 +102,7 @@ def __init__(self, location=None, width='100%', height='100%',
100
102
tiles = 'OpenStreetMap' , API_key = None , max_zoom = 18 , min_zoom = 1 ,
101
103
zoom_start = 10 , attr = None , min_lat = - 90 , max_lat = 90 ,
102
104
min_lon = - 180 , max_lon = 180 , detect_retina = False ,
103
- crs = 'EPSG3857' ):
105
+ crs = 'EPSG3857' , control_scale = False ):
104
106
super (LegacyMap , self ).__init__ ()
105
107
self ._name = 'Map'
106
108
@@ -127,6 +129,7 @@ def __init__(self, location=None, width='100%', height='100%',
127
129
self .max_lon = max_lon
128
130
129
131
self .crs = crs
132
+ self .control_scale = control_scale
130
133
131
134
if tiles :
132
135
self .add_tile_layer (tiles = tiles , min_zoom = min_zoom , max_zoom = max_zoom ,
@@ -161,6 +164,7 @@ def __init__(self, location=None, width='100%', height='100%',
161
164
layers: [],
162
165
crs: L.CRS.{{this.crs}}
163
166
});
167
+ {% if this.control_scale %}L.control.scale().addTo({{this.get_name()}});{% endif %}
164
168
{% endmacro %}
165
169
""" )
166
170
0 commit comments