Skip to main content

analyze — Analyze GPX files

Computes full statistics for one or more GPX files.

gpx-analyzer analyze [files...] [flags]

Accepted inputs: .gpx files, directories (analyzes all .gpx files they contain), or glob patterns (*.gpx).

Flags

FlagDescriptionDefault
--formatOutput format: text or jsontext
--smoothingElevation smoothing: none, light, medium, heavymedium
--dem-dirDirectory of SRTM .hgt tiles for DEM correction(disabled)
--dem-auto-downloadAutomatically download missing SRTM tilestrue
--dem-cacheCache directory for downloaded tiles(OS cache dir)
--elevation-thresholdMinimum elevation change threshold (meters)2.0
--elevation-algoElevation gain algorithm: threshold, douglas-peucker, segmentsthreshold
--track-smoothingGPS track lat/lon smoothing: none, light, medium, heavynone
--dp-epsilonDouglas-Peucker: max tolerated vertical deviation (meters)3.0
--seg-min-lengthSegments: minimum segment length (meters)200.0
--seg-max-deviationSegments: max RMS residual per segment (meters)2.0
--presetStop detection preset: hiking, trail, cycling, running, walking, swimminghiking
--stop-speedOverride max speed for a stop (m/s)(per preset)
--stop-durationOverride min duration for a stop (e.g., 2m)(per preset)
--exportExport reprocessed GPX files (DEM + smoothing) to this directory(disabled)
--enrichInclude computed metrics (speed, distance, grade) and biometrics as GPX extensions in exportfalse
--max-hrMaximum heart rate (bpm) for HR zone calculation0 (disabled)
--fix-anomaliesApply automatic anomaly corrections (interpolation, drift collapse, etc.)false

Examples

Simple analysis of a file:

gpx-analyzer analyze my-hike.gpx

Analyze all GPX files in a directory:

gpx-analyzer analyze ./my-tracks/

JSON output for integration with other tools:

gpx-analyzer analyze my-hike.gpx --format json
{
"filename": "my-hike.gpx",
"total_distance_m": 24532.5,
"total_distance_km": 24.5,
"elevation_gain_m": 1250.0,
"elevation_loss_m": 1180.0,
"avg_speed_kmh": 4.2,
...
}

Extract a single value with jq:

gpx-analyzer analyze my-hike.gpx --format json | jq '.elevation_gain_m'

Disable elevation smoothing (raw GPS data):

gpx-analyzer analyze my-hike.gpx --smoothing none

Heavy smoothing for very noisy GPS data:

gpx-analyzer analyze gps-watch-track.gpx --smoothing heavy

DEM elevation correction (SRTM tiles):

gpx-analyzer analyze pct.gpx --dem-dir ./srtm-tiles/

Combine DEM + light smoothing + 3m threshold:

gpx-analyzer analyze pct.gpx --dem-dir ./srtm-tiles/ --smoothing light --elevation-threshold 3

Use the cycling preset for stop detection:

gpx-analyzer analyze bike-ride.gpx --preset cycling

Customize stop thresholds (speed < 0.2 m/s for > 5 min):

gpx-analyzer analyze ultra-trail.gpx --stop-speed 0.2 --stop-duration 5m

Analyze multiple files with glob patterns:

gpx-analyzer analyze vacation-*.gpx --format json

Export GPX with DEM-corrected elevations:

gpx-analyzer analyze my-hike.gpx --export ./processed/

Produces ./processed/my-hike_processed.gpx with DEM + smoothing elevations applied.

Export after full reprocessing (DEM + segments):

gpx-analyzer analyze pct.gpx --elevation-algo segments --export ./processed/

Analyze with anomaly corrections applied:

gpx-analyzer analyze my-hike.gpx --preset trail --fix-anomalies

Anomaly detection is always active. Use --fix-anomalies to apply automatic corrections (GPS frozen interpolation, drift collapse, timestamp fixes, HR exclusion). See Anomaly Detection for details.