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.9-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fc2a121ffa832c4d8189278758293f0ee556a302a9759f9c204e8e83063f46c |
|
MD5 | e1c4fe9ac5447c784157d9abe0f716bb |
|
BLAKE2b-256 | 635e02d58864a5b20a8f6726588225b12f0f41d5b41b5cf99a26014f773207d5 |
Hashes for pypolyline-0.1.9-cp35-cp35m-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 | d5919f11980cdb51eb01f14aef2e8a70adef182c2555a59853d669ae2cd84acc |
|
MD5 | ffea939478fb50274711663311a564c5 |
|
BLAKE2b-256 | 79625b2376e2c0382259ca91001a268dd1a672aa6c68a04b4f63662a1e979c2f |
Hashes for pypolyline-0.1.9-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8461d5d7362bab67838d87a221afc9cde26c246a4a58d4d94dd75b6b8ff32ff |
|
MD5 | bf1da0a6e1d327d37aef9aaed34e8fbe |
|
BLAKE2b-256 | 0dd84f6633c6676c77c4eb58b6e08a689023653263e68ccca797d3889e245bc8 |
Hashes for pypolyline-0.1.9-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 784e6b0e319bb391a215e5e0f43dc0445a8d19c092eda03d8d1730e1676bf2db |
|
MD5 | 9b925e01e67a4e2fab81d10e7f864858 |
|
BLAKE2b-256 | 9cbbe95bf174969dd0662e0fe4e637afa7250b07d21711351f37a82873d3847d |
Hashes for pypolyline-0.1.9-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f9d471d21a73234e408e5f1abf732e555f58036bbabc3fbe4da51c4695312c |
|
MD5 | 89e2dbed00b793cce5dea94de8cb88b2 |
|
BLAKE2b-256 | 62beb40c7406b55bbf4203ee0252588c7fff78df3403d3906be301ab059f049f |
Hashes for pypolyline-0.1.9-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbe139117fd718057f4f634d74b8e59515b72042142f80ba46e44b71179f296a |
|
MD5 | 93acf4099b2599a1a9c1538ec22e8162 |
|
BLAKE2b-256 | ca0589c8761d002aca9d7c20b6297ce80e4e2de74391018ef588ec9cb72bca6b |
Hashes for pypolyline-0.1.9-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 | cd36c408744698271cac86c2c4feb9075e9fed75bcd973b8fa71cde392ce8664 |
|
MD5 | 9c5157655d7f34d0bcbcbe3d245adf92 |
|
BLAKE2b-256 | d744de9376a7b83e09fc4439d0d6a4d2d9e5c1e1390e4ff0506411b6de286a39 |