Skip to content

Polyline decoder

Decoder for Valhalla's polyline6-encoded geometries, backed by the C++ midgard::decode. See Decoding shape for the encoding details and reference implementations in other languages.

decode_polyline

decode_polyline(polyline: str, precision: int = 6, order: str = 'lnglat') -> list[tuple[float, float]]

Decodes an encoded polyline string with precision to a list of coordinate tuples. The coordinate order of the output can be lnglat or latlng.