Fast Google Polyline encoding and decoding using Rust FFI
Project description
Installation
pip install pypolyline
Please use a recent (>= 8.1.2) version of pip.
Supported Python Versions
Python 2.7 (*nix and Windows)
Python 3.4 (Windows)
Python 3.6 (*nix)
Supported Platforms
Linux (manylinux1-compatible)
OS X
Windows 32-bit / 64-bit
Usage
from pypolyline.util import encode_coordinates, decode_polyline
coords = [
[52.64125, 23.70162],
[52.64938, 23.70154],
[52.64957, 23.68546],
[52.64122, 23.68549],
[52.64125, 23.70162]
]
# precision is 5 for Google Polyline, 6 for OSRM / Valhalla
polyline = encode_coordinates(coords, 5)
# polyline is 'ynh`IcftoCyq@Ne@ncBds@EEycB'
decoded_coords = decode_polyline(polyline, 5)
Attempts to decode an invalid Polyline will throw util.DecodingError
Attempts to encode invalid coordinates will throw util.EncodingError
Cython Module
If you’re comfortable with a lack of built-in exceptions, you may use the compiled Cython version of the functions, instead, giving a 2x speedup over the ctypes functions:
from pypolyline.cutil import encode_coordinates, decode_polyline
Longitude errors will return strings beginning with Longitude error:
Latitude errors will return strings beginning with Latitude error:
Polyline errors will return [[nan, nan]]
How it Works
FFI and a Rust binary
Is It Fast
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pypolyline-0.1.17-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bdbc9210f29d4fd44c3e4d510ffcc1276e46a50d63365831e2e422dc0b3cb43 |
|
MD5 | 32bd73a75f926d04d9a63fcc1fc086d8 |
|
BLAKE2b-256 | 5ca5ddb3095e894868f9b1b6fdc7fbc7ede13f9b99d07ad1c896f2753d2728eb |
Hashes for pypolyline-0.1.17-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8efb93097c92c5894dcaf9e784b888f9426d170ae51d62164341bbb2b832c09a |
|
MD5 | e89f6fe6195a38126548a9f3fd650d85 |
|
BLAKE2b-256 | 22ca35d84eabd3ab185fb88dc4d76f65af5c1d5384e4acbd429b74f97d9a4d6a |
Hashes for pypolyline-0.1.17-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c84f0d2aa6bd9ed14bdb671fab80f79b4ba93b4347b530ae4d3b56a3fb269a |
|
MD5 | 4690afd3fe255bbf7696aa0337e2921a |
|
BLAKE2b-256 | 8a782dce7b0d7f4adc62a18b31747c570ad310a0d55446ccc3f8227d3c618b36 |
Hashes for pypolyline-0.1.17-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09cc2192bc12063c7afa2d2718b739cd4bf3f8ec29eacde0cb728c9f5f7f7858 |
|
MD5 | 9eb4742c3c0b5e2501f97a22b13444c7 |
|
BLAKE2b-256 | eba558e7f76166f0a15dd8ad85d26a16ed11688f686a0b851443acf3b24c4bd6 |
Hashes for pypolyline-0.1.17-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e0643454b4471f4f23d38530467ee7093d3b375898d5e1b054876e5a50a6b89 |
|
MD5 | 364f428da71db02868353edd3f0be7ef |
|
BLAKE2b-256 | b0ff596cc091a6a3ab12692081a611b41da8a3dab9a5ae78fcd8263deb89cfc3 |
Hashes for pypolyline-0.1.17-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21acee0e31d867bde04583907ccb7afe4b21d33a63c23adc7cf0d82b6f2feab3 |
|
MD5 | 61221cd70ea680c858ca3526023a9079 |
|
BLAKE2b-256 | 57eafbc6a2a0baf04e084034418953a4cc362b02bf7554eeff0f4652253efa55 |
Hashes for pypolyline-0.1.17-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b0a1b573fe84c9ed0aa3a4eb9903d44864f37e405cdcc7396b61e6d00a937d6 |
|
MD5 | a1e0ecc65395ea902653c6e78919f602 |
|
BLAKE2b-256 | 146b68cd0dc73bfc5d08681995cd6be11afe79e535e9efdecd4a50159d561579 |
Hashes for pypolyline-0.1.17-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c843a35b2d02b04c1226db851834b55f0de30eef47ba057fd6f8623cdef6f2d |
|
MD5 | b74bf9a3a12895016d810a3d3367989b |
|
BLAKE2b-256 | a6e5cd5c568fffd6e3ecd8425c92ad59122437d8783a37344a4b88ba3de14b6d |
Hashes for pypolyline-0.1.17-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad01fedf427536f391776b329c95e5f80f2b1a5d25c54ea7713c8cdb56947106 |
|
MD5 | 303bfbde7e8ef4b9ecd0877168b67dc2 |
|
BLAKE2b-256 | e13bf209c7658ce42d607c2ffe9d779fc4529a1e195eca502c3d505402b162b0 |
Hashes for pypolyline-0.1.17-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4e4c857790f6a3067dab3ae661edda99d5cee55d107b3b4d0186159431165ef |
|
MD5 | d7495578d979538610637d1c159daefe |
|
BLAKE2b-256 | 8a968daa6e923d6295f06f12bda66aaa56d7c08645957f626be8b97123e83277 |