mlaldrid / gpxsummary / 0.1.0


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.



The algorithm expects JSON input with the following fields:

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)


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

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



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


  "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