It's a Saturday so I took a break from software development to, err, develop software? Of course.

https://codeberg.org/pbarker/gpxtidy

gpxtidy is a little Rust program to tidy up GPX files for publication - it removes dates, times and personally identifying data so that they can be safely shared online. It simplifies the track by removing points that introduce less than a configurable error threshold. Finally it writes the result as either a GPX file or a GeoJSON LineString.

If you upload tracks of hikes, rides, runs or similar then this might be of interest to you.

I can't publish it to crates.io yet as it relies on an unreleased version of the gpx crate, but hopefully that will get fixed soon.

#OpenSource #Rust #GPX #GeoData

gpxtidy

Tidy up GPX files for publication

Codeberg.org

I'm particularly proud that I got to use some maths in this... both the haversine formula and Heron's formula.

https://codeberg.org/pbarker/gpxtidy/src/commit/5016504a58a9afc93231f4f3e928ae83953061d0/src/main.rs#L70

gpxtidy/src/main.rs at 5016504a58a9afc93231f4f3e928ae83953061d0

gpxtidy - Tidy up GPX files for publication

Codeberg.org

For comparison, the foreground blue track is after processing by gpxtidy with the default error threshold of 5m. The background red track is the original, just peeking out in a few places but barely distinguishable.

The blue track is accurate enough for someone to follow the route you took.

The original (red) GPX file was 1200 points, 278kiB of data. After gpxtidy processing (blue) it's 194 points, 10kiB as a GPX file, or 4.3kiB as geojson data you can use with leaflet.js.

(Map data from https://www.openstreetmap.org/)

crates.io: Rust Package Registry

crates.io serves as a central registry for sharing crates, which are packages or libraries written in Rust that you can use to enhance your projects