Change your GPX data file

By Shawn Smith,

Published on Jan 15, 2013   —   1 min read

Summary

How I went about editing and then removing data in the GPX file from my Garmin.

A few days ago I went for a ride, around 50km, and had all my Garmin products running – including heart rate monitor and cadence sensor.

The Garmin heart rate monitor started to produce some very weird numbers during my ride. Lets just say that my heart rate has never come close to 263bpm.

I did however want to upload the data to my favourite site, Strava.

This is what I did to amend my data.

  1. upload the ride as per normal
  2. download the GPX file of the activitiy
  3. amend the GPX file

Now that you have done this much, here’s where it will get a little tricky. The GPX file is really a XML file that has all your data inside of it. The file has a lot of data points and doing this manually will be a nightmare. So, this is where you need to be a little crafty with your file. For me, I wanted to remove all the heart rate data from the file – as it was all incorrect.

Here are the commands that I used to remove the lines. Keep in mind that you can do this for any data items inside of the file. This is for a Mac.

Open up terminal and type the following;

sed “/<gpxtpx:hr>.*</gpxtpx:hr>/d” ~/Downloads/Went sightseeing.gpx > tmp.txt

Allow me to break down the command above so that you can use it for yourself. The “/<gpxtpx:hr>.*</gpxtpx:hr>/d” is text that I want to search for, in my case, the heart rate. Next is the location of the file and filename “~/Downloads/Went sightseeing.gpx”. Again, point it to your specific file path and filename.

And now the final command;

mv tmp.txt “Went sightseeing.gpx”

That should do it.

A big massive thanks to Mat for getting me sorted with this.

Share on Facebook Share on Linkedin Share on Twitter Send by email

Subscribe to the newsletter

Subscribe to the newsletter for the latest news and work updates straight to your inbox, every week.

Subscribe