Create PolyLines 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: Polyline options as
| 53 | |
| 54 | |
| 55 | class PolyLineFromEncoded(_BaseFromEncoded): |
| 56 | """Create PolyLines directly from the encoded string. |
| 57 | |
| 58 | Parameters |
| 59 | ---------- |
| 60 | encoded: str |
| 61 | The raw encoded string from the Polyline Encoding Algorithm. See: |
| 62 | https://developers.google.com/maps/documentation/utilities/polylinealgorithm |
| 63 | **kwargs: |
| 64 | Polyline options as accepted by leaflet. See: |
| 65 | https://leafletjs.com/reference.html#polyline |
| 66 | |
| 67 | Adapted from https://github.com/jieter/Leaflet.encoded |
| 68 | |
| 69 | Examples |
| 70 | -------- |
| 71 | >>> from folium import Map |
| 72 | >>> from folium.plugins import PolyLineFromEncoded |
| 73 | >>> m = Map() |
| 74 | >>> encoded = r"_p~iF~cn~U_ulLn{vA_mqNvxq`@" |
| 75 | >>> PolyLineFromEncoded(encoded=encoded, color="green").add_to(m) |
| 76 | """ |
| 77 | |
| 78 | def __init__(self, encoded: str, **kwargs): |
| 79 | self._name = "PolyLineFromEncoded" |
| 80 | super().__init__(encoded=encoded) |
| 81 | self.options = path_options(line=True, **kwargs) |
| 82 | |
| 83 | @property |
| 84 | def _encoding_type(self) -> str: |
| 85 | """Return the name of folium object created from the encoded.""" |
| 86 | return "Polyline" |
| 87 | |
| 88 | |
| 89 | class PolygonFromEncoded(_BaseFromEncoded): |
no outgoing calls
searching dependent graphs…