Skip to main content

Fast Google Polyline encoding and decoding using Rust FFI

Project description

example workflow Coverage Status DownloadsDOI

Fast Google Polyline Encoding and Decoding

Installation

pip install pypolyline

Supported Python Versions

  • Python 3.9
  • Python 3.10
  • Python 3.11
  • Python 3.12
  • Python 3.13

Supported Platforms

  • Linux (manylinux*-compatible, x86_64 and aarch64)
  • macOS (x86_64 and arm64)
  • Windows 64-bit

Usage

Coordinates must be in (Longitude, Latitude) order

from pypolyline.cutil 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)

Error Handling

Failure to encode coordinates, or to decode a supplied Polyline, will raise a RuntimeError containing information about the invalid input.

How it Works

FFI and a Rust binary

Is It Fast

…Yes.
You can verify this by installing the polyline package, then running benchmarks.py, a calibrated benchmark using cProfile.
On an M2 MBP, The pure-Python test runs in ~2500 ms, the Flexpolyline benchmark runs in ~1500 ms and The Rust + Cython benchmark runs in around 80 ms (30 x and 17.5 x faster, respectively).

License

The Blue Oak Model Licence 1.0.0

Citing Pypolyline

If Pypolyline has been significant in your research, and you would like to acknowledge the project in your academic publication, we suggest citing it as follows (example in APA style, 7th edition):

Hügel, S. (2021). Pypolyline (Version X.Y.Z) [Computer software]. https://doi.org/10.5281/zenodo.5774925

In Bibtex format:

