mlaldrid

mlaldrid / gpxsummary / 0.1.0

README.md

Overview

Generate a summary of track data from a GPX file, a common interchange format for GPS tracking data. The result includes global and per-track summaries of distance traveled, elapsed time, moving time, and elevation gain. Distance and elevation gain are reported in meters. Note that any route or waypoint information from the GPX file is not included in the summary.

Moving time and elevation gain are calculated in a manner to approximate the summaries provided by Strava for tracked activities such as bike rides. Moving time is incremented only when the distance between subsequent track points exceeds a configurable minimum velocity threshold. Elevation gain is incremented only when there is a positive elevation differential between subsequent track points when sampled at a configurable sample period. The sampling here is to account for possible jitter in tracked elevation.

Usage

Input

The algorithm expects JSON input with the following fields:

ParameterDescription
gpx_urlURL to the GPX file
movement_threshold_m_per_secMinimum movement velocity (m/s) to increment moving time (optional; defaults to 0.5)
elev_sample_secondsSample rate for calculating elevation gain (optional; defaults to 3)

Output

The algorithm output is a JSON payload with the following fields:

ParameterDescription
total_distanceTotal distance traveled
total_elapsed_secondsTotal elapsed time
total_moving_secondsTotal moving time
total_elevationTotal elevation gain
tracksA list of objects, one per track, containing each track's distance, elapsed_seconds, moving_seconds, and elevation

Examples

Input:

{
  "gpx_url": "data://mlaldrid/samplegpx/sample1.gpx"
}

Output:

{
  "total_distance": 50614.63436015703,
  "total_elapsed_seconds": 9836,
  "total_elevation": 136.19999999999982,
  "total_moving_seconds": 7389,
  "tracks": [
    {
      "distance": 50614.63436015703,
      "elapsed_seconds": 9836,
      "elevation": 136.19999999999982,
      "moving_seconds": 7389
    }
  ]
}