MCPcopy Create free account
hub / github.com/python-visualization/folium / PolyLineFromEncoded

Class PolyLineFromEncoded

folium/plugins/encoded.py:55–86  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

53
54
55class 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
89class PolygonFromEncoded(_BaseFromEncoded):

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…