GpxStat
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
- download
gpxstat-2024-05-05.phpΔ
- copy to the
/cookbook/
directory asgpxstat.php
- add to
config.php
the lineinclude_once(
$FarmD
/cookbook/gpxstat.php);
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"
groupname
and pagename
are optional
display="layout"
table
(of all available values)tramp
(i.e.walk
)ski
drive
(alsoboat
,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"
timezone="timezone/name"
detect
' to calculate the timezone from the first point on the track, YMMV.
startname="location name"
Start:
"
endname="location name"
End:
"
banner="on", "off", or "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
display=tramp
display=table
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
.
Defining this variable in $HTMLStylesFmt
['GpxStat'] = '.gpxstat { ... }';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
- Ape: Automagical PmWiki Embed Embed videos, maps, documents, and more in wiki pages
- NZTopo Use https://www.topomap.co.nz/ to display an excerpt from a New Zealand topographic map in a PmWiki website
Similar utilities and information
- https://trackreport.net/
- https://geo.javawa.nl/trackanalyse/index.php?lang=en
- uTrack
- Haversine formula
- GPS Exchange Format
Used on
Contributors
Talkback
See discussion at GpxStat-Talk?
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.