--- id: pypolyline version: "0.5.8" license: BlueOak-1.0.0 license_treatment: unclear maintenance: active --- # pypolyline — Fast Google Polyline encoding and decoding using Rust FFI License: unclear · Maintenance: active · Downloads: 105.6K/mo ## What it is and what it does Pypolyline is a Python wrapper around a Rust library that encodes and decodes the Google Polyline Algorithm format, which compresses sequences of latitude-longitude coordinates into a compact string representation. It is designed for mapping and geospatial applications where route data, GPS traces, or other coordinate sequences need to be efficiently stored or transmitted. The package uses FFI (Foreign Function Interface) and Cython to call compiled Rust code, achieving significant speed improvements over pure-Python implementations. It depends only on numpy and provides two main functions: encode_coordinates() to compress coordinate arrays into polyline strings, and decode_polyline() to expand them back. Error handling raises RuntimeError with details on invalid input. The package supports all currently supported Python versions (3.10–3.14) across Linux, macOS, and Windows. Use it for: - Compress GPS traces or route data for storage in a database or API response. - Encode map directions or navigation paths for transmission over bandwidth-constrained connections. - Decode polyline strings from Google Maps API responses or other mapping services. - Serialize coordinate sequences in web applications to reduce JSON payload size. - Convert between different polyline precision levels (Google's 5 vs. OSRM/Valhalla's 6). ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Encodes and decodes Google Polyline format coordinates using Rust FFI, providing fast compression of latitude-longitude sequences for mapping applications. Yes, if you work with polyline-encoded geographic data. The package is actively maintained, has no known vulnerabilities, supports current Python versions across major platforms, and delivers substantial performance gains over pure-Python alternatives. The only caveat is verifying that the Blue Oak 1.0.0 license fits your use case, and remembering that coordinates must be in (Longitude, Latitude) order. ## Install pip install pypolyline uv add pypolyline poetry add pypolyline ## Installing pypolyline Before you install: Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.14 on Linux (x86_64, aarch64), macOS (x86_64, arm64), and Windows 64-bit. Last release 87 days ago; repository is active with recent commits. License in practice: Licensed under Blue Oak Model Licence 1.0.0 (SPDX: BlueOak-1.0.0), a permissive open-source license. License treatment is marked unclear in metadata; verify terms directly in the LICENCE.md file if commercial use or redistribution is planned. Quickstart: from pypolyline.cutil import encode_coordinates, decode_polyline coords = [[52.64125, 23.70162], [52.64938, 23.70154]] polyline = encode_coordinates(coords, 5) decoded = decode_polyline(polyline, 5) Coordinates must be in (Longitude, Latitude) order, not the more common (Latitude, Longitude). Precision parameter (5 for Google Polyline, 6 for OSRM/Valhalla) must be specified. Verify before relying: - Whether Blue Oak 1.0.0 license is compatible with your project's licensing requirements or redistribution model. - Performance characteristics on your specific hardware and coordinate dataset size relative to the M2 MBP benchmarks cited. ## Package facts - License: BlueOak-1.0.0 (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 105.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags polyline encoding decoding, google maps polyline, coordinate compression, geospatial data compression, route encoding, latitude longitude encoding, map route serialization, geospatial, mapping, performance-critical [View on SkillFed](https://skillfed.io/packages/pypolyline) · [View on PyPI](https://pypi.org/project/pypolyline/)