I would like to be able draw a rectangle on an interactive map and use the coordinates of the corners of the rect in subsequent computations.
These are the (im)possible options I currently have on the radar, but sadly none of them really does what I’m looking for:
-
ipyleaflet has exactly the functionality I’m looking for. One can draw rectangles and with the
DrawControl
andon_draw
callback functions, you are able to retrieve the coordinates of the drawn rect. However, as far as I can see streamlit does unfortunately not work with ipyleaflet. ipyleaflet seems to work great in jupyter notebooks - AFAIK the streamlit mapbox
st.map
does not provide the functionality of drawing a rect at all. Or does it and I just couldn’t find it? - While the geemap streamlit app by Qiusheng Wu is really awesome, I feel like downloading and uploading the geojson of the rectangle is a dirty workaround and UX killer I honestly would like to avoid in 2022.
Does anyone know how to achieve the described behavior?
(More context: I built this little app which computes a 3d-printable STL file based on a geojson rectangle, which works great with ipyleaflet in a jupyter notebook. However, I would love to port this to streamlit and share it via streamlit-cloud.)