Draw polyline overlays on a map. See :func:`folium.vector_layers.path_options` for the `Path` options. Parameters ---------- locations: list of points (latitude, longitude) Latitude and Longitude of line (Northing, Easting) Pass multiple sequences of coordinates for
| 153 | |
| 154 | |
| 155 | class PolyLine(BaseMultiLocation): |
| 156 | """Draw polyline overlays on a map. |
| 157 | |
| 158 | See :func:`folium.vector_layers.path_options` for the `Path` options. |
| 159 | |
| 160 | Parameters |
| 161 | ---------- |
| 162 | locations: list of points (latitude, longitude) |
| 163 | Latitude and Longitude of line (Northing, Easting) |
| 164 | Pass multiple sequences of coordinates for a multi-polyline. |
| 165 | popup: str or folium.Popup, default None |
| 166 | Input text or visualization for object displayed when clicking. |
| 167 | tooltip: str or folium.Tooltip, default None |
| 168 | Display a text when hovering over the object. |
| 169 | smooth_factor: float, default 1.0 |
| 170 | How much to simplify the polyline on each zoom level. |
| 171 | More means better performance and smoother look, |
| 172 | and less means more accurate representation. |
| 173 | no_clip: Bool, default False |
| 174 | Disable polyline clipping. |
| 175 | **kwargs |
| 176 | Other valid (possibly inherited) options. See: |
| 177 | https://leafletjs.com/reference.html#polyline |
| 178 | |
| 179 | """ |
| 180 | |
| 181 | _template = Template( |
| 182 | """ |
| 183 | {% macro script(this, kwargs) %} |
| 184 | var {{ this.get_name() }} = L.polyline( |
| 185 | {{ this.locations|tojson }}, |
| 186 | {{ this.options|tojson }} |
| 187 | ).addTo({{this._parent.get_name()}}); |
| 188 | {% endmacro %} |
| 189 | """ |
| 190 | ) |
| 191 | |
| 192 | def __init__(self, locations, popup=None, tooltip=None, **kwargs): |
| 193 | super().__init__(locations, popup=popup, tooltip=tooltip) |
| 194 | self._name = "PolyLine" |
| 195 | self.options = path_options(line=True, **kwargs) |
| 196 | |
| 197 | |
| 198 | class Polygon(BaseMultiLocation): |