Skip to main content

Trajectory data lossy compression format based on Google's Encoded Polyline Algorithm Format

Project description

Test Status PyPI downloads MIT License

trajectory

trajectory is a library for lossy compression of trajectory data based on Google’s Encoded Polyline Algorithm Format (http://goo.gl/PvXf8Y). It is heavily based on (in fact forked from) https://github.com/hicsail/polyline.

Installation

trajectory can be installed using pip or easy_install

$ pip install trajectory
or
$ easy_install trajectory

API Documentation

Encoding

To serialize a trajectory (set of (lat, lon, unix time in seconds) tuples)

import trajectory
trajectory.encode([
    (38.500, -120.200, 1582482601),
    (40.700, -120.950, 1582482611),
    (43.252, -126.453, 1582482627)
], 5)

This should return _p~iF~ps|U_ynpijgz~G_ulLnnqC_c`|@_mqNvxq`@__t`B.

You can set the required precision with the optional precision parameter. The default value is 5.

Decoding

To deserialize a trajectory (set of (lat, lon, unix time in seconds) tuples) represented by an encoded string

import trajectory
trajectory.decode('_p~iF~ps|U_ynpijgz~G_ulLnnqC_c`|@_mqNvxq`@__t`B', 5)

This should return the following:

[
    (38.500, -120.200, 1582482601),
    (40.700, -120.950, 1582482611),
    (43.252, -126.453, 1582482627)
]

You can set the required precision with the optional precision parameter. The default value is 5.

Development

Setup Dependencies

$ poetry install

Running Tests

$ poetry run pytest

Contributing

Issues and pull requests are welcome.

  • For proposing new features/improvements or reporting bugs, create an issue.
  • Check open issues for viewing existing ideas, verify if it is already proposed/being worked upon.
  • When implementing new features make sure to add relavant tests and documentation before sending pull requests.

Project details


Release history Release notifications

Download files

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

Files for trajectory, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size trajectory-0.1.1-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size trajectory-0.1.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page