Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zaczero/polyline-rs
Fast Google Encoded Polyline encoding & decoding in Rust for Python
https://github.com/zaczero/polyline-rs
decoding encoding gis google google-maps googlemaps mapbox openstreetmap polyline polyline-decoder polyline-encoder
Last synced: 8 days ago
JSON representation
Fast Google Encoded Polyline encoding & decoding in Rust for Python
- Host: GitHub
- URL: https://github.com/zaczero/polyline-rs
- Owner: Zaczero
- License: unlicense
- Created: 2024-10-29T20:37:40.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T02:26:13.000Z (about 2 months ago)
- Last Synced: 2024-12-13T19:51:52.222Z (13 days ago)
- Topics: decoding, encoding, gis, google, google-maps, googlemaps, mapbox, openstreetmap, polyline, polyline-decoder, polyline-encoder
- Language: Rust
- Homepage: https://pypi.org/p/polyline-rs
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# polyline-rs
[![PyPI - Python Version](https://shields.monicz.dev/pypi/pyversions/polyline-rs)](https://pypi.org/project/polyline-rs)
[![Liberapay Patrons](https://shields.monicz.dev/liberapay/patrons/Zaczero?logo=liberapay&label=Patrons)](https://liberapay.com/Zaczero/)
[![GitHub Sponsors](https://shields.monicz.dev/github/sponsors/Zaczero?logo=github&label=Sponsors&color=%23db61a2)](https://github.com/sponsors/Zaczero)Fast Google Encoded Polyline encoding & decoding in Rust. A Python PyO3 library with out-of-the-box support for both (lat, lon) and (lon, lat) coordinates.
[Encoded Polyline Algorithm Format](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
## Installation
The recommended installation method is through the PyPI package manager. The project is implemented in Rust and several pre-built binary wheels are available for Linux, macOS, and Windows, with support for both x64 and ARM architectures.
```sh
pip install polyline-rs
```## Basic usage
```py
from polyline_rs import encode_latlon, encode_lonlat, decode_latlon, decode_lonlatline = encode_latlon([(38.5, -120.2), (40.7, -120.95), (43.252, -126.453)], 5)
assert line == "_p~iF~ps|U_ulLnnqC_mqNvxq`@"coords = decode_latlon(line, 5)
assert coords == [(38.5, -120.2), (40.7, -120.95), (43.252, -126.453)]coords2 = decode_lonlat(line, 5)
assert coords2 == [(-120.2, 38.5), (-120.95, 40.7), (-126.453, 43.252)]
```