@@ -40,13 +40,15 @@ class TileLayer(Layer):
4040 You can also pass a custom tileset by passing a
4141 :class:`xyzservices.TileProvider` or a Leaflet-style
4242 URL to the tiles parameter: ``https://{s}.yourtiles.com/{z}/{x}/{y}.png``.
43- min_zoom: int, default 0
44- Minimum allowed zoom level for this tile layer.
45- max_zoom: int, default 18
46- Maximum allowed zoom level for this tile layer.
43+ min_zoom: int, optional, default 0
44+ Minimum allowed zoom level for this tile layer. Filled by xyzservices by default.
45+ max_zoom: int, optional, default 18
46+ Maximum allowed zoom level for this tile layer. Filled by xyzservices by default.
4747 max_native_zoom: int, default None
4848 The highest zoom level at which the tile server can provide tiles.
49- If provided you can zoom in past this level. Else tiles will turn grey.
49+ Filled by xyzservices by default.
50+ By setting max_zoom higher than max_native_zoom, you can zoom in
51+ past max_native_zoom, tiles will be autoscaled.
5052 attr: string, default None
5153 Map tile attribution; only required if passing custom tile URL.
5254 detect_retina: bool, default False
@@ -89,8 +91,8 @@ class TileLayer(Layer):
8991 def __init__ (
9092 self ,
9193 tiles : Union [str , xyzservices .TileProvider ] = "OpenStreetMap" ,
92- min_zoom : int = 0 ,
93- max_zoom : int = 18 ,
94+ min_zoom : Optional [ int ] = None ,
95+ max_zoom : Optional [ int ] = None ,
9496 max_native_zoom : Optional [int ] = None ,
9597 attr : Optional [str ] = None ,
9698 detect_retina : bool = False ,
@@ -117,8 +119,9 @@ def __init__(
117119
118120 if isinstance (tiles , xyzservices .TileProvider ):
119121 attr = attr if attr else tiles .html_attribution # type: ignore
120- min_zoom = tiles .get ("min_zoom" , min_zoom )
121- max_zoom = tiles .get ("max_zoom" , max_zoom )
122+ min_zoom = min_zoom or tiles .get ("min_zoom" )
123+ max_zoom = max_zoom or tiles .get ("max_zoom" )
124+ max_native_zoom = max_native_zoom or tiles .get ("max_zoom" )
122125 subdomains = tiles .get ("subdomains" , subdomains )
123126 if name is None :
124127 name = tiles .name .replace ("." , "" ).lower ()
@@ -137,9 +140,9 @@ def __init__(
137140 raise ValueError ("Custom tiles must have an attribution." )
138141
139142 self .options = parse_options (
140- min_zoom = min_zoom ,
141- max_zoom = max_zoom ,
142- max_native_zoom = max_native_zoom or max_zoom ,
143+ min_zoom = min_zoom or 0 ,
144+ max_zoom = max_zoom or 18 ,
145+ max_native_zoom = max_native_zoom ,
143146 no_wrap = no_wrap ,
144147 attribution = attr ,
145148 subdomains = subdomains ,
0 commit comments