Skip to content

Commit 106d829

Browse files
Conengmoocefpaf
authored andcommitted
Set min_zoom default to Leaflet value (0 i.o. 1) (#791)
* Set min_zoom default to Leaflet value (0) * Change min_zoom in test
1 parent 53bf936 commit 106d829

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

folium/folium.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ class Map(MacroElement):
101101
pass a custom URL or pass `None` to create a map without tiles.
102102
API_key: str, default None
103103
API key for Cloudmade or Mapbox tiles.
104+
min_zoom: int, default 0
105+
Minimum allowed zoom level for the tile layer that is created.
104106
max_zoom: int, default 18
105-
Maximum zoom depth for the map.
107+
Maximum allowed zoom level for the tile layer that is created.
106108
zoom_start: int, default 10
107109
Initial zoom level for the map.
108110
attr: string, default None
@@ -163,7 +165,7 @@ class Map(MacroElement):
163165

164166
def __init__(self, location=None, width='100%', height='100%',
165167
left='0%', top='0%', position='relative',
166-
tiles='OpenStreetMap', API_key=None, max_zoom=18, min_zoom=1,
168+
tiles='OpenStreetMap', API_key=None, max_zoom=18, min_zoom=0,
167169
zoom_start=10, world_copy_jump=False,
168170
no_wrap=False, attr=None, min_lat=-90, max_lat=90,
169171
min_lon=-180, max_lon=180, max_bounds=False,
@@ -178,9 +180,9 @@ def __init__(self, location=None, width='100%', height='100%',
178180
self.png_enabled = png_enabled
179181

180182
if not location:
181-
# If location is not passed we center and ignore zoom.
183+
# If location is not passed we center and zoom out.
182184
self.location = [0, 0]
183-
self.zoom_start = min_zoom
185+
self.zoom_start = 1
184186
else:
185187
self.location = _validate_location(location)
186188
self.zoom_start = zoom_start
@@ -309,7 +311,7 @@ def _repr_png_(self):
309311
return self._to_png()
310312

311313
def add_tile_layer(self, tiles='OpenStreetMap', name=None,
312-
API_key=None, max_zoom=18, min_zoom=1,
314+
API_key=None, max_zoom=18, min_zoom=0,
313315
attr=None, active=False,
314316
detect_retina=False, no_wrap=False, subdomains='abc',
315317
**kwargs):

folium/raster_layers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ class TileLayer(Layer):
4040
4141
You can pass a custom tileset to Folium by passing a Leaflet-style
4242
URL to the tiles parameter: ``http://{s}.yourtiles.com/{z}/{x}/{y}.png``
43-
min_zoom: int, default 1
44-
Minimal zoom for which the layer will be displayed.
43+
min_zoom: int, default 0
44+
Minimum allowed zoom level for this tile layer.
4545
max_zoom: int, default 18
46-
Maximal zoom for which the layer will be displayed.
46+
Maximum allowed zoom level for this tile layer.
4747
attr: string, default None
4848
Map tile attribution; only required if passing custom tile URL.
4949
API_key: str, default None
@@ -62,7 +62,7 @@ class TileLayer(Layer):
6262
Subdomains of the tile service.
6363
6464
"""
65-
def __init__(self, tiles='OpenStreetMap', min_zoom=1, max_zoom=18,
65+
def __init__(self, tiles='OpenStreetMap', min_zoom=0, max_zoom=18,
6666
attr=None, API_key=None, detect_retina=False,
6767
name=None, overlay=False,
6868
control=True, no_wrap=False, subdomains='abc'):

tests/test_folium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_map_build(self):
207207
'address': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
208208
'attr': attr,
209209
'max_zoom': 20,
210-
'min_zoom': 1,
210+
'min_zoom': 0,
211211
'detect_retina': False,
212212
'no_wrap': False,
213213
'subdomains': 'abc'

0 commit comments

Comments
 (0)