--- id: polyline version: "2.0.4" license: Copyright (c) 2023 Frederick Jansen Copyright (c) 2014 Bruno M. Custódio Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation… (full text in the JSON record) license_treatment: unclear maintenance: aging --- # polyline — A Python implementation of Google's Encoded Polyline Algorithm Format. License: unclear · Maintenance: aging · Downloads: 2.5M/mo ## What it is and what it does Polyline is a Python implementation of Google's Encoded Polyline Algorithm Format, a standard method for compressing sequences of latitude/longitude coordinates into a compact string representation. It converts between human-readable coordinate tuples and the compressed format used by mapping APIs, supporting both (lat, lon) and GeoJSON (lon, lat) coordinate orders. The package has no runtime dependencies and works with Python 3.8 and above. Typically used in mapping and geolocation applications to reduce bandwidth when transmitting routes, paths, or coordinate sequences over the network. You provide a list of coordinate pairs and a precision level, and the encoder produces a compressed string; the decoder reverses the process. The library is a port of Mapbox's polyline implementation with additional features, making it suitable for applications that need to serialize geographic data efficiently. Use it for: - Compress GPS route data for transmission to mapping APIs or storage in databases. - Decode polyline strings returned by Google Maps or other mapping services into coordinate lists. - Reduce payload size when sending coordinate sequences over HTTP in web or mobile applications. - Convert between coordinate formats (lat/lon vs. GeoJSON) for compatibility with different mapping libraries. - Encode walking or driving routes for display on interactive maps with minimal data transfer. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Encodes and decodes geographic coordinate sequences using Google's Encoded Polyline Algorithm Format, converting between (lat, lon) tuples and compressed polyline strings. Yes, if you need to work with Google's Encoded Polyline format. The package is lightweight, dependency-free, and widely used (top 5000 on PyPI). Maintenance is aging but the code is stable and no vulnerabilities are known. The MIT license is permissive. Install it if your application requires polyline encoding/decoding; skip it if you don't work with this specific format. ## Install pip install polyline uv add polyline poetry add polyline ## Installing polyline Before you install: Low install friction with no runtime dependencies. Maintenance status is aging—last release 255 days ago—but the repository remains active and the package has been stable since its 2014 inception. License in practice: MIT license (inferred from license text). Permissive; you may use, modify, and distribute freely with attribution and without warranty. Quickstart: pip install polyline import polyline # Encode coordinates to polyline string encoded = polyline.encode([(38.5, -120.2), (40.7, -120.9), (43.2, -126.4)], 5) # Decode polyline string back to coordinates decoded = polyline.decode('u{~vFvyys@fS]', 5) Requires Python 3.8 or above; Python 2 is not supported in v2.0.4. Verify before relying: - Whether the package handles edge cases (e.g., very large coordinate sets, extreme precision values) reliably. - Performance characteristics for encoding/decoding large polyline datasets. - Whether geojson parameter behavior is fully documented and tested. ## Package facts - License: Copyright (c) 2023 Frederick Jansen Copyright (c) 2014 Bruno M. Custódio Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation… (full text in the JSON record) (unclear) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 2.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags polyline encoding decoding, google encoded polyline, coordinate compression, lat lon to polyline, geographic coordinate format, map route encoding, polyline algorithm, geospatial, encoding, maps [View on SkillFed](https://skillfed.io/packages/polyline) · [View on PyPI](https://pypi.org/project/polyline/)