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.13-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb5154ff59e45a99a840c2ea0857f38bde7c939dd069f4738b03a0c126b1ac88 |
|
MD5 | 304500e64403ee34fa48d3c7d17eae0b |
|
BLAKE2b-256 | ee28965d3ca86d7bfb70412f289f78b2274b1e4a75e4cab7426e204af3748bf7 |
Hashes for pypolyline-0.1.13-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b578362eb6c91ba6b1baf8ca7618ee1fa9a457d7e3c077fc0c98d644e72c13d7 |
|
MD5 | 06307891cadc5ae1aa385e07d5cd02d1 |
|
BLAKE2b-256 | 0ad2c0e1f1828115549d59cbcbe691d05d1350d0fb109b6dda6cc086c885db00 |
Hashes for pypolyline-0.1.13-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 189deae70ab4f56c90801ffa76a456a62c6f11625221e360f9f61d1fc89b571f |
|
MD5 | 7499db6848f1c395df27e1b6d179e06b |
|
BLAKE2b-256 | 1752f51073538c794effc087bfedac06e147e9129a27bfd43cd14b97ebb760e7 |
Hashes for pypolyline-0.1.13-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 | 89a98545f0ec1c67ed5f18ef7df66a6c4e5cbc861e00d022033cf0032baecdb2 |
|
MD5 | a591cc92fd7fb9772c7477fc64e6b6d1 |
|
BLAKE2b-256 | 4e9427d54411917d58cf3820dbddb8358124c7f70a47d8a557ee89a7b42404e6 |
Hashes for pypolyline-0.1.13-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd08de4ccacc33ce59727ada99a8da476944ca1bf187cd40955586e6bb342a2a |
|
MD5 | 2f131b0ac45f329d44fc7c7a6334e1d9 |
|
BLAKE2b-256 | 9c454d552a13f0eab20b17cb1b6f1ccddd2852a6f370b09b6a259838c5d94907 |
Hashes for pypolyline-0.1.13-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16ded3b395b294270398629c3693f16ecfb78fe0903d9bed179e5e492699e0b |
|
MD5 | bc04888f6fbe1566f4942c3b622dad65 |
|
BLAKE2b-256 | ededf252a95d4fd9b9b629a614053e9b431d9945fc0664661e82380de7bee080 |
Hashes for pypolyline-0.1.13-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1749452537c9fa2fa39f47b21f49c95e16a59f64e125804f1948a5aa7cdb0d5 |
|
MD5 | 4a0a1480de3949c618133492aa907d1b |
|
BLAKE2b-256 | 8d8cd332f148b29b8cb39d96d7f3bfb3f0770a34c69c56ad3a249d73800b9c0b |
Hashes for pypolyline-0.1.13-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 | 1f8f2a4f2a9f66e3b73674b5df7d969001b948ae05c8985efe3753a47cecfd70 |
|
MD5 | 6a347324f6273641be280b8a06a6d6a1 |
|
BLAKE2b-256 | 5e23b53b9e4223e322506277b8d16f787676878ea898668a6782fc0a1d352f21 |