@software{Hugel_Pypolyline_2021,
author = {Hügel, Stephan},
doi = {10.5281/zenodo.5774925},
license = {MIT},
month = {12},
title = {{Pypolyline}},
url = {https://github.com/urschrei/simplification},
version = {X.Y.Z},
year = {2021}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypolyline-0.5.4.tar.gz (19.8 kB view details)

Uploaded Source

Built Distributions

pypolyline-0.5.4-cp313-cp313-win_amd64.whl (152.8 kB view details)

Uploaded CPython 3.13 Windows x86-64

pypolyline-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (649.9 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

pypolyline-0.5.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (631.7 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ARM64

pypolyline-0.5.4-cp313-cp313-macosx_11_0_arm64.whl (228.4 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pypolyline-0.5.4-cp313-cp313-macosx_10_13_x86_64.whl (242.1 kB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pypolyline-0.5.4-cp312-cp312-win_amd64.whl (153.0 kB view details)

Uploaded CPython 3.12 Windows x86-64

pypolyline-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (652.7 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pypolyline-0.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (636.0 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

pypolyline-0.5.4-cp312-cp312-macosx_11_0_arm64.whl (229.5 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pypolyline-0.5.4-cp312-cp312-macosx_10_13_x86_64.whl (243.2 kB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

pypolyline-0.5.4-cp311-cp311-win_amd64.whl (152.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

pypolyline-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (665.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pypolyline-0.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (650.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

pypolyline-0.5.4-cp311-cp311-macosx_11_0_arm64.whl (228.5 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pypolyline-0.5.4-cp311-cp311-macosx_10_9_x86_64.whl (242.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pypolyline-0.5.4-cp310-cp310-win_amd64.whl (152.6 kB view details)

Uploaded CPython 3.10 Windows x86-64

pypolyline-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (622.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pypolyline-0.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (608.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

pypolyline-0.5.4-cp310-cp310-macosx_11_0_arm64.whl (228.5 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pypolyline-0.5.4-cp310-cp310-macosx_10_9_x86_64.whl (242.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pypolyline-0.5.4-cp39-cp39-win_amd64.whl (153.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

pypolyline-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (625.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pypolyline-0.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (611.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

pypolyline-0.5.4-cp39-cp39-macosx_11_0_arm64.whl (229.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pypolyline-0.5.4-cp39-cp39-macosx_10_9_x86_64.whl (243.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pypolyline-0.5.4.tar.gz.

File metadata

  • Download URL: pypolyline-0.5.4.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pypolyline-0.5.4.tar.gz
Algorithm Hash digest
SHA256 5c9e1754f4df30f11c6307d8ff69c8487648535c396448e6b99ed2e8b3f7020c
MD5 07cee023edeb1e3e5d8e1733905fb1f0
BLAKE2b-256 8f1e03797242071475f072283e0e3231487aac1e1a55feecb1b4c90c2cc3e323

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c1eab59240beefb1971933650966900eb50e540c960f50148e2e7ec8cedf5dd8
MD5 4e9911f2fdf6d7e41eda4e9c8bf3e75b
BLAKE2b-256 cc308bc1b7083889b58477de977ce68f52c803f19e62be0aeebd5a2c8a1d80a6

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4518cca28ce4e84a545136ad0fced53b365fe0f9fd204a904333de620f09f8bc
MD5 421cfd2b77cb49e3e2b7e2d072094f08
BLAKE2b-256 f1b29ea0f4b34397f0b0b203e6d0eabb7d3ad90175e858c7019d457a89b97f44

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 85381427927d046d711df29b16f112d78b1fde7f6ac4831d449700211bf9b9bd
MD5 96fad963e7f5eb992134774aad3d4a11
BLAKE2b-256 e122d71a5336f1bb84687c96830d4be9f4fbe09535f09a905d8d16396cd7b14a

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 916aad4691b18d64691ba51bf74669faf58fa61f6205962d3e1c805f0cb5989f
MD5 a2b609ffed55fd66c21334fc8fe5b56c
BLAKE2b-256 4c1f7b8e2c2806f17dafde43b382e6e38c6b93e7c1adf59844784f037223fc50

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 dcb4131046532cc5ed788535c8c78ee0e2c3d98ce64f0a430ef7a4acdd2c7ec7
MD5 055d301d363c3a45f3a841d418bef33e
BLAKE2b-256 722b726d30077585003c6e3ea3e80f1fec59b3a1e857915c0ad55fdefbff866e

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 650b72f12ac6970af8d1eacbb2bdd073a56d243845ea4d33d67555f678c8efe5
MD5 5a7e80116ab7a31a8c1f67895996424e
BLAKE2b-256 9a27e384617fc508179dd23adca70b981d49ad7bafa210d68a2f13527f4d5ad5

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd083a36c775d479ccc0e9e9d9c6b22f1eb78017b17687e5da716d4486491360
MD5 0fc3b8ffb9f653f3c0a47f0854a3461f
BLAKE2b-256 b411af23cf9c0f2f46adc817f9b26ca75e7268d570492a07cad922346b3b7989

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bdf8801faea89fd8aac4ff57666b18a9becc37e54a94afa534268583bdb261d9
MD5 389d57abc980260654df45229409d1d6
BLAKE2b-256 e30c56abe07d94bf81a26bf62ac0dd26cabe22d0a940d5e00fe416f5323addd0

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61ee08f15072e20900bf2bd14c78ee8d89927c3ac32197d7b533df315067837b
MD5 dbb50af5048edd5811dcdaf1142eeac3
BLAKE2b-256 8dfe124058971b83c181d31235cf03bd40c0c76fb36c1785d333d0037d225298

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a30edb6d914074a5c13fe340808c908fdaf2e22f02c134a132e9c4bab5f34c4f
MD5 fcd4b9b845d11a28d5bdd2b082f9e801
BLAKE2b-256 81ff56ed06b294ccf58e1c9dd0c943ce9e48f9213fa1dc7bf041c2b582cbe78b

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 90754fab70549f609c062e07c191398d267550191df850751487177b0d59eef6
MD5 3e782288cb56311c9ba14d3f8889cb32
BLAKE2b-256 66e1cf0ab4c707d9d74f45a8bc6921bbd16b401c5849247a37ea2d0e72553593

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5f7760bebfaeb61e7b2e43bc008952140a72780e7bfacbc3644e981fbd6ca49
MD5 21760130c5b11c46fd642d802730c271
BLAKE2b-256 b478bc8bcd6b39f0e566b3127ac7e629b3426fb1b778bab6333d1f3867a95219

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c580a2ed2cc589b1b72e8df88d7149262d37760ec18774d1789c310a18872dad
MD5 c93cc0c59453f92f28edf3a09b4a4b60
BLAKE2b-256 e5fe1cd872685d4ac6a1a0479e714e321514b5858529576ced75da99d6da716c

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77c017b0d167dc1cb78044c002b208367bd8778b07e9362c3a26fa9487a8ff0e
MD5 4db68e0b2224fcae0c13160dc138ffe2
BLAKE2b-256 a2d6234209f90ce426f3c3183e345a1f4ad0733e95878379b91ccbe3685369c3

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 63496444868258a58bfee4a8a515108805f04967ca239d5293701e2c47cc8b79
MD5 3a3d789eae535319549e8b58537911ae
BLAKE2b-256 b4895f8068af81bf40f9a9ff91c1e6ca7c3553ccc9b87d93be55067469750285

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7be332549de88d4fa6930fd910276236254ae2f13519e502a2d3dbd458334e30
MD5 47f16e019381bbd7031cd659b9113866
BLAKE2b-256 453c8f975e3b1cc26148201d6078fb512669479ab17cd86c8bb437a765e8913b

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87b9c37a343d24ca84dc6132c901e502466f0c93138a8adaa70d453453d89ee6
MD5 c6feb889c2099d33b826765ea95bb6c7
BLAKE2b-256 0e59826aaa6468b6cf908fe6f5019cd7bbaacae0aeb37116dccb51638232c4c2

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1523354ad18d80915d6d33f8f9e87a367a8b96071362042e91014494547695ba
MD5 eb6a5e72ef0082e3b5e5f1799bee03a0
BLAKE2b-256 ce4862a6da69456acc406f230d5d0381cc03e872c0af26940153e71e99f4f4b5

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18d444d33416852e556f4d49f2e7e23d239141593434e860296aa16c09b2627f
MD5 1eb6f439acca370e57afad33a6aebfc9
BLAKE2b-256 67cd2b96d0a27c15120b630d02318c88d4743eee5f1072a907bbc66bb251ee51

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0934bd63b08215ed64fa5c4a5c15a9975bda8239c175ef17eaed973a76dc484b
MD5 dce66ad515e8f6a5e4d6c108242bea3d
BLAKE2b-256 737040a25754f76e0b46e1981be03da8e196b154c188244c230b3e7e76d206ff

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pypolyline-0.5.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 153.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pypolyline-0.5.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 196057db9b7d34ba968fd6305134b24db693b9f043707ae4d47841301167a3a1
MD5 a2cf9e280d3d71b242388d80ea658cb7
BLAKE2b-256 11d750a5a85d074fd5b830b8de8a4ba9efd918b419b5217535d054a14fb7edb0

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa1284c886b45339bf107e8c7f38799421bd0033921e520c194c319d5ff96080
MD5 b63c7b1e3f7b39ce46a4a44f050aa1c5
BLAKE2b-256 f691e334102c07de274b03d24b7a63ce7efc8cc4384ebe62bf7a2e9112533a06

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9c8106f6703616dd50d3560fe5e4a79b2a11db896fff950092a7c7255c64bcc
MD5 dc5e1a4d5c243e71f46df569346e8ce9
BLAKE2b-256 874370d666855dff4e31e9e692328662dcf4fd1b9442c30c865879c5dd5d5890

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3cc7848007833a33f89b3fdafbdc66b81d0f8ee8981e906b26f22ba3407e417
MD5 408dbc159b9dfb5a14973bdde79dea24
BLAKE2b-256 b02bdd975e7eda8782d3872d58a1fffd2b9fe4dad900de8c929c54255f059a67

See more details on using hashes here.

File details

Details for the file pypolyline-0.5.4-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypolyline-0.5.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 28288ff64eb0f7e3f4d7ac5559500ca1af89da289de156d8ccb1e8290ede606e
MD5 b12d053d25e0d89b51c7e063a079d9ad
BLAKE2b-256 d848a446aa94561c1e3681c59824913f828612d26c0368abd721cd96e3c16e9a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page