Skip to content

Commit

Permalink
Fix folium style callback bug
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Sep 22, 2024
1 parent 84629a9 commit dca8e1a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions leafmap/foliumap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,14 +1449,18 @@ def add_geojson(
raise Exception(e)

# interchangeable parameters between ipyleaflet and folium.

if "style_callback" in kwargs:
kwargs["style_function"] = kwargs.pop("style_callback")

style_dict = {}
if "style_function" not in kwargs:
if "style" in kwargs:
style_dict = kwargs["style"]
if isinstance(kwargs["style"], dict) and len(kwargs["style"]) > 0:
kwargs["style_function"] = lambda x: style_dict
kwargs.pop("style")
else:
elif "fill_colors" not in kwargs:
style_dict = {
# "stroke": True,
"color": "#3388ff",
Expand All @@ -1470,9 +1474,6 @@ def add_geojson(
}
kwargs["style_function"] = lambda x: style_dict

if "style_callback" in kwargs:
kwargs.pop("style_callback")

if "hover_style" in kwargs:
kwargs.pop("hover_style")

Expand Down

0 comments on commit dca8e1a

Please sign in to comment.