Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xyzservices Implementation does not support Mapbox token #1678

Closed
Insighttful opened this issue Dec 6, 2022 · 3 comments
Closed

xyzservices Implementation does not support Mapbox token #1678

Insighttful opened this issue Dec 6, 2022 · 3 comments

Comments

@Insighttful
Copy link

Insighttful commented Dec 6, 2022

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

@Insighttful
Copy link
Author

Related: #1498

@Insighttful
Copy link
Author

Apologies, I see now this is not yet released.

@Conengmo
Copy link
Member

Conengmo commented Dec 6, 2022

No worries. It will be included in the upcoming 0.14.0 release indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants