Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw doesn't work on timeseries figure #167

Open
this-josh opened this issue Dec 14, 2023 · 2 comments
Open

Draw doesn't work on timeseries figure #167

this-josh opened this issue Dec 14, 2023 · 2 comments
Labels

Comments

@this-josh
Copy link
Contributor

this-josh commented Dec 14, 2023

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.

SCR-20231214-hxlj

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
@this-josh
Copy link
Contributor Author

Note this behaviour still exists with

folium==0.15.1
streamlit==1.31.1
streamlit-folium==0.18.0

in Python 3.12.2

@this-josh
Copy link
Contributor Author

Here is the console error message

SCR-20240228-invd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants