DII
DII

Reputation: 1

Folium does not display all pop up markers from my list

I am creating simple map with python/ folium with 3 pop ups. My list is:

LON,LAT,NAME,STATUS
25.109215,55.204213,XXXXXX,XXXXX
29.371942,47.976830,XXXX,XXXX
29.370726,47.973012,XXXXX,XXXXX

My code is:

import folium
import pandas

data = pandas.read_csv("test2.txt")
lat = list(data["LON"])
lon = list(data["LAT"])
name = list(data["NAME"])
stat = list(data["STATUS"])

map = folium.Map(location=[24.771901, 55.528385], zoom_start=7)

fg = folium.FeatureGroup(name="My Map")

for lt, ln, na in zip(lat, lon, name):
    fg.add_child(folium.Marker(location=[lt, ln], popup=na, icon=folium.Icon(color='green')))
map.add_child(fg)
map.save("Map3.html")

...but I get only 1 pop up from the first line of my list. Any idea why I can get all 3 pop ups?

Upvotes: 0

Views: 2109

Answers (1)

Naman Khard
Naman Khard

Reputation: 41

To display values written under single quotes as popup, you need to pass popup as:

 popup=folium.Popup(str(na),parse_html=True)

Try this and it will definitely work.

Upvotes: 2

Related Questions