TrackToTrip4
TrackToTrip4 is a fork of TrackToTrip3, a Python 3 library used to process, simplify and clean GPS tracks. The original TrackToTrip3 library is no longer maintained, and this fork aims to keep it up to date with the latest Python versions and dependencies, plus adding new features and improvements.
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 TrackToTrip4 by running the following command:
$ python setup.py install
NOTE: TrackToTrip4 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 tracktotrip4 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:
-
Smooths the segments, using the kalman filter
-
Spatiotemporal segmentation for each segment, using the DBSCAN algorithm to find spatiotemporal clusters
-
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
Metadata
Release files for tracktotrip4 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tracktotrip4-0.1.3.tar.gz | 30.7 kB | Without provenance | Details for tracktotrip4-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tracktotrip4-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for tracktotrip4-0.1.3-py3-none-any.whl |
Total release size: 64.5 kB
Release files / tracktotrip4-0.1.3.tar.gz
| Download URL | tracktotrip4-0.1.3.tar.gz |
|---|---|
| Size | 30.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c6e0cb9d2db0bfd6b99dd1067217a7ef5baf1705de078c0b60810fdc542a466
|
|
BLAKE2b-256 checksum How to use checksums |
664c2a12c0f28d67c60ceff94ed715c580001f445737630fbcba1f20e3f67931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / tracktotrip4-0.1.3-py3-none-any.whl
| Download URL | tracktotrip4-0.1.3-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8586be23aae9b3368a8618dfd671f0db393e21322fcb404a92c80285869c5f58
|
|
BLAKE2b-256 checksum How to use checksums |
b2d5a2fb2e5a07aab13dde53b0220df110c7fadf3dc2d99e24d42ed039b09c09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Security for tracktotrip4 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.