提升值错误('自定义文件必须具有属性')

问题描述 投票:1回答:1

这是我编写的用于在python中使用folium生成地图的源代码

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'))

不幸的是,PyCharm给出了以下错误:

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 .

在execfile exec(compile(contents +“\ n”,file,'exec'),glob,loc)中输入文件“/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py”,第18行。

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('自定义切片必须具有归属。')ValueError:自定义切片必须具有归属。进程以退出代码1结束

python-3.x pycharm folium
1个回答
0
投票

传递自定义切片时,您始终需要指定attr参数。这可以是任何String,也可以是html标签。它旨在为任何提供瓷砖的人提供信贷。

例如,创建这样的地图

map = folium.Map(tiles="tiles/{z}/{x}/{y}.png", attr="<a href=https://endless-sky.github.io/>Endless Sky</a>")

将生成一个带有可点击链接的页脚:enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.