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

Class PolygonFromEncoded

folium/plugins/encoded.py:89–120  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

87
88
89class 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"

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…