Skip to main content

Common operations and transformations on routes represented by a 2D line in xy space and corresponding z-axis data.

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.2.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.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: routely-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9

File hashes

Hashes for routely-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dfb5b53356b5b3d95315bd36ec744927fd3306a44a5b365c556a03ffaf718681
MD5 907e91c5b404530364c21aacce82ebfc
BLAKE2b-256 fd9bab9c13df3589f50f50521bc205dd0ec3e42210a87e48eb20e464657ac492

See more details on using hashes here.

File details

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

File metadata

  • Download URL: routely-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9

File hashes

Hashes for routely-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0420349633d99e84aadb2c277bf0a44018255eeae7d990dae621b8b31d50a090
MD5 889597a341c56e0a758e35a8a7ab055d
BLAKE2b-256 8bb0bb56a3b40893aa613cc109533eadda9e6406d790a14e5e570dfc041ca29b

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