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.5 (*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.10-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fe295b474966ca75a2a2f6d8681946837b03080b022e0ecab2005baf927f6c4 |
|
MD5 | 6bea9d5feac0c22cebebb7e39d195b72 |
|
BLAKE2b-256 | 4fb29f3df04cdaf0ae25370b6ff5cc139b9477f8fdc34de1423c0c4e0a037e73 |
Hashes for pypolyline-0.1.10-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 | 6a5c7908013d1de2d1d66c3c0738f7260cf545f4e8d603cac5e056d7e3462780 |
|
MD5 | 9798a766032f8689408eb1538371345a |
|
BLAKE2b-256 | 876523f5b54a7ab2d2c1c36179dc2085db78979233881dfaff2096dbbbf79ed2 |
Hashes for pypolyline-0.1.10-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65a1e2692737f8f1e98628655605c83232c33f71648220f70586b9376cfe201e |
|
MD5 | 65942615ab4410bc6c38bb37dc30836f |
|
BLAKE2b-256 | b3587f9abfa20384cd773f285e906b6a3c50f0b6579bead82c9a460ba4553103 |
Hashes for pypolyline-0.1.10-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9893377f83b1c048007b9a96cf8e775b05194c7cdf779c0f3efb1db588fbf3af |
|
MD5 | 8dd26c5e8786957d2e398cf9f8489430 |
|
BLAKE2b-256 | 85ddcff854b8e95fbe55fd717475c153dc476a2f47635c051b4626b6e978fbd3 |
Hashes for pypolyline-0.1.10-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2638e763f8ad08b9825585068774bc3fa5598bfd09539d52b64c4417a974ad93 |
|
MD5 | 89c314b259d54677c834d63c096879a0 |
|
BLAKE2b-256 | afda3997c2b6c9731cecb827f8a9bd308c9dd51d01b26a64691cffcc9b498b91 |
Hashes for pypolyline-0.1.10-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6fd6269d22297572648184f1184537458a71789becd9654d309e9e4f5650ded |
|
MD5 | 57edaf88a7ce3f3d5936c2875ade47c8 |
|
BLAKE2b-256 | 37dce7ac85866069bb952f63adcff7c034cd0e445575721342b48f232cb057a1 |
Hashes for pypolyline-0.1.10-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 | 534106a4b9273c442741e634ca3b7150ec0f7ab00aa8d0acd6350b5c61feda5c |
|
MD5 | 4d4e8fd32aca402e2c2dec068f534d43 |
|
BLAKE2b-256 | 5171436c961916a947cb3518afa80bbe19905f6ae4ad090d5018586a0893613e |