Hi Synode! Lets see if I can make myself clear: 
version: 2020/06/05
MAIN IDEA
Being able of filtering data visualization in Folium. (in the example I code in github, filtering CircleMarker() by variables “year” and “type”.). I leave a cleaner version, with no filtering components and plugins of Folium:
import folium
import pandas as pd
# Create df
data = {"id": ["01", "02", "03", "04", "05", "06"],
"year": [2018, 2019, 2020, 2019, 2019, 2018],
"type": ["type_a", "type_a", "type_b", "type_b", "type_c", "type_c"],
"latitude": [-12.1, -12.2, -12.3, -12.4, -12.5, -12.6],
"longitude": [-72.1, -72.2, -72.3, -72.4, -72.5, -72.6]}
# Respects order
df = pd.DataFrame(data, columns=["id", "year", "type", "latitude", "longitude"])
def _plot_dot(point, map_element,
radius=4, weight=1,color='black'):
# group_base = folium.FeatureGroup(name="year_Sin year").add_to(map_element)
place = map_element
folium.CircleMarker(location=[point["latitude"], point["longitude"]], radius=radius, weight=weight,
color=color, fill=True,
fill_color="red",
fill_opacity=0.9,
tooltip=f'<b>id: </b>{str(point["id"])}'
f'<br></br>'f'<b>year: </b>{str(point["year"])}'
f'<br></br>'f'<b>type: </b>{str(point["type"])}',
popup= f'<b>id: </b>{str(point["id"])}'
f'<br></br>'f'<b>year: </b>{str(point["year"])}'
f'<br></br>'f'<b>type: </b>{str(point["type"])}'
).add_to(place)
def generate_map(data, filename=None):
map_element = folium.Map(tiles='cartodbpositron')
data.apply(_plot_dot, axis=1, args=[map_element])
map_element.save(filename, close_file=True)
return map_element
if __name__ == "__main__":
map_1 = generate_map(df, 'test_maps.html')
HOW? JUST WITH FOLIUM CONTROLS: DONE
At this moment, Folium permits doing this, with one variable, with layers and LayerControl():
1)https://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/FeatureGroup.ipynb
With two variables using FeatureGroupSubGroup(), but the layers don’t cross between variables.
2)https://github.com/python-visualization/folium/issues/1331
HOW? JUST WITH STREAMLIT CONTROLS: TO BE DONE
What I imagine here, without understanding yet Streamlit Components, is to be able of filtering with st.slider() or st.multiselect() or whatever control of Streamlit, making queries to the map. No need of Folium layers. Streamlit components at first, will do all the work.
Basically, being able of doing with Folium maps, what can be achieve with st.map(): https://docs.streamlit.io/en/latest/getting_started.html#draw-charts-and-maps
Later, maybe, we can study the relation of using at the same time both filtering components of Folium and Streamlit, but at first, I think we should start with an easier and simpler case.
NOTES
- I dont know yet from where Streamlit gets access to Folium map data. I have done to the CircleMarkers, tootips and popups.
COMMENTS