The Folium documentation is incomplete at this time: https://folium.readthedocs.io/en/latest/
According to the index of the incomplete docs Legends and Layers are, or will be supported. I've spent some time looking for examples on the web but have found nothing so far. If anyone has any idea how to create these things, or can point me to a document or tutorial I would be most grateful.
You can add a legend quite easily;
#specify the min and max values of your data
colormap = branca.colormap.linear.YlOrRd_09.scale(0, 8500)
colormap = colormap.to_step(index=[0, 1000, 3000, 5000, 8500])
colormap.caption = 'Incidents of Crime in Victoria (year ending June 2018)'
colormap.add_to(world_map)
You can see my complete example here;
Folium Map with legend example
Folium now has a way to add an image easily with version 0.15.
from folium.plugins import FloatImage
image_file = 'image.PNG'
FloatImage(image_file, bottom=0, left=86).add_to(mymap)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With