Skip to main content

Common operations and transformations on routes represented by a 2D line in xy space.

Project description

Routely

https://travis-ci.com/jhags/routely.svg?branch=main https://coveralls.io/repos/github/jhags/routely/badge.svg?branch=main https://readthedocs.org/projects/routely/badge/?version=latest

Travis build Python 3.6, 3.7, 3.8.

Intro

Common operations and transformations on routes represented by a 2D line in xy space

Route is designed to provide many of the common route operations and transformations to make route processing simpler and quicker.

A route is represented by a series of point coordinates on a two dimensional x-y plane. Z-axis data can be specified as well, however the primary focus of these common transformations are based on the x-y plane data with z-axis data being transformed accordingly.

The primary focus is on x-y plane data because z-axis data does not have to represent a path through three dimensional space, rather z-data can represent additonal layers of route data that correspond to the x-y path.

For example, a runner may be tracking pace or heartrate, a car will have changes in speed, etc. Therefore, transformations are primarily concerned with the x-y route taken.

Installation

pip install routely

Quick start

To begin with, let’s define a path that comprises two lists of x and y points that together form the coordinates of the line.

# x and y coordinates of a path.
x = [-5, 5, 15, 25, 20, 0]
y = [0, 10, 40, 15, 5, 20]

To make use of Routely, we can pass these lists of x and y points to Routely’s Route class.

from routely import Route

r = Route(x, y)

# Plot x vs y
r.plotroute()
https://raw.githubusercontent.com/jhags/routely/main/docs/images/plot_1.png

You can add z-axis data too, which should be passed as a dictionary. This enables you to have one or more z-axis datasets.

# Add a few z-axis datasets
z1 = [0, 1, 2, 3, 4, 5]
z2 = [0, 1, 2, 3, 2, 0]

# z-axis data must be passed as a dictionary
z_data = {'foo':z1, 'bar':z2}

r = Route(x, y, z=z_data)

# Plot z-axis data
# Note that z-axis data is plotted against the distance along the route
r.plot_z()
https://raw.githubusercontent.com/jhags/routely/main/docs/images/plot_2.png

Using the Route object, you can now quickly and easily get key properties of the route data such as:

# Get the bounding box and center coordinates of the route
r.bbox()
((-5, 0), (25, 40))

r.center()
(10.0, 20.0)

# The absolute width, height and centerof the route
r.width()
30

r.height()
40

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

routely-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

routely-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file routely-0.1.0.tar.gz.

File metadata

  • Download URL: routely-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for routely-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d3a559f930fc6dd1d39a24469659e93b4eec48f0aae727e3840040818b9e2d0d
MD5 ab1e42a7946f11fad6993c73447657b1
BLAKE2b-256 e91974a736df1e0f43b2e7602570a5c7a2bf8a0819e51ec4c3c5e27e0debbde7

See more details on using hashes here.

File details

Details for the file routely-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: routely-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for routely-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40dde682a4a82b0352d4fe0d68da1c384201185ef437436ba6dec751d1050356
MD5 67a466cece8f1218389e55c109ed4fee
BLAKE2b-256 703adccc4929da2c2dc240ce9ddb82188359d13a06d4118ed52daa2d1bc53b52

See more details on using hashes here.

Supported by

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