naheliegend
naheliegend

Reputation: 197

Python Folium: how to create a folium.map.Marker() with multiple popup text lines?

Is there an possibility to create a second or third line for the popup text including adjustment of the width and height of the popup box?

Found something on GitHub, but is that the only way? https://github.com/python-visualization/folium/pull/294

Upvotes: 4

Views: 17077

Answers (1)

sentence
sentence

Reputation: 8903

You can put html code inside a popup by means of IFrame:

import folium

m = folium.Map(location=[43.775, 11.254],
               zoom_start=5)

html = '''1st line<br>
2nd line<br>
3rd line'''

iframe = folium.IFrame(html,
                       width=100,
                       height=100)

popup = folium.Popup(iframe,
                     max_width=100)

marker = folium.Marker([43.775, 11.254],
                       popup=popup).add_to(m)
m

and you get:

enter image description here

Upvotes: 11

Related Questions