/TraceVis

Trace Visualization for running log

Primary LanguageJupyter NotebookGNU Affero General Public License v3.0AGPL-3.0

TraceVis: Trace Visualization for running logs

This project tries to visually document the training process of my first marathon (Ann Arbor Marathon on October 1st, 2023). I used Nike Running Club (NRC) to record the training for this marathon.

This project visualizes trace files (.gpx) on map using plotly and mapbox. There is native animation function in plotly. However, plotly does not support such large amount of frame, and it becomes too slow to be feasible. The animation is in stead generate by putting together many .png file, which each is generated by plotly separately.

A sample output:

Snapshot of 20231111

To use this repo

Setup

This repo is implemented in Python 3 and uses Jupyter Notebook. See required libraries in requirements.txt.

Required inputs:

  1. Running files in Data/*.gpx
  2. Configuration file config.yaml

Expected outcome:

  1. Static image of all the trace on the map.
  2. Animations (.gif) of trajectories on the map in the order of date.

Process

  1. Gather running data in .gpx files
    1. All traces should be in the Data folder as Data/*.tcx.
  2. Setup configuration file config.yaml
    1. set input directory for .gpx if other than Data. Set output directory if other than Image.
    2. Register Mapbox for certain map styles and store the Mapbox token in the key mapbox_access_token.
    3. Adjust mapbox_confi for mapbox map settings such as map center and zoom. The style of the map is also set here.
    4. Adjust fig_layout for plotly figure size and layout
    5. Adjust animation for settings related to animation output.
      1. SPF_plotly is the trace duration for a frame in plotly native animation plot.
      2. SPF_gif is the trace duration for a frame in .gif output
      3. FPS_gif is the frame rate for .gif output
  3. StaticVisualization.ipynb is used to generate a static image with all traces.
  4. AnimatedVisualization.ipynb is used to generate a .gif image for all traces.

Related Project