Reputation: 111
I have a folium map on which I am trying to add a textbox which I would always like on screen with additional details and can't seem to find a way to get one to popup.
I tried something like a colormap
import branca.colormap as cm
colormap = cm.linear.Set1.scale(0, 35).to_step(10)
colormap.caption = 'A colormap caption'
map.add_child(colormap)
or an image by the following
FloatImage(img_link, bottom=60, left=70).add_to(map)
It seems that adding a text box with 4/5 lines of information should be pretty simple, but I can't seem to find a way to overlay one over Folium. So I really hope someone could point me to the right direction.
The one idea I possibly had left would be to add in iFrame, but not too sure how I could get that to work.
Upvotes: 1
Views: 13103
Reputation: 31
The following code should work:
import folium
from folium import IFrame
text = 'your text here'
iframe = folium.IFrame(text, width=700, height=450)
popup = folium.Popup(iframe, max_width=3000)
Text = folium.Marker(location=[lat,lon], popup=popup,
icon=folium.Icon(icon_color='green'))
Yourmap.add_child(Text)
Yourmap.save('mymap.html')
Upvotes: 3