gboeing / osmnx-examples

Gallery of OSMnx tutorials, usage examples, and feature demonstations.
https://osmnx.readthedocs.io
MIT License
1.5k stars 519 forks source link

add required attribution for explores using CartoDB darkmatter tiles #73

Closed arjunbanker closed 9 months ago

arjunbanker commented 9 months ago

Currently, executing many of the examples in "11-interactive-web-mapping notebook with required attribution" yields this error: "ValueError: Custom tiles must have an attribution."

This diff resolves the error by adding the required "attr" param to the explore calls.

gboeing commented 9 months ago

@arjunbanker I'm not seeing this error with GeoPandas 0.13.x or 0.14.x. Can you provide a complete list of your package versions (such as with conda list) and the complete error traceback? Thanks.

arjunbanker commented 9 months ago

ah interesting. sure, adding the stack trace & package versions via pip list.

folium wasn't an environment dependency so i manually pip installed it (so it's likely latest @ 0.14) and wondering if that may be the underlying conflict?

from cell:

explore nodes and edges together in a single map

nodes, edges = ox.graph_to_gdfs(G) m = edges.explore(color="skyblue", tiles="cartodbdarkmatter") nodes.explore(m=m, color="pink", marker_kwds={"radius": 6})

execution stack: ValueError Traceback (most recent call last) /Users/arjunbanker/Development/learn/osmnx-examples/notebooks/11-interactive-web-mapping.ipynb Cell 8 line 3 1 # explore nodes and edges together in a single map 2 nodes, edges = ox.graph_to_gdfs(G) ----> 3 m = edges.explore(color="skyblue", tiles ="cartodbdarkmatter") 4 nodes.explore(m=m, color="pink", marker_kwds={" radius": 6}) File ~/.pyenv/versions/3.7/envs/myenv/lib/python3.11/site-packages/geopandas/geodataframe.py:2101, in GeoDataFrame.explore(self, *args, kwargs) 2099 @doc(_explore) 2100 def explore(self, *args, *kwargs): -> 2101 return _explore(self, args, kwargs) File ~/.pyenv/versions/3.7/envs/myenv/lib/python3.11/site-packages/geopandas/explore.py:371, in _explore(df, column, cmap, color, m, tiles, attr, tooltip, popup, highlight, categorical, legend, scheme, k, vmin, vmax, width, height, categories, classification_kwds, control_scale, marker_type, marker_kwds, style_kwds, highlight_kwds, missing_kwds, tooltip_kwds, popup_kwds, legend_kwds, map_kwds, kwargs) 368 map_kwds["max_zoom"] = tiles.get(" max_zoom", 18) 369 tiles = tiles.build_url(scale_factor="{r}") --> 371 m = folium.Map( 372 location=location, 373 control_scale=control_scale, 374 tiles=tiles, 375 attr=attr, 376 width=width, 377 height=height, 378 map_kwds, 379 ) ... (...) 147 **kwargs 148 ) ValueError: Custom tiles must have an attribution.

pip list:

Package Version


affine 2.4.0 appnope 0.1.3 asttokens 2.4.0 attrs 23.1.0 backcall 0.2.0 branca 0.6.0 certifi 2023.7.22 charset-normalizer 3.2.0 click 8.1.6 click-plugins 1.1.1 cligj 0.7.2 comm 0.1.4 contourpy 1.1.0 cycler 0.11.0 debugpy 1.8.0 decorator 5.1.1 executing 1.2.0 Fiona 1.9.4.post1 folium 0.14.0 fonttools 4.42.0 GDAL 3.7.2 geographiclib 2.0 geopandas 0.13.2 geopy 2.3.0 idna 3.4 igraph 0.10.8 ipykernel 6.25.2 ipython 8.15.0 jedi 0.19.0 Jinja2 3.1.2 joblib 1.3.2 jupyter_client 8.3.1 jupyter_core 5.3.1 kiwisolver 1.4.4 mapclassify 2.6.0 MarkupSafe 2.1.3 matplotlib 3.7.2 matplotlib-inline 0.1.6 nest-asyncio 1.5.7 networkx 3.1 numpy 1.25.2 osmnx 1.6.0 overpy 0.6 packaging 23.1 pandas 2.0.3 parso 0.8.3 pexpect 4.8.0 pickleshare 0.7.5 Pillow 10.0.0 pip 23.2.1 platformdirs 3.10.0 prompt-toolkit 3.0.39 psutil 5.9.5 ptyprocess 0.7.0 pure-eval 0.2.2 Pygments 2.16.1 pyparsing 3.0.9 pyproj 3.6.0 python-dateutil 2.8.2 pytz 2023.3 pyzmq 25.1.1 rasterio 1.3.8 requests 2.31.0 scikit-learn 1.3.0 scipy 1.11.1 setuptools 65.6.3 shapely 2.0.1 six 1.16.0 snuggs 1.4.7 stack-data 0.6.2 texttable 1.6.7 threadpoolctl 3.2.0 tornado 6.3.3 traitlets 5.10.0 tzdata 2023.3 urllib3 2.0.4 wcwidth 0.2.6

On Sun, Sep 17, 2023 at 11:35 AM Geoff Boeing @.***> wrote:

@arjunbanker https://github.com/arjunbanker I'm not seeing this error with GeoPandas 0.13.x or 0.14.x. Can you provide a complete list of your package versions (such as with conda list) and the complete error traceback? Thanks.

— Reply to this email directly, view it on GitHub https://github.com/gboeing/osmnx-examples/pull/73#issuecomment-1722538199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEVCJTGX3EEF5FDFDYLQ3X247I5ANCNFSM6AAAAAA42RJ6XY . You are receiving this because you were mentioned.Message ID: @.***>

gboeing commented 9 months ago

I'm still unable to reproduce this error with OSMnx 1.6.0, GeoPandas 0.13.2 or 0.14.0, and Folium 0.14.0. If this is a conflict with a recent version of one of the dependencies, I cannot see where it comes from. Can you try another environment to see if you can reproduce it elsewhere? For example, try Binder.

arjunbanker commented 9 months ago

appreciate the link to Binder! the issue doesn't seem to reproduce there, so it was likely some local dependency issue on my end. closing this out