@@ -27,9 +27,6 @@ class TileLayer(Layer):
2727 - "OpenStreetMap"
2828 - "Stamen Terrain", "Stamen Toner", "Stamen Watercolor"
2929 - "CartoDB positron", "CartoDB dark_matter"
30- - "Mapbox Bright", "Mapbox Control Room" (Limited zoom)
31- - "Cloudmade" (Must pass API key)
32- - "Mapbox" (Must pass API key)
3330
3431 You can pass a custom tileset to Folium by passing a Leaflet-style
3532 URL to the tiles parameter: ``http://{s}.yourtiles.com/{z}/{x}/{y}.png``.
@@ -47,8 +44,6 @@ class TileLayer(Layer):
4744 If provided you can zoom in past this level. Else tiles will turn grey.
4845 attr: string, default None
4946 Map tile attribution; only required if passing custom tile URL.
50- API_key: str, default None
51- API key for Cloudmade or Mapbox tiles.
5247 detect_retina: bool, default False
5348 If true and user is on a retina display, it will request four
5449 tiles of half the specified size and a bigger zoom level in place
@@ -82,7 +77,7 @@ class TileLayer(Layer):
8277 """ )
8378
8479 def __init__ (self , tiles = 'OpenStreetMap' , min_zoom = 0 , max_zoom = 18 ,
85- max_native_zoom = None , attr = None , API_key = None ,
80+ max_native_zoom = None , attr = None ,
8681 detect_retina = False , name = None , overlay = False ,
8782 control = True , show = True , no_wrap = False , subdomains = 'abc' ,
8883 tms = False , opacity = 1 , ** kwargs ):
@@ -95,16 +90,20 @@ def __init__(self, tiles='OpenStreetMap', min_zoom=0, max_zoom=18,
9590 self ._env = ENV
9691
9792 tiles_flat = '' .join (tiles .lower ().strip ().split ())
98- if tiles_flat in ('cloudmade' , 'mapbox' ) and not API_key :
99- raise ValueError ('You must pass an API key if using Cloudmade'
100- ' or non-default Mapbox tiles.' )
93+ if tiles_flat in {'cloudmade' , 'mapbox' , 'mapboxbright' , 'mapboxcontrolroom' }:
94+ # added in May 2020 after v0.11.0, remove in a future release
95+ raise ValueError (
96+ 'Built-in templates for Mapbox and Cloudmade have been removed. '
97+ 'You can still use these providers by passing a URL to the `tiles` '
98+ 'argument. See the documentation of the `TileLayer` class.'
99+ )
101100 templates = list (self ._env .list_templates (
102101 filter_func = lambda x : x .startswith ('tiles/' )))
103102 tile_template = 'tiles/' + tiles_flat + '/tiles.txt'
104103 attr_template = 'tiles/' + tiles_flat + '/attr.txt'
105104
106105 if tile_template in templates and attr_template in templates :
107- self .tiles = self ._env .get_template (tile_template ).render (API_key = API_key ) # noqa
106+ self .tiles = self ._env .get_template (tile_template ).render ()
108107 attr = self ._env .get_template (attr_template ).render ()
109108 else :
110109 self .tiles = tiles
0 commit comments