Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion folium/vector_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def path_options(
"smoothFactor": kwargs.pop("smoothFactor", 1.0),
"noClip": kwargs.pop("noClip", False),
}
if radius:
if radius is not None:
extra_options.update({"radius": radius})

color = kwargs.pop("color", "#3388ff")
Expand Down
13 changes: 13 additions & 0 deletions tests/test_vector_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,16 @@ def test_circle_marker_forwards_interactive():
marker.add_to(m)
rendered = normalize(m._parent.render())
assert '"interactive": false' in rendered


def test_zero_radius_is_kept():
"""A radius of 0 must reach Leaflet instead of falling back to its default.

Leaflet's default radius is 10 (pixels for CircleMarker, meters for
Circle), so dropping a 0 drew zero-valued points as visible circles.
"""
assert path_options(radius=0)["radius"] == 0
assert Circle(location=[0, 0], radius=0).options["radius"] == 0
assert CircleMarker(location=[0, 0], radius=0).options["radius"] == 0
# radius=None still means "don't set it", as for polygons and lines.
assert "radius" not in path_options(line=True, radius=None)
Loading