@@ -634,6 +634,51 @@ def __init__(self, html=None, icon_size=None, icon_anchor=None,
634
634
""" ) # noqa
635
635
636
636
637
+ class Circle (Marker ):
638
+ """Creates a Circle object for plotting on a Map.
639
+
640
+ Parameters
641
+ ----------
642
+ location: tuple or list, default None
643
+ Latitude and Longitude of Marker (Northing, Easting)
644
+ radius: int
645
+ The radius of the circle in meters. For setting the radius in pixel,
646
+ use CircleMarker.
647
+ color: str, default 'black'
648
+ The color of the marker's edge in a HTML-compatible format.
649
+ fill_color: str, default 'black'
650
+ The fill color of the marker in a HTML-compatible format.
651
+ fill_opacity: float, default 0.6
652
+ The fill opacity of the marker, between 0. and 1.
653
+ popup: string or folium.Popup, default None
654
+ Input text or visualization for object.
655
+ """
656
+ def __init__ (self , location , radius = 500 , color = 'black' ,
657
+ fill_color = 'black' , fill_opacity = 0.6 , popup = None ):
658
+ super (Circle , self ).__init__ (location , popup = popup )
659
+ self ._name = 'Circle'
660
+ self .radius = radius
661
+ self .color = color
662
+ self .fill_color = fill_color
663
+ self .fill_opacity = fill_opacity
664
+
665
+ self ._template = Template (u"""
666
+ {% macro script(this, kwargs) %}
667
+
668
+ var {{this.get_name()}} = L.circle(
669
+ [{{this.location[0]}},{{this.location[1]}}],
670
+ {{ this.radius }},
671
+ {
672
+ color: '{{ this.color }}',
673
+ fillColor: '{{ this.fill_color }}',
674
+ fillOpacity: {{ this.fill_opacity }}
675
+ }
676
+ )
677
+ .addTo({{this._parent.get_name()}});
678
+ {% endmacro %}
679
+ """ )
680
+
681
+
637
682
class CircleMarker (Marker ):
638
683
"""Creates a CircleMarker object for plotting on a Map.
639
684
@@ -642,12 +687,13 @@ class CircleMarker(Marker):
642
687
location: tuple or list, default None
643
688
Latitude and Longitude of Marker (Northing, Easting)
644
689
radius: int
645
- The radius of the circle in pixels.
690
+ The radius of the circle in pixels. For setting the radius in meter,
691
+ use Circle.
646
692
color: str, default 'black'
647
693
The color of the marker's edge in a HTML-compatible format.
648
694
fill_color: str, default 'black'
649
695
The fill color of the marker in a HTML-compatible format.
650
- fill_opacity: float, default à .6
696
+ fill_opacity: float, default 0 .6
651
697
The fill opacity of the marker, between 0. and 1.
652
698
popup: string or folium.Popup, default None
653
699
Input text or visualization for object.
@@ -664,15 +710,15 @@ def __init__(self, location, radius=500, color='black',
664
710
self ._template = Template (u"""
665
711
{% macro script(this, kwargs) %}
666
712
667
- var {{this.get_name()}} = L.circle (
713
+ var {{this.get_name()}} = L.circleMarker (
668
714
[{{this.location[0]}},{{this.location[1]}}],
669
- {{ this.radius }},
670
715
{
671
716
color: '{{ this.color }}',
672
717
fillColor: '{{ this.fill_color }}',
673
718
fillOpacity: {{ this.fill_opacity }}
674
719
}
675
720
)
721
+ .setRadius({{ this.radius }})
676
722
.addTo({{this._parent.get_name()}});
677
723
{% endmacro %}
678
724
""" )
0 commit comments