Custom markers using the Leaflet Data Vis Framework. Parameters ---------- location: tuple or list Latitude and Longitude of Marker (Northing, Easting) number_of_sides: int, default 4 Number of polygon sides rotation: int, default 0 Rotation angle in
| 61 | |
| 62 | |
| 63 | class RegularPolygonMarker(JSCSSMixin, Marker): |
| 64 | """ |
| 65 | Custom markers using the Leaflet Data Vis Framework. |
| 66 | |
| 67 | Parameters |
| 68 | ---------- |
| 69 | location: tuple or list |
| 70 | Latitude and Longitude of Marker (Northing, Easting) |
| 71 | number_of_sides: int, default 4 |
| 72 | Number of polygon sides |
| 73 | rotation: int, default 0 |
| 74 | Rotation angle in degrees |
| 75 | radius: int, default 15 |
| 76 | Marker radius, in pixels |
| 77 | popup: string or Popup, optional |
| 78 | Input text or visualization for object displayed when clicking. |
| 79 | tooltip: str or folium.Tooltip, optional |
| 80 | Display a text when hovering over the object. |
| 81 | **kwargs: |
| 82 | See vector layers path_options for additional arguments. |
| 83 | |
| 84 | https://humangeo.github.io/leaflet-dvf/ |
| 85 | |
| 86 | """ |
| 87 | |
| 88 | _template = Template( |
| 89 | """ |
| 90 | {% macro script(this, kwargs) %} |
| 91 | var {{ this.get_name() }} = new L.RegularPolygonMarker( |
| 92 | {{ this.location|tojson }}, |
| 93 | {{ this.options|tojavascript }} |
| 94 | ).addTo({{ this._parent.get_name() }}); |
| 95 | {% endmacro %} |
| 96 | """ |
| 97 | ) |
| 98 | |
| 99 | default_js = [ |
| 100 | ( |
| 101 | "dvf_js", |
| 102 | "https://cdnjs.cloudflare.com/ajax/libs/leaflet-dvf/0.3.0/leaflet-dvf.markers.min.js", |
| 103 | ), |
| 104 | ] |
| 105 | |
| 106 | def __init__( |
| 107 | self, |
| 108 | location: Sequence[float], |
| 109 | number_of_sides: int = 4, |
| 110 | rotation: int = 0, |
| 111 | radius: int = 15, |
| 112 | popup: Union[Popup, str, None] = None, |
| 113 | tooltip: Union[Tooltip, str, None] = None, |
| 114 | **kwargs: TypePathOptions, |
| 115 | ): |
| 116 | super().__init__(location, popup=popup, tooltip=tooltip) |
| 117 | self._name = "RegularPolygonMarker" |
| 118 | self.options = path_options(line=False, radius=radius, **kwargs) |
| 119 | self.options.update( |
| 120 | dict( |