Create Polygons directly from the encoded string. Parameters ---------- encoded: str The raw encoded string from the Polyline Encoding Algorithm. See: https://developers.google.com/maps/documentation/utilities/polylinealgorithm **kwargs: Polygon options as ac
| 87 | |
| 88 | |
| 89 | class PolygonFromEncoded(_BaseFromEncoded): |
| 90 | """Create Polygons directly from the encoded string. |
| 91 | |
| 92 | Parameters |
| 93 | ---------- |
| 94 | encoded: str |
| 95 | The raw encoded string from the Polyline Encoding Algorithm. See: |
| 96 | https://developers.google.com/maps/documentation/utilities/polylinealgorithm |
| 97 | **kwargs: |
| 98 | Polygon options as accepted by leaflet. See: |
| 99 | https://leafletjs.com/reference.html#polygon |
| 100 | |
| 101 | Adapted from https://github.com/jieter/Leaflet.encoded |
| 102 | |
| 103 | Examples |
| 104 | -------- |
| 105 | >>> from folium import Map |
| 106 | >>> from folium.plugins import PolygonFromEncoded |
| 107 | >>> m = Map() |
| 108 | >>> encoded = r"w`j~FpxivO}jz@qnnCd}~Bsa{@~f`C`lkH" |
| 109 | >>> PolygonFromEncoded(encoded=encoded).add_to(m) |
| 110 | """ |
| 111 | |
| 112 | def __init__(self, encoded: str, **kwargs): |
| 113 | self._name = "PolygonFromEncoded" |
| 114 | super().__init__(encoded) |
| 115 | self.options = path_options(line=True, radius=None, **kwargs) |
| 116 | |
| 117 | @property |
| 118 | def _encoding_type(self) -> str: |
| 119 | """Return the name of folium object created from the encoded.""" |
| 120 | return "Polygon" |
no outgoing calls
searching dependent graphs…