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.14-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | add19c3870ae733ec449cfaa48afc5bc27157ef7605a635d1afbe4c605dbfeb3 |
|
MD5 | 84deda5cffcb0bc710b8006d7e99597f |
|
BLAKE2b-256 | e09c3aabd367bf1e23354f30a1d69a926645764e616f8f68c99ad23afd9e1e8e |
Hashes for pypolyline-0.1.14-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c67a64a906fc20b9d52153c1c7f3862077a101063993e14cbcc80b550e6e7ec |
|
MD5 | c4d46a6962b32e897a256e04502cab17 |
|
BLAKE2b-256 | 7fb01794d5b3d3e3a6ff8481bc9dea5331e0c96d05e82cfd5fe3ccdcfed42435 |
Hashes for pypolyline-0.1.14-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c11baa12b53d7048330420b2f1f3c808ce4ce0dee47149ee72272c99dde0b3e |
|
MD5 | 8025551174c3036f12970e8d8419ee9c |
|
BLAKE2b-256 | 23450ea24d8c099bd0fd1a3d97afa29e884848ee8968552b442682edb1047638 |
Hashes for pypolyline-0.1.14-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 | d814e84dceca1f6d3285ff9daaea54b7d73a1d75986a222eecc47a0eac2e046d |
|
MD5 | 170e57af958cedaff6ed455a68d00eaa |
|
BLAKE2b-256 | 07d141c811a11ea5f61023adf9a9752e66144e0db7933b64ae2ee97a46709249 |
Hashes for pypolyline-0.1.14-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d4477cdaa79b7b36b6b7782f8d1ce558246b9de5d8b67d5721a18c86cea847e |
|
MD5 | e7a8cc300fea8722a6989151e5e3481e |
|
BLAKE2b-256 | 609ef4ffad06977b042f129ca08f6da07f94f7f377e8995bb7cffe14308531a6 |
Hashes for pypolyline-0.1.14-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5e12db19ceb324e0d5174e95073283e9ed13f3e8124d8d51efe3dd496651a85 |
|
MD5 | f9645634b7a8d8245df59bea1f8f9086 |
|
BLAKE2b-256 | 84a0b74a81b6671a4f8d8b93c725a931e6ed72631bb4b789533dace2244f91a9 |
Hashes for pypolyline-0.1.14-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b2ecb5f264bb0143862226ccbe4e69d417a4e8201073cef92a5cac9d7c049ff |
|
MD5 | c79e0df5df3943354bd96d1498d963d5 |
|
BLAKE2b-256 | 87e9065006d011962bb69c5cafd5a07b9d2e4a55fd3aab45cd181c1f33132ff1 |
Hashes for pypolyline-0.1.14-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 | 6f164f56039414df301eff4333d4f33997c6480b808457dba328753e7f8f4d46 |
|
MD5 | 95f56db73ff8c5c30709488bf58862fb |
|
BLAKE2b-256 | 1b45cc6727514c9fbef28585df9aa1213d97b64a6623fa778f65fefd0034e70e |