Skip to main content
Ctrl+K

Folium

  • Home
  • Getting started
  • User guide
  • Advanced guide
  • API reference
  • GitHub
  • Home
  • Getting started
  • User guide
  • Advanced guide
  • API reference
  • GitHub

Section Navigation

  • Map
  • UI elements
    • LayerControl
    • Popups
    • Icons
  • Raster layers
    • Tiles
    • ImageOverlay
    • VideoOverlay
    • WmsTileLayer
  • Vector layers
    • Circle and CircleMarker
    • PolyLine
    • Rectangle
    • Polygon
    • ColorLine
  • GeoJSON and choropleth
    • Using GeoJson
    • Using Choropleth
    • GeoJSON point features with markers
    • GeoJSON popup and tooltip
    • Using GeoPandas.GeoDataFrame in folium
    • Smoothing
  • Features
    • FitOverlays
    • Click-related classes
  • Plugins
    • Antpath
    • BoatMarker
    • BeautifyIcon
    • Draw
    • DualMap plugin
    • FeatureGroupSubGroup
    • FloatImage
    • Fullscreen
    • Geocoder
    • GroupedLayerControl
    • Heatmap
    • HeatMapWithTime
    • LocateControl
    • MarkerCluster
    • MiniMap
    • MeasureControl
    • MousePosition
    • OverlappingMarkerSpiderfier
    • Pattern plugins
    • PolygonFromEncoded
    • PolyLineFromEncoded
    • PolylineOffset
    • PolyLineTextPath
    • Realtime
    • ScrollZoomToggler
    • Search
    • SemiCircle
    • SideBySideLayers
    • TagFilterButton
    • Terminator
    • Timeline and TimelineSlider
    • TimeSliderChoropleth
    • TimestampedGeoJson
    • TreeLayerControl
    • Vector tiles using VectorGridProtobuf
    • TimestampedWmsTileLayers
  • User guide
  • Features
  • Click-related classes

Click-related classes#

ClickForMarker#

ClickForMarker lets you create markers on each click.

[2]:
folium.Map().add_child(
    folium.ClickForMarker()
)
[2]:
Make this Notebook Trusted to load map: File -> Trust Notebook

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}.

[3]:
folium.Map().add_child(
    folium.ClickForMarker("<b>Lat:</b> ${lat}<br /><b>Lon:</b> ${lng}")
)
[3]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Click on the map to see the effects

LatLngPopup#

LatLngPopup lets you create a simple popup at each click.

[4]:
folium.Map().add_child(
    folium.LatLngPopup()
)
[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Click on the map to see the effects

ClickForLatLng#

ClickForLatLng lets you copy coordinates to your browser clipboard.

[5]:
folium.Map().add_child(
    folium.ClickForLatLng(format_str='"[" + lat + "," + lng + "]"', alert=True)
)
[5]:
Make this Notebook Trusted to load map: File -> Trust Notebook

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]

previous

FitOverlays

next

Plugins

On this page
  • ClickForMarker
  • LatLngPopup
  • ClickForLatLng

This Page

  • Show Source
Folium version 0.19.5

© Copyright 2013-2025, Rob Story.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.16.1.

Built with the PyData Sphinx Theme 0.16.1.