Recent Changes - Search:

add Cookbook page

hide Cookbook

Cookbook


hide Topics

Topics

show Changed

Changed

Visitor's book Site map pmwiki-2.3.37

Gpx Stat

To do
  • change skiwi
  • remove this comment

GpxStat version 2024-05-05

Summary: A recipe to display statistics about a GPX file
Version: 2024-05-05
Prerequisites: PmWiki 2.3.33; PHP 8.3
Status: Beta
Maintainer: skiwi
Licence: GPL3#
Categories: Maps Markup Includes
Users: (view / edit)
Discussion: GpxStat-Talk

Questions answered by this recipe

How can I display information from a .gpx track file?

Description

This recipe extracts and derives information from a .gpx file. Information available includes times, duration, speed, and elevation.

It provides a single line directive that implements a display of information contained in, and derived from, .gpx file .

(:gpxstat gpx="wiki file name" display="layout" timezone="time/zone":).

The recipe uses a simple sliding window algorithm to remove outlier points and smooth the trace. An empirical 2.5 standard deviations from the average of the variation between points is used to set a threshold outside of which points are replaced by an estimated value.

Different layout outputs can be selected to show the information relevant to the activity that generated the track. Output is tabular.

Installation

Usage

Place the directive, as follows, in your PmWiki page.

(:gpxstat gpx='GroupName.PageName/filename.gpx' display='table,analyse' timezone='time/zone':)

Parameters are

gpx="groupname.pagename/filename"
this parameter is mandatory, the groupname and pagename are optional
display="layout"
this parameter is optional. Layout values are
  • table (of all available values)
  • tramp (i.e. walk)
  • ski
  • drive (also boat, train, fly in case these are differentiated in the future)
  • analyse (to assist with understanding the .gpx file)
default if not supplied all available values are displayed in a column
stoppedthreshold="speed"
this parameter is optional. Set the speed in km/h below which points count as stopped, overrides default and config value if specified
timezone="timezone/name"
this parameter is optional. Timezones recognised are those from the IANA / Olson timezone database. A conversion from timezone abbreviations is also attempted. You can also try the keyword 'detect' to calculate the timezone from the first point on the track, YMMV.
startname="location name"
this parameter is optional. Replaces the text "Start:"
endname="location name"
this parameter is optional. Replaces the text "End:"
banner="on", "off", or "version"
this parameter is optional. Enables (default), disables, or shows banner with version

GPX track files do not always comply with the GPS exchange format standard. This recipe takes precautions to handle some variances. If you have a .gpx file that does not work as expected with this recipe please send it for analysis along with a description of the issue.

Example output

display=default

GpxStat 2024-05-05
Distance: 13.6 km
Max speed: 1.3 km/h
Avg dsc speed: 3.1 km/h
Avg asc speed: 2.3 km/h
Avg moving speed: 2.6 km/h
Avg speed: 2.3 km/h
Min elev: 96 m
Max elev: 468 m
Start elev: 220 m
End elev: 210 m
Elev loss: -10 m
Ascent: 1,649 m
Descent: 1,665 m
Start: 08:33
End: 14:22
Elapsed: 05:49 h
Duration: 05:49 h
Duration moving: 05:17 h
Duration ascent: 02:15 h
Duration descent: 01:24 h
Duration stopped: 00:31 h
# Points: 2,987

Track date (NZDT): 2020-09-30
Track name: Example GPX track
A walk in the hills
Track desc: Example for PmWiki GpxStat recipe
File: "https://kiwiwiki.nz/pmwiki/uploads/Cookbook/GpxStat/Example track.gpx"

display=tramp

Start: 08:33 Start elev: 220 m Max elev: 468 m Distance: 13.6 km
End: 14:22 End elev: 210 m Ascent: 1,649 m Avg moving speed: 2.6 km/h
Duration: 05:49 h Elev loss: -10 m Descent: 1,665 m Duration moving: 05:17 h

display=table

Track name: Example GPX track
A walk in the hills
Track desc: Example for PmWiki GpxStat recipe
Distance: 13.6 km Avg speed: 2.3 km/h Start elev: 220 m
Ascent: 1,649 m Avg moving speed: 2.6 km/h Min elev: 96 m End elev: 210 m
Descent: 1,665 m Max speed: 1.3 km/h Max elev: 468 m Elev loss: -10 m
Duration: 05:49 h Duration moving: 05:17 h Duration stopped: 00:31 h GpxStat
Start: 08:33 End: 14:22 Track date (NZDT): 2020-09-30 Time zone: Pacific/Auckland
# Points: 2,987 Threshold speed: 0.8 km/h
File: "https://kiwiwiki.nz/pmwiki/uploads/Cookbook/GpxStat/Example track.gpx"

Configuration

config.php settings

You can set the following in config.php before including the recipe. for example:

$GpxStatDebug = true; # results may vary
$GpxStatThresholdSpeed = 1; # 1 km/h under which it is considered to be not moving
$GpxStatDTimeFmt = 'H:i'; # e.g. 'Y-m-d T H:i:s'
$GpxStatDateFmt = 'Y-m-d'; # e.g. 'Y-m-d T H:i:s'
$GpxStatBanner = 'on'; # 'off', or 'version'

CSS style

The class ".gpxstat" is used to format the output. A default set of formatting is provided in $HTMLStylesFmt['GpxStat'] = '.gpxstat { ... }';. Defining this variable in config.php before the recipe is included will override the defaults.

Change log / Release notes

2024-05-05 Update for PHP 8 warnings 2024-02-06 Add average descent/ascent speed for skiing 2024-01-10 Add directive parameters (startname, endname, stoppedthreshold), update analyse output, handle no timestamps in GPS file, correct display of duration 2024-01-01 Initial version

See also

A handy companion to

Similar utilities and information

Used on

Contributors

Talkback

See discussion at GpxStat-Talk

tahi Page last modified on 2024 May 05 13:02

Edit - History - Recent Changes - WikiHelp - Search - email page as link -> mailto:?Subject="KiwiWiki: Gpx Stat"&Body=