Skip to content

Commit

Permalink
added section to geojson.md
Browse files Browse the repository at this point in the history
  • Loading branch information
GiuseppeGalilei committed Jan 2, 2024
1 parent 2586125 commit e92b1e6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/user_guide/geojson/geojson.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,27 @@ folium.GeoJson(
m
```

#### Keep highlighted while popup is open

The `GeoJson` class provides a `popup_keep_highlighted` boolean argument. \
Whenever a GeoJson layer is associated with a popup and a highlight function is defined, this argument allows you to decide if the highlighting should remain active while the popup is open.

```{code-cell} ipython3
m = folium.Map([43, -100], zoom_start=4)
popup = folium.GeoJsonPopup(fields=["name"])
folium.GeoJson(
geo_json_data,
highlight_function=lambda feature: {
"fillColor": (
"green" if "e" in feature["properties"]["name"].lower() else "#ffff00"
),
},
popup=popup,
popup_keep_highlighted=True,
).add_to(m)
m
```

0 comments on commit e92b1e6

Please sign in to comment.