-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
When using xyzservices with Mapbox loading tiles fails.
To Reproduce
xyz.MapBox["accessToken"] = Config.mapbox_token
tiles = xyz.MapBox
m = folium.Map(location=[45.5236, -122.6750],
tiles=tiles,
attr= "Mapbox")
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
- Browser chrome
- Jupyter Notebook
- Python 3.10.6
- folium 0.13.0
- branca 0.6.0
**Error Message**
KeyError Traceback (most recent call last)
File ~/....venv/lib/python3.10/site-packages/xyzservices/lib.py:44, in Bunch.getattr(self, key)
43 try:
---> 44 return self.getitem(key)
45 except KeyError:KeyError: 'lower'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
Cell In[36], line 4
1 xyz.MapBox["accessToken"] = Config.mapbox_token
2 tiles = tiles
----> 4 m = folium.Map(location=[45.5236, -122.6750],
5 tiles=tiles,
6 attr= "Mapbox")File ~/.../.venv/lib/python3.10/site-packages/folium/folium.py:286, in Map.init(self, location, width, height, left, top, position, tiles, attr, min_zoom, max_zoom, zoom_start, min_lat, max_lat, min_lon, max_lon, max_bounds, crs, control_scale, prefer_canvas, no_touch, disable_3d, png_enabled, zoom_control, **kwargs)
283 self.objects_to_stay_in_front = []
285 if tiles:
--> 286 tile_layer = TileLayer(tiles=tiles, attr=attr,
287 min_zoom=min_zoom, max_zoom=max_zoom)
288 self.add_child(tile_layer, name=tile_layer.tile_name)File ~/.../.venv/lib/python3.10/site-packages/folium/raster_layers.py:84, in TileLayer.init(self, tiles, min_zoom, max_zoom, max_native_zoom, attr, detect_retina, name, overlay, control, show, no_wrap, subdomains, tms, opacity, **kwargs)
77 def init(self, tiles='OpenStreetMap', min_zoom=0, max_zoom=18,
78 max_native_zoom=None, attr=None,
79 detect_retina=False, name=None, overlay=False,
80 control=True, show=True, no_wrap=False, subdomains='abc',
81 tms=False, opacity=1, **kwargs):
83 self.tile_name = (name if name is not None else
---> 84 ''.join(tiles.lower().strip().split()))
85 super(TileLayer, self).init(name=self.tile_name, overlay=overlay,
86 control=control, show=show)
87 self._name = 'TileLayer'File ~/.../.venv/lib/python3.10/site-packages/xyzservices/lib.py:46, in Bunch.getattr(self, key)
44 return self.getitem(key)
45 except KeyError:
---> 46 raise AttributeError(key)AttributeError: lower