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.11-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 155b44b4494446508c35f18ffca5c8446fde54c00d6a2d7a13d06fac0b63c632 |
|
MD5 | e996f57ef0263fe6dc7fbf2c255b1301 |
|
BLAKE2b-256 | 1d11d411ef6ed3e11342d97dc2b92ed284f51ee07c5b1296b72a6d2fdb6eba90 |
Hashes for pypolyline-0.1.11-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 | 1d7eaca9883ad96fab4120f16c63bc2015538068bd7247faa146184b705beebe |
|
MD5 | f4caa4d0243efc0fe4174f053394236b |
|
BLAKE2b-256 | d2120971740ab8b7a73ffd8e3884001839ccda6b85b589be82953ea61d099f05 |
Hashes for pypolyline-0.1.11-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a661fd81b9f7fd913800aabd2b5477ce37c29495a99fa49477d519f6a7ccc87 |
|
MD5 | 25e6be3cedf2228452fc8ed11e3fc866 |
|
BLAKE2b-256 | 68c2cdf1b61ec1f88be2cace1c6b0fb0ad1b5c297ea66e0708a2f6b0757fa84f |
Hashes for pypolyline-0.1.11-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88269902afc9de3ac4c48e6b2a9f5fae7c9f58126fe230cd9602000d4245ca07 |
|
MD5 | 0cdc76acf7ea85971cea87ef9520bd7e |
|
BLAKE2b-256 | bae1d70d5c560ac64b83598726380780136bcfb2cd9d48da67cf50f87a6a0147 |
Hashes for pypolyline-0.1.11-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648a5786bd4137f1bc7f6cfe8dbf3809805eec642caf92644d02e023a68a626a |
|
MD5 | 12f734a42fe72797f36ff2e04e608e50 |
|
BLAKE2b-256 | e2622a6b460a83de53aab5b1a4bf285a8b0402a23dce98b6e31074d5193f2287 |
Hashes for pypolyline-0.1.11-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9256f0dce919ebb52f5b4ba81c103d1eec0378fc2aabe84aba9f0e8d64279409 |
|
MD5 | acc8d2cee8e00a95dd472db0e78c3855 |
|
BLAKE2b-256 | 2fcc4e7f5d842de447d61aa996ab334f0b93fdbb2ff61a025e879bee1b3ab1a5 |
Hashes for pypolyline-0.1.11-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 | 9882070ac2ce8a4a4cc06151527b4bda575a38ffb22e49cd40df532e2e16be67 |
|
MD5 | 56c78470a210b5d1753f1b0b701db198 |
|
BLAKE2b-256 | 70d90e216cfd0c6ed59749b2de42aa170b2db447e7d544bdc62e3c5a2bf93379 |