How do I make the radius of my map dynamic using a select box?

I am trying to add a side select box which lets the user pick a radius they want displayed on their folium map, however I do not know how I then relate this to my Folium map. In the default landing page I want to show the map with no radius, present in the below code. I have created three additional maps which have the three different radius markers, so that the if statement would pull up the relevant one when the user selects the corresponding input.

#add_select = st.sidebar.selectbox("What radius do you want to assign?",
                                  ("1 mile", "2 miles","3 miles"))

#Map code

lat= 51.64270
lon = -0.20747
map_fs = folium.Map(location=[lat, lon], zoom_start=11.2)

df.apply(lambda row:folium.Circle(location=[row["longitude"], row["latitude"]], Popup=row['cook'])
                                             .add_to(map_fs), axis=1)

df.apply(lambda row: folium.Marker(location=[row["longitude"], row["latitude"]],
    popup=row['C1'],
    icon=folium.Icon(color='red', icon='Default', prefix = 'fa'),
).add_to(map_fs), axis = 1)

folium_static(map_fs)

if add_select == '1 mile':
    folium_static(map_fs1)
elif add_select == '2 mile':
    folium_static(map_fs2)
elif add_select == '3 mile':
    folium_static(map_fs2)

Thanks!

It appears this was answered on StackOverflow:

Thank you! It was indeed.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.