The `polyline` library is a Python implementation of Google's Encoded Polyline Algorithm Format. It provides functionality to encode a list of latitude/longitude coordinates into a compact polyline string and to decode such a string back into coordinates. The library is actively maintained, with the current stable version being 2.0.4, and is released on an as-needed basis for bug fixes and feature enhancements.
pip install polylineVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates encoding a list of `(latitude, longitude)` tuples into a polyline string and then decoding it back. It also shows how to handle GeoJSON-style `(longitude, latitude)` order using the `geojson=True` parameter and how to specify a custom precision.
Upgrade to Python 3.7+ or pin the `polyline` library version to 1.4.0 (e.g., `pip install polyline==1.4.0`).
Use the `geojson=True` parameter in both `polyline.encode()` and `polyline.decode()` to work with `(longitude, latitude)` coordinate tuples.
Explicitly set the `precision` parameter during both `encode` and `decode` if a non-default precision is desired or expected.
Ensure that backslashes in the polyline string are correctly escaped or unescaped during parsing. For example, if a `\\` in a CSV becomes `\` in Python, you might need `.replace('\\','\')` before decoding.No dependency data recorded yet.