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.15-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d5d1e0604b104c8c06f8069f132058d0231fc335c41e1581d4790ee8e06962d |
|
MD5 | 01e612f8454a33b5a27ee9fe8bf99fd3 |
|
BLAKE2b-256 | 13c8a8ce2b4d334d3f754ed9cad4843d3e49c393e981ab3565b06284e520b9fd |
Hashes for pypolyline-0.1.15-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b130d091b845c23012bb87c04d17e3b3fa79c7b3cfab609132a4b29870b8fa |
|
MD5 | 99e5a6d9fcfaab6981932ebb90766bef |
|
BLAKE2b-256 | 4b2eb1a46aabef1e7e125d7c21c2cf126b473ce67afdcebcb8df0bf25b7adad9 |
Hashes for pypolyline-0.1.15-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33c1e3013288d17093fc2662a561d4aa715153fe453ebacedfd68e2f536bc75b |
|
MD5 | 96edb0d426f753ecc90a5c2c452f3c6b |
|
BLAKE2b-256 | cd3b4a93b1793867fc1a9f645be9fd8c5bcd21a1a17a44f8fe7e8517526522e0 |
Hashes for pypolyline-0.1.15-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 | ba907d6b4f67497d83b46a1b4c9aabdb9b287ad0ea848dda1bbf998a49c2edc6 |
|
MD5 | 5d73ca1e75c76c59b152a2d66352e598 |
|
BLAKE2b-256 | 69144f892908a7be80d6ca5c9500cfa270e5ab11334dcae4d36c4d988da27449 |
Hashes for pypolyline-0.1.15-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bc7aaa041053570498fbe3312a7f7e1e7db8e36fe401b06f8a3253c6de1c29e |
|
MD5 | e2a6cdbaa9922ab555dce9b28dfc532f |
|
BLAKE2b-256 | c8da9e5c9a60f0485f5e76edae3136c98959ee1a3835f4199cac4b3cff0cf0c2 |
Hashes for pypolyline-0.1.15-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23e24e21fb062cf6bbab5795b0e1c4946b85e120bfc02d22d2b91df8ff478f0f |
|
MD5 | 2cdc2aeebbf60855bae3fa20b2f07c57 |
|
BLAKE2b-256 | 327ea61ba70166d7a0f3148c7508c20f63ff2908476f110f1289ae2d972d2e0e |
Hashes for pypolyline-0.1.15-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b73339966c5d988fb022bd924fd8c8461eec5f022fc78639b52b80b4604781 |
|
MD5 | 8e6fc154f4991e0056c25d50f7b9e37c |
|
BLAKE2b-256 | 317dd9eb0cad0a2e73b74dfa97b69efb36aed1d4d36f04c79223b7dc5a8887b6 |
Hashes for pypolyline-0.1.15-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 | ffa795986e0113f066b6174e1566aa278ab126f453bb2fe83bf15977326315d6 |
|
MD5 | fc65f0f5149a0b4a44e3859bc5dde25c |
|
BLAKE2b-256 | 4ce29c7b365a1fd3eee45b3b6ddc5ad82964d0afa984c293abb650c259c8e505 |