import folium
from folium.features import ClickForLatLng, ClickForMarker, LatLngPopup
ClickForMarker
Lets you create markers on each click¶folium.Map().add_child(ClickForMarker())
Click on the map to see the effects
You can customize the popup by providing a string, an IFrame object or an Html object. You can include the latitude and longitude of the marker by using ${lat}
and ${lng}
.
folium.Map().add_child(ClickForMarker("<b>Lat:</b> ${lat}<br /><b>Lon:</b> ${lng}"))
Click on the map to see the effects
LatLngPopup
lets you create a simple popup at each click¶folium.Map().add_child(LatLngPopup())
Click on the map to see the effects
ClickForLatLng
lets you copy coordinates to your browser clipboard¶folium.Map().add_child(ClickForLatLng(format_str='"[" + lat + "," + lng + "]"'))
Click on the map to see the effects
If you want to collect back the information in python, you may (install and) import the clipboard library :
> import clipboard
> clipboard.paste()
[-43.580391,-123.824467]