Welcome to the community and thanks for your thoughtful question!
Unfortunately, as of now, Streamlit-Folium does not support capturing marker drag events (like “onDrag”) or updating marker positions in real-time via callbacks. The on_change callback in Streamlit-Folium is only triggered by Streamlit widget changes, not by direct map interactions such as dragging markers. Accessing marker positions from map._children won’t reflect live updates, since Folium itself is static and doesn’t provide bi-directional communication for marker drags in Streamlit apps. This limitation is discussed in several community threads and is a known gap in the current integration between Folium and Streamlit components.
If you need true interactivity (e.g., capturing drag events and updating coordinates), you would need to build a custom Streamlit component using Leaflet.js directly, which allows for JavaScript event handling, but this means you can’t use Folium’s Python API for those markers. There is no built-in DraggableMarker class with an “onDrag” callback in Streamlit-Folium or Folium for Streamlit. For now, the only workaround is to use a custom component or wait for future updates that might add this feature. If you have a minimum reproducible example or repo, please share it so others can help brainstorm! Community members, feel free to jump in if you’ve found a creative workaround.
Sources: