GPS Track Animation Library
Project description
# Track Animation
**Track Animation** is a Python 2 and 3 library that provides and 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](https://github.com/tkrajina/gpxpy) to parse and read GPX files, [pandas](http://pandas.pydata.org/) to manipulate all the GPS data and [matplotlib](https://matplotlib.org/) to plot it and save the visualizations.
To create a basic visualization, simply read the files and pass them to the *AnimationTrack* class:
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/"
ibiza_trk = trackanimation.readTrack(input_directory)
fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.makeVideo(output_file='simple-example', framerate=60, linewidth=1.0)
```
![Simple example](example-results/simple-example.gif)
## Dependencies
* [gpxpy](https://github.com/tkrajina/gpxpy)
* [pandas](http://pandas.pydata.org/)
* [matplotlib](https://matplotlib.org/)
* [geopy](https://github.com/geopy/geopy)
* [smopy](https://github.com/rossant/smopy)
* [mplleaflet](https://github.com/jwass/mplleaflet)
* [image](http://pillow.readthedocs.io/en/3.4.x/reference/Image.html)
* [tqdm](https://github.com/noamraph/tqdm)
* [FFmpeg](https://ffmpeg.org/)
## Installation
Install **Track Animation** using [pip](http://www.pip-installer.org/en/latest/) with:
pip install trackanimation
Or, [download the source files from PyPI](https://pypi.python.org/pypi/trackanimation).
## Getting Started
You can find the following examples in the [examples.py](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.
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/"
ibiza_trk = trackanimation.readTrack(input_directory)
sant_josep_trk = ibiza_trk.getTracksByPlace('Sant Josep de sa Talaia', only_points=False)
sant_josep_trk = sant_josep_trk.timeVideoNormalize(time=10, framerate=10)
fig = AnimationTrack(df_points=sant_josep_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.makeVideo(output_file='filtering-by-place', framerate=10, linewidth=1.0)
```
![Filtering by place and normalizing](example-results/filtering-by-place.gif)
### 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.
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/ibiza.csv"
ibiza_trk = trackanimation.readTrack(input_directory)
ibiza_trk = ibiza_trk.timeVideoNormalize(time=10, framerate=10)
ibiza_trk = ibiza_trk.setColors('Speed', individual_tracks=True)
fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.makeVideo(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.makeMap(output_file='coloring-map-by-speed')
```
[Click to view the interactive map](http://htmlpreview.github.io/?https://github.com/JoanMartin/trackanimation/master/example-results/coloring-map-by-speed.html)
![Coloring tracks by their speed](example-results/coloring-map-by-speed.gif)
### Visualizing multiple set of tracks
Multiple sets of tracks can be plotted independently in the same visualization to compare them.
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/"
ibiza_trk = trackanimation.readTrack(input_directory)
sant_josep_trk = ibiza_trk.getTracksByPlace('Sant Josep de sa Talaia', only_points=False)
ibiza_trk = ibiza_trk.setColors('Speed', individual_tracks=True)
sant_josep_trk = sant_josep_trk.setColors('Speed', individual_tracks=True)
fig = AnimationTrack(df_points=[ibiza_trk, sant_josep_trk], dpi=300, bg_map=True, map_transparency=0.5)
fig.makeImage(output_file='multiple-axes')
```
![Multiple axes](example-results/multiple-axes.png)
## Documentation
More documentation and examples can be found at [Track Animation PDF document](Documentation.pdf).
**Track Animation** is a Python 2 and 3 library that provides and 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](https://github.com/tkrajina/gpxpy) to parse and read GPX files, [pandas](http://pandas.pydata.org/) to manipulate all the GPS data and [matplotlib](https://matplotlib.org/) to plot it and save the visualizations.
To create a basic visualization, simply read the files and pass them to the *AnimationTrack* class:
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/"
ibiza_trk = trackanimation.readTrack(input_directory)
fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.makeVideo(output_file='simple-example', framerate=60, linewidth=1.0)
```
![Simple example](example-results/simple-example.gif)
## Dependencies
* [gpxpy](https://github.com/tkrajina/gpxpy)
* [pandas](http://pandas.pydata.org/)
* [matplotlib](https://matplotlib.org/)
* [geopy](https://github.com/geopy/geopy)
* [smopy](https://github.com/rossant/smopy)
* [mplleaflet](https://github.com/jwass/mplleaflet)
* [image](http://pillow.readthedocs.io/en/3.4.x/reference/Image.html)
* [tqdm](https://github.com/noamraph/tqdm)
* [FFmpeg](https://ffmpeg.org/)
## Installation
Install **Track Animation** using [pip](http://www.pip-installer.org/en/latest/) with:
pip install trackanimation
Or, [download the source files from PyPI](https://pypi.python.org/pypi/trackanimation).
## Getting Started
You can find the following examples in the [examples.py](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.
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/"
ibiza_trk = trackanimation.readTrack(input_directory)
sant_josep_trk = ibiza_trk.getTracksByPlace('Sant Josep de sa Talaia', only_points=False)
sant_josep_trk = sant_josep_trk.timeVideoNormalize(time=10, framerate=10)
fig = AnimationTrack(df_points=sant_josep_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.makeVideo(output_file='filtering-by-place', framerate=10, linewidth=1.0)
```
![Filtering by place and normalizing](example-results/filtering-by-place.gif)
### 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.
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/ibiza.csv"
ibiza_trk = trackanimation.readTrack(input_directory)
ibiza_trk = ibiza_trk.timeVideoNormalize(time=10, framerate=10)
ibiza_trk = ibiza_trk.setColors('Speed', individual_tracks=True)
fig = AnimationTrack(df_points=ibiza_trk, dpi=300, bg_map=True, map_transparency=0.5)
fig.makeVideo(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.makeMap(output_file='coloring-map-by-speed')
```
[Click to view the interactive map](http://htmlpreview.github.io/?https://github.com/JoanMartin/trackanimation/master/example-results/coloring-map-by-speed.html)
![Coloring tracks by their speed](example-results/coloring-map-by-speed.gif)
### Visualizing multiple set of tracks
Multiple sets of tracks can be plotted independently in the same visualization to compare them.
```python
import trackanimation
from trackanimation.animation import AnimationTrack
input_directory = "example-routes/"
ibiza_trk = trackanimation.readTrack(input_directory)
sant_josep_trk = ibiza_trk.getTracksByPlace('Sant Josep de sa Talaia', only_points=False)
ibiza_trk = ibiza_trk.setColors('Speed', individual_tracks=True)
sant_josep_trk = sant_josep_trk.setColors('Speed', individual_tracks=True)
fig = AnimationTrack(df_points=[ibiza_trk, sant_josep_trk], dpi=300, bg_map=True, map_transparency=0.5)
fig.makeImage(output_file='multiple-axes')
```
![Multiple axes](example-results/multiple-axes.png)
## Documentation
More documentation and examples can be found at [Track Animation PDF document](Documentation.pdf).
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.0.tar.gz
(10.4 kB
view details)
Built Distribution
File details
Details for the file trackanimation-1.0.0.tar.gz
.
File metadata
- Download URL: trackanimation-1.0.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f2e859f6d1d16629afc67a4b4e42e8ab7c9cd800962abcf919e6f465b2996d5 |
|
MD5 | 80ce4262f7b340c335ecf2750598313f |
|
BLAKE2b-256 | 1f54e952ae410b813f0f16bcabd7be0153a17f2795d9d16e9213d277aeb518d3 |
File details
Details for the file trackanimation-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: trackanimation-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68e171bfab500588b3dfbaec3a94f8292ea46f8fb252d661ab0ab85c31eb08f |
|
MD5 | b4c67d69880f64c745ce16bb20626672 |
|
BLAKE2b-256 | 1a88038a59d4894d9dcc2d9b3b7ceddf36f0c15687ba102dc6c8202c27490e85 |