Advertisement
safwan092

Untitled

Dec 2nd, 2023
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. import folium
  2. import streamlit as st
  3. from streamlit_folium import st_folium
  4.  
  5. if 'button' not in st.session_state:
  6. st.session_state.button = False
  7.  
  8. def click_button():
  9. st.session_state.button = not st.session_state.button
  10.  
  11.  
  12. st.title("Interactive Page")
  13. st.write("Welcome to this App")
  14. st.button('Click me', on_click=click_button)
  15.  
  16.  
  17. if st.session_state.button:
  18. st.title("")
  19. # The message and nested widget will remain on the page
  20. m = folium.Map(location=[21.502771, 39.247194], zoom_start=18)
  21. folium.Marker = m.add_child(folium.ClickForMarker("<b>Lat: </b> ${lat}<br/><b>Lon: </b> ${lng}<br><b>Altitude:</b> 10.00 m"))
  22. output = st_folium(m, width=700, height=500)
  23. if output["last_clicked"] is not None:
  24. output["last_clicked"]["alti"] = 10
  25. latitude_1_last_clicked = round(output["last_clicked"]["lat"], 6)
  26. longitude_1_last_clicked = round(output["last_clicked"]["lng"], 6)
  27. altitude_1_last_clicked = output["last_clicked"]["alti"]
  28. st.write("• Latitude:", latitude_1_last_clicked)
  29. st.write("• Latitude:", longitude_1_last_clicked)
  30. st.write("• Altitude:", altitude_1_last_clicked, "meter")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement