Skip to main content

Snap GPX tracks to waypoints for more precise distance calculations

Project description

snap-gpx-track-to-wpts

A small command-line Python tool that snaps tracks in GPX files to waypoints. This enables more precise distance calculations when waypoints are off-route.

Installation

From PyPI (pip):

pip install snap-gpx-track-to-wpts

From PyPI (uv):

uv tool install snap-gpx-track-to-wpts

From source:

git clone https://github.com/andrashann/snap-gpx-track-to-wpts.git
cd snap-gpx-track-to-wpts
uv sync

Usage

snap-gpx-track-to-wpts -i infile.gpx [-d maxdistance] [-m mode] [-f [outfile]]

When running from a source checkout, prefix with uv run:

uv run snap-gpx-track-to-wpts -i infile.gpx [-d maxdistance] [-m mode] [-f [outfile]]
Argument Required Default Description
-i infile.gpx Yes Input GPX file
-d maxdistance No 100 Maximum distance (meters) from track to snap a waypoint; farther waypoints are discarded
-m mode No add add: finds the point on the track closest to the waypoint -- not necessarily a track point itself, it could be between two track points e.g. on long straight segments. If it is not a track point, then we create this closest location as a track point. Then we create a duplicate, and between the original and the duplicate, we add the location of the waypoint as another track point. move: moves the closest track point to the waypoint location
-f [outfile] No stdout If omitted: print to stdout. If -f with no argument: save to <infile>_snapped_<maxdistance>.gpx. If -f outfile: save to the specified file.
--drop-unmatched-wpts No off Remove waypoints from the output that were not snapped to any track (i.e. farther than -d from all tracks).

Notes

  • If there are multiple tracks, all tracks are modified. For each track, all waypoints are taken into account.
  • If there are no tracks in the file, exits with a warning but no error.
  • If there are no waypoints in the file, exits with a warning but no error.
  • Only the tracks are changed and only the relevant points. Attributes of track points, such as timestamp, elevation, or heart rate are not modified.
  • Routes and waypoints are not modified.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snap_gpx_track_to_wpts-0.2.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snap_gpx_track_to_wpts-0.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file snap_gpx_track_to_wpts-0.2.0.tar.gz.

File metadata

  • Download URL: snap_gpx_track_to_wpts-0.2.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for snap_gpx_track_to_wpts-0.2.0.tar.gz
Algorithm Hash digest
SHA256 06a4bff83c0aa7cebac27ee5b0249738eb73e4ad013e1cb116bfc3617bc46071
MD5 802398c76375ca49c85dfd8ab8c0fe3b
BLAKE2b-256 c0f9bb4870d399dd2cc2a1d4d425cb80155746b6147701f97d2b3eb8bb29d50d

See more details on using hashes here.

File details

Details for the file snap_gpx_track_to_wpts-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for snap_gpx_track_to_wpts-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 012b33a98adb3415c02fdce3029450940f7cb6b02830f128f52e8009ffc5c7d9
MD5 b2667e8f9bc56627b2d13c8f175cb246
BLAKE2b-256 f90dfd0d47538a469c9d34d53559c309ff5922dcc792ff0d1cee08c97a90ca2a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page