Skip to main content

GPS Track Animation Library

Project description

Track Animation is a Python 2 and 3 library that provides an easy and user-adjustable way of creating visualizations from GPS data easily and without any kind of technical tie for the user. It allows to import GPS data from GPX (GPS eXchange Format) and CSV files in order to manipulate it and, finally, create videos, images, sequences of images or interactive maps to analyze the tracks based on their elevation, speed, duration or any other indicator.

The main third party libraries that Track Animation uses are gpxpy to parse and read GPX files, pandas to manipulate all the GPS data and matplotlib to plot it and save the visualizations.

To create a basic visualization, simply read the files and pass them to the AnimationTrack class:

import trackanimation
from trackanimation.animation import AnimationTrack

input_directory = "example-routes/"
ibiza_trk = trackanimation.read_track(input_directory)

fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.make_video(output_file='simple-example', framerate=60, linewidth=1.0)

Simple-Example

Dependencies

Installation

Install Track Animation using pip with:

pip install trackanimation

Or, download the source files from PyPI.

Getting Started

You can find the following examples in the examples.py file.

Filtering by place

It is possible to filter a set of tracks to retrieve only the points that belong to an specific place or the whole tracks that have passed by there. With the function timeVideoNormalize, all the tracks will start and end at the same time in the video, specyfing its duration and frame rate in the parameters. In the next example, the video created has a duration of 10 seconds with 10 frames per second.

import trackanimation
from trackanimation.animation import AnimationTrack

input_directory = "example-routes/"
ibiza_trk = trackanimation.read_track(input_directory)
sant_josep_trk = ibiza_trk.get_tracks_by_place('Sant Josep de sa Talaia', only_points=False)
sant_josep_trk = sant_josep_trk.time_video_normalize(time=10, framerate=10)

fig = AnimationTrack(df_points=sant_josep_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.make_video(output_file='filtering-by-place', framerate=10, linewidth=1.0)

Filtering-Place

Coloring tracks by one indicator

Furthermore, an indicator of the tracks can be visualized as a palette of colors to make the analysis and the interpretation of the data easier and effective.

import trackanimation
from trackanimation.animation import AnimationTrack

input_directory = "example-routes/ibiza.csv"
ibiza_trk = trackanimation.read_track(input_directory)
ibiza_trk = ibiza_trk.time_video_normalize(time=10, framerate=10)
ibiza_trk = ibiza_trk.set_colors('Speed', individual_tracks=True)

fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.make_video(output_file='coloring-map-by-speed', framerate=10, linewidth=1.0)

# Variable 'bg_map' must be to False in order to create an interactive map
fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=False, map_transparency=0.5)
fig.make_map(output_file='coloring-map-by-speed')

Click to view the interactive map

Coloring-Tracks

Visualizing multiple set of tracks

Multiple sets of tracks can be plotted independently in the same visualization to compare them.

import trackanimation
from trackanimation.animation import AnimationTrack

input_directory = "example-routes/"
ibiza_trk = trackanimation.read_track(input_directory)
sant_josep_trk = ibiza_trk.get_tracks_by_place('Sant Josep de sa Talaia', only_points=False)

ibiza_trk = ibiza_trk.set_colors('Speed', individual_tracks=True)
sant_josep_trk = sant_josep_trk.set_colors('Speed', individual_tracks=True)

fig = AnimationTrack(df_points=[ibiza_trk, sant_josep_trk], dpi=300, bg_map=True, map_transparency=0.5)
fig.make_image(output_file='multiple-axes')

Multiple-Axes

Documentation

More documentation and examples can be found at Track Animation PDF document.

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

trackanimation-1.0.5.tar.gz (8.8 MB view details)

Uploaded Source

Built Distribution

trackanimation-1.0.5-py2.py3-none-any.whl (18.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file trackanimation-1.0.5.tar.gz.

File metadata

  • Download URL: trackanimation-1.0.5.tar.gz
  • Upload date:
  • Size: 8.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for trackanimation-1.0.5.tar.gz
Algorithm Hash digest
SHA256 acd0456cf670927dbd33f2490bdb3c34e478bed443f272ad043949504f9cf1a0
MD5 7d5646e49ae4cedef1efdefbb4854dae
BLAKE2b-256 94b53037ac464a87d4850071374a9ee3b1e8f0a433e9feaf07285d7f8d2145d2

See more details on using hashes here.

File details

Details for the file trackanimation-1.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: trackanimation-1.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for trackanimation-1.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 076f71fe2cf45da3f894ce0aa254162e60650d91c424fac8ce78e6eb24b8090a
MD5 7c9b05419ecf236d676a6ee5213b8b1d
BLAKE2b-256 fcad9fe7e05484d1c648496979101163d9c3db57f3b0f3e6f91c0dfc31ad7e92

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