-
Dear Qiusheng, I have two situations:
I am trying to write a ChinaFlood monitor app by streamlit and leafmap (https://github.com/CUG-Flood/ChinaFloodWeb). Above two problems are the most chanlleging technique for me. Could you give some guidance how to implement it? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Unfortunately, streamlit only supports folium, which does not support bidirectional functionality. It is impossible to get mouse clicking coordinates programmatically. See python-visualization/folium#1402 The recommended way is to use voila or solara. Voila: Solara: |
Beta Was this translation helpful? Give feedback.
-
Video tutorial: https://youtu.be/_VK10mjwpWI |
Beta Was this translation helpful? Give feedback.
-
Thank u. I will have a try. |
Beta Was this translation helpful? Give feedback.
-
It seems that import folium
import streamlit as st
from streamlit_folium import st_folium
# import leafmap.foliumap as leafmap
# from floodmap import *
st.set_page_config(layout="wide")
loc_cug = [30.46001618003947, 114.61223316513498]
col1, col2 = st.columns(2)
with col1:
m = folium.Map(location=loc_cug, zoom_start=16)
folium.Marker(loc_cug, popup="CUG", tooltip="CUG").add_to(m)
st_data = st_folium(m, width=1200)
with col2:
st_data |
Beta Was this translation helpful? Give feedback.
-
It seems that import folium
import streamlit as st
from streamlit_folium import st_folium
import leafmap.foliumap as leafmap
# from floodmap import *
st.set_page_config(layout="wide")
loc_cug = [30.46001618003947, 114.61223316513498]
col1, col2 = st.columns(2)
with col1:
# m = folium.Map(location=loc_cug, zoom_start=16)
Map = leafmap.Map(location=loc_cug, zoom_start=16)
# Map.add_xy_data(stationInfo, x="lon", y="lat", layer_name="sites")
folium.Marker(loc_cug, popup="CUG", tooltip="CUG").add_to(Map)
st_data = st_folium(Map, width=1200)
with col2:
st_data |
Beta Was this translation helpful? Give feedback.
Unfortunately, streamlit only supports folium, which does not support bidirectional functionality. It is impossible to get mouse clicking coordinates programmatically. See python-visualization/folium#1402
The recommended way is to use voila or solara.
Voila:
Solara: