pypolyline

Fast Google Polyline encoding and decoding using a Rust binary

https://github.com/urschrei/pypolyline

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary

Keywords

computational-geometry cython gis google-maps google-polyline polyline rust

Keywords from Contributors

mesh interpretability sequences generic projection interactive optim hacking network-simulation
Last synced: 6 months ago · JSON representation ·

Repository

Fast Google Polyline encoding and decoding using a Rust binary

Basic Info
Statistics
  • Stars: 42
  • Watchers: 3
  • Forks: 2
  • Open Issues: 1
  • Releases: 51
Topics
computational-geometry cython gis google-maps google-polyline polyline rust
Created over 9 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

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

```python from pypolyline.cutil import encodecoordinates, decodepolyline

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'

decodedcoords = decodepolyline(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):

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

In Bibtex format:

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

Owner

  • Name: Stephan Hügel
  • Login: urschrei
  • Kind: user
  • Location: Dublin
  • Company: Trinity College Dublin

Marie Curie research fellow at TCD: smart cities and climate change. Prev: @casa-ucl. I also work on high-performance computational geometry libraries @georust

Citation (CITATION.cff)

cff-version: 1.1.0
message: "If you use this software, please cite it using these metadata."
abstract: "Pypolyline: a Python library for Google Polyline encoding and decoding"
authors:
  -
    family-names: "Hügel"
    given-names: Stephan
    orcid: "https://orcid.org/0000-0003-4379-2450"
title: "Pypolyline"
date-released: 2021-12-12
doi: "10.5281/zenodo.5774925"
keywords:
  - geo
  - gis
  - polyline
license: BlueOak-1.0.0
repository-code: "https://github.com/urschrei/simplification"
version: "0.2.72"

GitHub Events

Total
  • Issues event: 4
  • Watch event: 2
  • Delete event: 12
  • Issue comment event: 1
  • Push event: 19
  • Pull request event: 20
  • Create event: 10
Last Year
  • Issues event: 4
  • Watch event: 2
  • Delete event: 12
  • Issue comment event: 1
  • Push event: 19
  • Pull request event: 20
  • Create event: 10

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 373
  • Total Committers: 2
  • Avg Commits per committer: 186.5
  • Development Distribution Score (DDS): 0.182
Past Year
  • Commits: 36
  • Committers: 2
  • Avg Commits per committer: 18.0
  • Development Distribution Score (DDS): 0.361
Top Committers
Name Email Commits
Stephan Hügel s****l@t****e 305
dependabot[bot] 4****] 68
Committer Domains (Top 20 + Academic)
tcd.ie: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 16
  • Total pull requests: 78
  • Average time to close issues: 8 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 15
  • Total pull request authors: 1
  • Average comments per issue: 2.69
  • Average comments per pull request: 0.06
  • Merged pull requests: 72
  • Bot issues: 0
  • Bot pull requests: 78
Past Year
  • Issues: 1
  • Pull requests: 26
  • Average time to close issues: 9 months
  • Average time to close pull requests: about 15 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 26
Top Authors
Issue Authors
  • dependabot[bot] (2)
  • brad-4k (2)
  • junli-ccu (1)
  • mattiZed (1)
  • bnaul (1)
  • paro- (1)
  • chinchy (1)
  • wxd (1)
  • ahmadshiddiqn (1)
  • RenoFilla (1)
  • captchanjack (1)
  • xdmiodz (1)
  • JacobHayes (1)
  • mathewgankl (1)
  • answerquest (1)
Pull Request Authors
  • dependabot[bot] (99)
Top Labels
Issue Labels
dependencies (2) github_actions (2)
Pull Request Labels
dependencies (99) github_actions (63)

Dependencies

.github/workflows/wheels.yml actions
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/upload-artifact v2 composite
  • ncipollo/release-action v1 composite
  • oprypin/find-latest-tag v1 composite
  • pypa/cibuildwheel v2.11.4 composite
  • robinraju/release-downloader v1.7 composite
pyproject.toml pypi
setup.py pypi