Drag a marker
Create a draggable Marker
This source code of this example is adapted from the MapLibre GL JS example - Create a draggable Marker.
Uncomment the following line to install leafmap if needed.
In [ ]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [ ]:
Copied!
import leafmap.maplibregl as leafmap
import leafmap.maplibregl as leafmap
In [ ]:
Copied!
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
In [ ]:
Copied!
m = leafmap.Map(center=[0, 0], zoom=2, style="streets")
m.add_marker(lng_lat=[0, 0], options={"draggable": True})
m
m = leafmap.Map(center=[0, 0], zoom=2, style="streets")
m.add_marker(lng_lat=[0, 0], options={"draggable": True})
m
