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. |
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snap_gpx_track_to_wpts-0.1.0.tar.gz.
File metadata
- Download URL: snap_gpx_track_to_wpts-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b66a45db316a9b5fe4e32304f244961c659363e81b82e22ddd142f23ba7c9d02
|
|
| MD5 |
48c8b1f421f3944ca3cb1b4f1ab67d5c
|
|
| BLAKE2b-256 |
ca784b9952dddd08e5b7c97e4de2475b83312134b49261d6ea561665c54432aa
|
File details
Details for the file snap_gpx_track_to_wpts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: snap_gpx_track_to_wpts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8326a95014615452fda58742bf0e4487fe143dfdb054d3f775a0e5b85917ff8f
|
|
| MD5 |
af66b996e117053f7d5436d65ab10506
|
|
| BLAKE2b-256 |
d59b19eed23a2ee12f0aedc76debc3321b0ce008dec8d6a7867bfe60000ea0a6
|