提高值错误('Custom files must have an attribution')
raise Value Error('Custom files must have an attribution')
This is the source code I wrote to generate maps with folium in python
import folium
map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15,
tiles='Stream Terreain')
在地图上放置一些标记
folium.Marker(location=[53.073635, 8.806422], popup='Ich bin verloren',
icon=folium.Icon(icon='cloud')).add_to(map3)
folium.Marker(location=[53.073600, 8.806400], popup='Hej, ich bin da',
icon=folium.Icon(icon='cloud')).add_to(map3)
print(map3.save('test3.html'))
Unfortunately, PyCharm gives following error:
Connected to pydev debugger (build 182.4129.34 Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1664, in <module> main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) .
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script .
File"/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) .
File "/Users/kuldeep/PycharmProjects/webmap/webmap_2.py", line 2, in <module> map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15, tiles='Stream Terreain') .
File "/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/folium.py", line 278, in __init__
subdomains=subdomains .
文件“/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/folium.py”,第 349 行,在 add_tile_layer
no_wrap=no_wrap)。
File "/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/raster_layers.py", line 113, in __init__ .
raise ValueError('Custom tiles must have an attribution.')
ValueError:自定义图块必须有属性。
进程已完成,退出代码为 1
提高 ValueError('Custom tiles must have an attribution.')
ValueError:自定义磁贴必须具有属性。
进程已完成,退出代码为 1
传递自定义图块时,您始终需要指定 attr
参数。这可以是任何字符串,也可以是 html 标签。它旨在为提供图块的人提供荣誉。
例如,创建这样的地图
map = folium.Map(tiles="tiles/{z}/{x}/{y}.png", attr="<a href=https://endless-sky.github.io/>Endless Sky</a>")
将生成可点击的页脚 link:
试试这个:
map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15, tiles='Stamen Terrain')
结果为:
("Stream Terreain" -> "Stamen Terrain")
This is the source code I wrote to generate maps with folium in python
import folium
map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15,
tiles='Stream Terreain')
在地图上放置一些标记
folium.Marker(location=[53.073635, 8.806422], popup='Ich bin verloren',
icon=folium.Icon(icon='cloud')).add_to(map3)
folium.Marker(location=[53.073600, 8.806400], popup='Hej, ich bin da',
icon=folium.Icon(icon='cloud')).add_to(map3)
print(map3.save('test3.html'))
Unfortunately, PyCharm gives following error:
Connected to pydev debugger (build 182.4129.34 Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1664, in <module> main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) .
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script .
File"/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) .
File "/Users/kuldeep/PycharmProjects/webmap/webmap_2.py", line 2, in <module> map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15, tiles='Stream Terreain') .
File "/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/folium.py", line 278, in __init__
subdomains=subdomains .
文件“/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/folium.py”,第 349 行,在 add_tile_layer no_wrap=no_wrap)。
File "/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/raster_layers.py", line 113, in __init__ .
raise ValueError('Custom tiles must have an attribution.')
ValueError:自定义图块必须有属性。
进程已完成,退出代码为 1 提高 ValueError('Custom tiles must have an attribution.') ValueError:自定义磁贴必须具有属性。 进程已完成,退出代码为 1
传递自定义图块时,您始终需要指定 attr
参数。这可以是任何字符串,也可以是 html 标签。它旨在为提供图块的人提供荣誉。
例如,创建这样的地图
map = folium.Map(tiles="tiles/{z}/{x}/{y}.png", attr="<a href=https://endless-sky.github.io/>Endless Sky</a>")
将生成可点击的页脚 link:
试试这个:
map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15, tiles='Stamen Terrain')
结果为:
("Stream Terreain" -> "Stamen Terrain")