7 unstable releases (3 breaking)

new 0.6.0 Jan 26, 2025
0.5.5 Jan 25, 2025
0.2.0 Jul 5, 2024
0.1.2 Jul 4, 2024

#62 in Geospatial

Download history 9/week @ 2024-12-10 291/week @ 2025-01-21

291 downloads per month

MIT license

22KB
284 lines

fit2gpx-rs: efficient fit to gpx converter

Installation

download binary

  1. Go to releases and download the binary for your os and arch.
    If one's not available, file an issue and build from source.
  2. unzip
  3. If on mac or linux: chmod +x $fit2gpx-binary

You could use eget or something similar as well: eget jeromeschmied/fit2gpx-rs

finally: ./fit2gpx --help

build

  1. have a Rust supported platform, eg.: linux, macos, windows
  2. have Rust installed
  3. install
    • with cargo from crates.io: cargo install fit2gpx
    • with cargo from source: cargo install --locked --git "https://github.com/jeromeschmied/fit2gpx-rs"
    • with git and cargo: cloning, then building from source:
git clone --depth 1 "https://github.com/jeromeschmied/fit2gpx-rs"
cd fit2gpx-rs
cargo install --locked --path .
# without installing to ...cargo/bin/fit2gpx: cargo r (--release) -- -h

Usage

binary

see fit2gpx --help

let's say you want to convert a_lovely_evening_walk.fit to a_lovely_evening_walk.gpx in that case, you'd do the following fit2gpx a_lovely_evening_walk.fit if you also want to add elevation data, as the .fit file didn't contain any, follow these steps

library

short:

fit2gpx::Fit::file_to_gpx("walk.fit").unwrap();

see docs or examples for more detailed usage

Purpose

This is a simple Rust library and binary for converting .fit files to .gpx files. I've written it, being fed up waiting for conversion of a strava bulk export while creating awesome plots with this tool: stravavis.

A significantly faster alternative to the great (but not frequently updated) fit2gpx with the ability to add elevation data while converting.

  • FIT is a GIS data file format used by Garmin GPS sport devices and Garmin software
  • GPX is an XML based format for GNSS tracks

Is it any good?

Yes.

Why

  • it's damn fast
  • it can add elevation data
  • should be fairly well maintained
  • providing Rust library
  • it's fun

How to add elevation data

  • first of all, have DTM data: .hgt files downloaded one great source is Sonny's collection, it's only for Europe though
  • then unzip everything, place all of the .hgt files to a single directory
  • set $ELEV_DATA_DIR to that very directory or pass --elev_data_dir ~/my_elevation_data_dir
  • make sure that elevation feature is enabled, it's the default
  • pass the --add_elevation | -a flag to fit2gpx

Why might this one not be the right choice

gpx lib doesn't support gpx extensions, so neither do we. After this issue is resolved, this shall be resolved soon.

it doesn't support strava bulk-export stuff

  • unzipping .gz files. solution: in your activities directory run gzip -d *.gz
  • adding metadata to gpx files from the activities.csv file

Direct dependencies

  • fit_file: reading .fit
  • gpx: writing .gpx
  • clap: argument parsing
  • rayon: multi-threadedness
  • srtm: reading elevation data from SRTM DTM files

Dependencies

~7MB
~116K SLoC