Uncomment the following line to install geemap if needed.
# !pip install geemap
import ee
import geemap
import ipywidgets as widgets
from ipyleaflet import WidgetControl
Map = geemap.Map()
Map
# Add an output widget to the map
output_widget = widgets.Output(layout={'border': '1px solid black'})
output_control = WidgetControl(widget=output_widget, position='bottomright')
Map.add_control(output_control)
# Capture user interaction with the map
def handle_interaction(**kwargs):
latlon = kwargs.get('coordinates')
if kwargs.get('type') == 'click':
Map.default_style = {'cursor': 'wait'}
# xy = ee.Geometry.Point(latlon[::-1])
with output_widget:
output_widget.clear_output()
print(latlon)
Map.default_style = {'cursor': 'pointer'}
Map.on_interaction(handle_interaction)