Draw polygon overlays on a map. See :func:`folium.vector_layers.path_options` for the `Path` options. Parameters ---------- locations: list of points (latitude, longitude) - One list of coordinate pairs to define a polygon. You don't have to add a last point equal
| 196 | |
| 197 | |
| 198 | class Polygon(BaseMultiLocation): |
| 199 | """Draw polygon overlays on a map. |
| 200 | |
| 201 | See :func:`folium.vector_layers.path_options` for the `Path` options. |
| 202 | |
| 203 | Parameters |
| 204 | ---------- |
| 205 | locations: list of points (latitude, longitude) |
| 206 | - One list of coordinate pairs to define a polygon. You don't have to |
| 207 | add a last point equal to the first point. |
| 208 | - If you pass a list with multiple of those it will make a multi- |
| 209 | polygon. |
| 210 | popup: string or folium.Popup, default None |
| 211 | Input text or visualization for object displayed when clicking. |
| 212 | tooltip: str or folium.Tooltip, default None |
| 213 | Display a text when hovering over the object. |
| 214 | **kwargs |
| 215 | Other valid (possibly inherited) options. See: |
| 216 | https://leafletjs.com/reference.html#polygon |
| 217 | |
| 218 | """ |
| 219 | |
| 220 | _template = Template( |
| 221 | """ |
| 222 | {% macro script(this, kwargs) %} |
| 223 | var {{ this.get_name() }} = L.polygon( |
| 224 | {{ this.locations|tojson }}, |
| 225 | {{ this.options|tojson }} |
| 226 | ).addTo({{this._parent.get_name()}}); |
| 227 | {% endmacro %} |
| 228 | """ |
| 229 | ) |
| 230 | |
| 231 | def __init__( |
| 232 | self, |
| 233 | locations: TypeMultiLine, |
| 234 | popup: Union[Popup, str, None] = None, |
| 235 | tooltip: Union[Tooltip, str, None] = None, |
| 236 | **kwargs: TypePathOptions, |
| 237 | ): |
| 238 | super().__init__(locations, popup=popup, tooltip=tooltip) |
| 239 | self._name = "Polygon" |
| 240 | self.options = path_options(line=True, radius=None, **kwargs) |
| 241 | |
| 242 | |
| 243 | class Rectangle(MacroElement): |