Skip to main content

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.

Metadata

Release files for snap-gpx-track-to-wpts 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snap-gpx-track-to-wpts 0.2.0
File Size Uploaded
snap_gpx_track_to_wpts-0.2.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snap-gpx-track-to-wpts 0.2.0
File Interpreter ABI Platform
snap_gpx_track_to_wpts-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / snap_gpx_track_to_wpts-0.2.0.tar.gz

Download URL snap_gpx_track_to_wpts-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
06a4bff83c0aa7cebac27ee5b0249738eb73e4ad013e1cb116bfc3617bc46071
BLAKE2b-256 checksum
How to use checksums
c0f9bb4870d399dd2cc2a1d4d425cb80155746b6147701f97d2b3eb8bb29d50d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / snap_gpx_track_to_wpts-0.2.0-py3-none-any.whl

Download URL snap_gpx_track_to_wpts-0.2.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
012b33a98adb3415c02fdce3029450940f7cb6b02830f128f52e8009ffc5c7d9
BLAKE2b-256 checksum
How to use checksums
f90dfd0d47538a469c9d34d53559c309ff5922dcc792ff0d1cee08c97a90ca2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page