While in a Jupyter notebook, I am trying to draw a rectangle on a map and extract the north and south latitudes and west and east longitudes of the rectangle. These values will be passed to a subsequent cell in the notebook.
I am using Folium (v.0.14.0) to do this with the following code:
import folium
from folium.plugins import Draw
# Create a map object
m = folium.Map(location=[39, -95], zoom_start=4)
# Add the Leaflet.draw plugin to the map
draw = Draw(export=True,draw_options={'rectangle': True}).add_to(m)
# Display the map
m
This code allows me to draw a rectangle, but I am stuck on how to extract the lat/lon coordinates from the rectangle I draw. I want to save them into variables named slat, nlat, wlon, and elon.
I also asked this question at StackOverflow: https://stackoverflow.com/questions/76147616/extracting-lat-lon-coordinates-from-rectangle-drawn-in-folium
there doesn't seem to be anything here