I have the cluster defined, which I would like to have visible just when hovered (or clicked), therefore I tried to combine it with tooltip or popup. Unfortunately, it didn't work.
My code looks as follows:
df = pd.read_csv("survey.csv")
for i,row in df.iterrows():
lat =df.at[i, 'lat']
lng = df.at[i, 'lng']
sp = df.at[i, 'sp']
phone = df.at[i, 'phone']
popup = '<b>Phone: </b>' + str(df.at[i,'phone'])
job_range = folium.Circle([lat,lng],
# 20 miles = 32186m
radius=32186,
popup= df.at[i, 'sp'],
tooltip = sp + ' - Job limits',
color='#1565C0',
fill=True,
fill_color='#42A5F5',
opacity=0.2,
fill_opacity=0.25,
)
fs.add_child(
folium.Marker(location=[lat,lng],
tooltip='<strong>Contact surveyor</strong>',
#tooltip = job_range,
tooltip = popup,
popup=popup,
#popup = job_range,
icon = folium.Icon(color='black', icon='glyphicon-user'
)
)
)
map.add_child(fs)
Another code looks like this:
df = pd.read_csv("survey.csv")
for i,row in df.iterrows():
lat =df.at[i, 'lat']
lng = df.at[i, 'lng']
sp = df.at[i, 'sp']
phone = df.at[i, 'phone']
popup = '<b>Phone: </b>' + str(df.at[i,'phone'])
fs.add_child(
folium.Marker(location=[lat,lng],
tooltip='<strong>Contact surveyor</strong>',
#tooltip = job_range,
#tooltip = popup,
popup=popup,
#popup = job_range,
icon = folium.Icon(color='black', icon='glyphicon-user'
)
)
)
fs.add_child (
folium.Marker(location=[lat,lng],
popup=popup,
icon = folium.DivIcon(html="<b>" + sp + "</b>", class_name="mapText")
)
)
fs.add_child (
folium.Circle([lat,lng],
# 20 miles = 32186m
radius=32186,
popup= df.at[i, 'sp'],
tooltip = sp + ' - Job limits',
color='#1565C0',
fill=True,
fill_color='#42A5F5',
opacity=0.2,
fill_opacity=0.25,
)
)
map.add_child(fs)
But in this case, I see all circles overlapping each other.
I saw other solutions, which in general didn't help
Is there an opportunity to have the circles visible just when the markers are hovered & clicked?