Manghud
Manghud

Reputation: 1376

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

to put some markers in map

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 . 

File "/Users/kuldeep/PycharmProjects/webmap/venv/lib/python3.7/site-packages/folium/folium.py", line 349, in 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: Custom tiles must have an attribution.

Process finished with exit code 1 raise ValueError('Custom tiles must have an attribution.') ValueError: Custom tiles must have an attribution. Process finished with exit code 1

Upvotes: 6

Views: 14762

Answers (2)

Rushil Kumar
Rushil Kumar

Reputation: 21

Try this instead:

map3 = folium.Map(location=[53.073635, 8.806422], zoom_start=15, tiles='Stamen Terrain')

It results into:

("Stream Terreain" -> "Stamen Terrain")

Upvotes: 1

MCO
MCO

Reputation: 1257

When passing custom tiles, you always need to specify the attr argument. This can be any String, also a html tag. It's intended for giving credit to whoever provided the tiles.

For example, creating a map like this

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

will produce a Footer with clickable link: enter image description here

Upvotes: 7

Related Questions