Skip to main content

Track processing library for Python 3

Project description

TrackToTrip3

TrackToTrip3 is a Python 3 adaptation of the TrackToTrip library used to process GPS tracks.

The main goals are to transform a (gpx) track into a trip.

track raw representation of a GPS recording. It is not precise, has noise and valuable information is hidden.

trip result of one or more processed tracks. Its start and end points have semantic meaning, such as home, work or school. It has less errors and it's compressed, with as little information loss as possible. In short, a trip is an approximation of the true path recorded.

Installing

You can install TrackToTrip3 by running the following command:

 $ python setup.py install

NOTE: TrackToTrip3 requires Microsoft Visual C++ 14.0. It can be found using the Build Tools for Visual Studio 2022

Python 3.x is required.

Overview

The starting points are the Track, Segment and Point classes.

Track

Can be loaded from a GPX file:

from tracktotrip3 import Track, Segment, Point

track = Track.from_gpx('file_to_track.gpx')

A track can be transformed into a trip with the method to_trip. Transforming a track into a trip executes the following steps:

  1. Smooths the segments, using the kalman filter

  2. Spatiotemporal segmentation for each segment, using the DBSCAN algorithm to find spatiotemporal clusters

  3. Compresses every segment, using spatiotemporal-aware compression algorithm

A track is composed by Segments, and each segment by Points.

It can be saved to a GPX file:

with open('file.gpx', 'w') as f:
  f.write(track.to_gpx())

Segment

A Segment holds the points, the transportation modes used, and the start and end semantic locations.

Point

A Point holds the position and time. Currently the library doesn't support elevation.

Command line tools

In addition to the library, TrackToTrip3 offers three command line tools outside of the library to manipulate GPS tracks and to generate classifier.

tracktotrip_utils

usage: tracktotrip_utils.py [-h] [-a] [-s] [-o] [--eps EPS]
                            [--mintime MINTIME] [--seed SEED]
                            track [track ...] output_folder

Manipulate tracks

positional arguments:
  track              track to process, must be a gpx file
  output_folder

optional arguments:
  -h, --help         show this help message and exit
  -a, --anonymize    anonymizes tracks, by doing random rotations and
                     translations
  -s, --split        splits tracks so that each file contains a segment
  -o, --organize     takes all tracks and split them, naming them according
                     with their start date
  --eps EPS          max distance to other points. Used when spliting.
                     Defaults to 1.0
  --mintime MINTIME  minimum time required to split, in seconds. Defaults to
                     120
  --seed SEED        random number generator seed. Used when anonymizing

tracktotrip_geolife_dataset

The GeoLife Tracjectory dataset can be found here. The datasetFolder argument should point to the Data folder in the GeoLife Trajectory dataset folder.

usage: tracktotrip_geolife_dataset.py [-h] [-o outputFolder] [-d]
                                      datasetFolder

GeoLife Trajectory dataset transportation mode extractor. Extracts
transportation mode from the dataset, into individual files, annotated with
the following format: [transporation mode].[control].[nPoints].[original file
name].gpx



positional arguments:
  datasetFolder         Path to the GeoLife dataset folder

optional arguments:
  -h, --help            show this help message and exit
  -o outputFolder, --output outputFolder
                        Path to processed dataset

License

MIT license

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

tracktotrip3-0.1.1.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

tracktotrip3-0.1.1-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file tracktotrip3-0.1.1.tar.gz.

File metadata

  • Download URL: tracktotrip3-0.1.1.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for tracktotrip3-0.1.1.tar.gz
Algorithm Hash digest
SHA256 084e96180c03701915b551b3ce8b61bad44d7de54c3d20e54123f614371adb10
MD5 b90e33f198faefcb1e52f9e9c90dfb34
BLAKE2b-256 4a7961b33a93fff52bdae2199e03b44bf27672db3780b24312211ab5d6c6191b

See more details on using hashes here.

File details

Details for the file tracktotrip3-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tracktotrip3-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 111902dc4f4b0b3dcebdc06ea9b1ce028757899823bc071bfea6f4e892ea9ef7
MD5 b26e91ee661ff6103ef07b48cbb914fb
BLAKE2b-256 4a7d30b512b7bad6b6c3907b7c7cbedb600e602e9296cbb4e6e3e3eeb0bcfa97

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