|
17 | 17 | from branca.utilities import (_locations_tolist, _parse_size, image_to_url, iter_points, none_max, none_min) # noqa |
18 | 18 |
|
19 | 19 | from folium.map import FeatureGroup, Icon, Layer, Marker, Popup |
| 20 | +from folium.utilities import _validate_coordinates, _validate_location |
20 | 21 |
|
21 | 22 | from jinja2 import Template |
22 | 23 |
|
@@ -133,7 +134,10 @@ class RegularPolygonMarker(Marker): |
133 | 134 | def __init__(self, location, color='black', opacity=1, weight=2, |
134 | 135 | fill_color='blue', fill_opacity=1, |
135 | 136 | number_of_sides=4, rotation=0, radius=15, popup=None): |
136 | | - super(RegularPolygonMarker, self).__init__(location, popup=popup) |
| 137 | + super(RegularPolygonMarker, self).__init__( |
| 138 | + _locations_tolist(location), |
| 139 | + popup=popup |
| 140 | + ) |
137 | 141 | self._name = 'RegularPolygonMarker' |
138 | 142 | self.color = color |
139 | 143 | self.opacity = opacity |
@@ -819,7 +823,10 @@ class Circle(Marker): |
819 | 823 | """ |
820 | 824 | def __init__(self, location, radius=500, color='black', |
821 | 825 | fill_color='black', fill_opacity=0.6, popup=None): |
822 | | - super(Circle, self).__init__(location, popup=popup) |
| 826 | + super(Circle, self).__init__( |
| 827 | + _validate_location(location), |
| 828 | + popup=popup |
| 829 | + ) |
823 | 830 | self._name = 'Circle' |
824 | 831 | self.radius = radius |
825 | 832 | self.color = color |
@@ -928,7 +935,10 @@ def __init__(self, bounds, color='black', weight=1, fill_color='black', |
928 | 935 | ... ) |
929 | 936 |
|
930 | 937 | """ |
931 | | - super(RectangleMarker, self).__init__(bounds, popup=popup) |
| 938 | + super(RectangleMarker, self).__init__( |
| 939 | + _validate_coordinates(bounds), |
| 940 | + popup=popup |
| 941 | + ) |
932 | 942 | self._name = 'RectangleMarker' |
933 | 943 | self.color = color |
934 | 944 | self.weight = weight |
@@ -986,10 +996,7 @@ def __init__(self, locations, color='black', weight=1, fill_color='black', |
986 | 996 | ... fill_opacity=0.5, popup='Tokyo, Japan')) |
987 | 997 |
|
988 | 998 | """ |
989 | | - super(PolygonMarker, self).__init__( |
990 | | - _locations_tolist(locations), |
991 | | - popup=popup |
992 | | - ) |
| 999 | + super(PolygonMarker, self).__init__(locations, popup=popup) |
993 | 1000 | self._name = 'PolygonMarker' |
994 | 1001 | self.color = color |
995 | 1002 | self.weight = weight |
@@ -1089,7 +1096,7 @@ def __init__(self, locations, color=None, weight=None, |
1089 | 1096 | opacity=None, popup=None): |
1090 | 1097 | super(PolyLine, self).__init__() |
1091 | 1098 | self._name = 'PolyLine' |
1092 | | - self.data = _locations_tolist(locations) |
| 1099 | + self.data = _validate_coordinates(locations) |
1093 | 1100 | self.color = color |
1094 | 1101 | self.weight = weight |
1095 | 1102 | self.opacity = opacity |
|
0 commit comments