Skip to content

Commit 79403fe

Browse files
authored
Remove deprecated built-in tilesets (#1339)
1 parent fd9b659 commit 79403fe

12 files changed

Lines changed: 13 additions & 38 deletions

File tree

folium/folium.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,16 @@ class Map(MacroElement):
150150
151151
Examples
152152
--------
153-
>>> m = folium.Map(location=[45.523, -122.675],
154-
... width=750, height=500)
155-
>>> m = folium.Map(location=[45.523, -122.675],
156-
tiles='Mapbox Control Room')
157-
>>> m = folium.Map(location=(45.523, -122.675), max_zoom=20,
158-
tiles='Cloudmade', API_key='YourKey')
153+
>>> m = folium.Map(location=[45.523, -122.675], width=750, height=500)
154+
>>> m = folium.Map(location=[45.523, -122.675], tiles='cartodb positron')
159155
>>> m = folium.Map(
160156
... location=[45.523, -122.675],
161157
... zoom_start=2,
162-
... tiles='http://{s}.tiles.mapbox.com/v3/mapbox.control-room/{z}/{x}/{y}.png',
158+
... tiles='https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=mytoken',
163159
... attr='Mapbox attribution'
164160
...)
165161
166-
"""
162+
""" # noqa
167163
_template = Template(u"""
168164
{% macro header(this, kwargs) %}
169165
<meta name="viewport" content="width=device-width,

folium/raster_layers.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

folium/templates/tiles/cloudmade/attr.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/cloudmade/tiles.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/mapbox/attr.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/mapbox/tiles.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/mapboxbright/attr.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/mapboxbright/tiles.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/mapboxcontrolroom/attr.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

folium/templates/tiles/mapboxcontrolroom/tiles.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)