无法使用 folium 创建地图

Ca not create a map using folium

我的代码运行:

import folium
map = folium.Map(location=[38.58, -99.09],
                 zoom_start=6,
                 tiles="Mapbox Bright")
map.save("Map1.html")

我将其保存为 map1.py 并使用 Visual Studio 代码将其保存为 运行 我得到的错误:

Traceback (most recent call last):
File "d:/development/Python/Python/35-web-app/map1.py", line 2, in <module>
    map = folium.Map(location=[38.58, -99.09], zoom_start=6, tiles="Mapbox Bright")
  File "C:\Users\hirusha\AppData\Local\Programs\Python\Python38\lib\site-packages\folium\folium.py", line 288, in __init__
    tile_layer = TileLayer(tiles=tiles, attr=attr,
  File "C:\Users\hirusha\AppData\Local\Programs\Python\Python38\lib\site-packages\folium\raster_layers.py", line 95, in __init__
    raise ValueError(
ValueError: Built-in templates for Mapbox and Cloudmade have been removed. You can still use these providers by passing a URL to the `tiles` argument. See the documentation of the `TileLayer` class.

我可以去哪里?它必须对我的代码做些什么吗?为什么这不起作用?

您不能再使用 tiles="Mapbox Bright",因为 Mapbox 和 Cloudmade 的内置模板已被删除。

这是文档https://python-visualization.github.io/folium/modules.html Ctrl+F 并查找 class folium.raster_layers.TileLayer 以获取更多信息

https://gis.stackexchange.com/questions/203062/using-mapbox-tiles-with-folium

找到类似的讨论

将“Mapbox Bright”替换为“Stamen Terrain”