I'm trying to create a clickable leaflet.js map using folium and Python.

After a previous query - answered here Geopandas/folium map not displaying - I've added the polygons.

But I'm getting a little bit lost in the documentation on what to add to the output javascript to create a pop up for each polygon using the dataframe.

Can anyone give me a steer in the right direction, please?

1 Answer 1


Didn't have time to take a look before but following Leaflet documentation http://leafletjs.com/reference.html#geojson, you just have to change GeoJSON layer declaration from:

gJson_layer_1 = L.geoJson(gjson_1, {style: style_1}).addTo(map)

to :

gJson_layer_1 = L.geoJson(gjson_1, {
  style: style_1,
  onEachFeature: function (feature, layer) {
  • Really appreciate your time. I took one look at the Javascript in the docs and was completely lost.
    – elksie5000
    Nov 6, 2014 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.