streamlit-folium
streamlit-folium copied to clipboard
Draw doesn't work on timeseries figure
trafficstars
I think this is similar to #161 which was closed by #162. The error experienced is the same as #161 where after drawing icons the tool doesn't reset and the returned object doesn't include the selected points.
Reproduce with:
folium 0.15.1
streamlit 1.29.0
streamlit-folium 0.17.4
and
import folium
from streamlit_folium import st_folium
from folium.plugins import Draw
import streamlit as st
m = folium.Map(location=[35.68159659061569, 139.76451516151428], zoom_start=16)
# Lon, Lat order.
lines = [
{
"coordinates": [
[139.76451516151428, 35.68159659061569],
[139.75964426994324, 35.682590062684206],
],
"dates": ["2017-06-02T00:00:00", "2017-06-02T00:10:00"],
"color": "red",
},
]
features = [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": line["coordinates"],
},
"properties": {
"times": line["dates"],
},
}
for line in lines
]
folium.plugins.TimestampedGeoJson(
{
"type": "FeatureCollection",
"features": features,
},
period="PT1M",
add_last_point=True,
).add_to(m)
Draw(export=True).add_to(m)
m.save('draw.html')
c1, c2 = st.columns(2)
with c1:
output = st_folium(m, width=700, height=500)
with c2:
st.write(output)
Note all we get expected behaviour with:
folium 0.14.0
streamlit 1.29.0
streamlit-folium 0.14.0
Note this behaviour still exists with
folium==0.15.1
streamlit==1.31.1
streamlit-folium==0.18.0
in Python 3.12.2
Here is the console error message