How to edit the GPS data in your activities

This is the answer to a question I have had for years. I am posting it here so that I might save others many hours (or years) of frustration.

As many have said before, Garmin Connect does not provide functionality for editing GPS data. There are several posts explaining how to trim activities (e.g. if you forget to push stop at the end of an activity), but what if you want to move or add points??

BaseCamp is not the answer. Here's why:
  • Exporting in GPX format excludes the essential <time> tag for newly added points, resulting in a failed import
  • Exporting to TCX format excludes the new points altogether, resulting in an activity that looks just like the one with which you started
    • It also results in an activity that lacks time, speed, splits, heart rate, etc.

  • Exporting to CSV format leads to phantom uploads
    • Upon import, GC says the import is complete, but the activity is nowhere to be found.

  • The built-in global map lacks detail below major roads
    • Most of us don't run or cycle exclusively on highways, so we need to see small roads and pathways while moving or adding points
    • Yes, you can purchase more detailed maps or download free ones that require you to install mysterious .exe files that are hundreds of MB in size, but this is futile if you still end up with a file that GC won't accept
    • BaseCamp is overkill for the type of editing I'm talking about here, so save yourself a lot of hassle and use an online GPX editor

So what is the answer?

You will need:
  • A GPX editor - I had success with Olivier Potonniée's web-based WTracks (it's free!)
  • A text editor - but only if you need to add points rather than simply moving or deleting them. I used Notepad and suffered through the lack of pretty formatting that an XML editor would have provided.

Brief Instructions

  • Export the activity from Garmin Connect in GPX format
  • Delete the activity from Garmin Connect
  • Edit the route in WTracks (or similar) and save/download in GPX format again
  • If you added new points, manually insert <time> tags into each one using a text or XML editor. Garmin Connect requires these, but it won't explicitly tell you so when rejecting the upload.
  • Import the newly edited GPX file to Garmin Connect

Detailed Instructions

  • Export your activity from Garmin Connect in GPX format
    • Do this from the activity detail page by clicking the gear icon in the top-right corner

  • Delete the activity in GC so that it will let you upload a new version of the activity later

  • If using WTracks, click the three-bar icon (top-left) to open the menu, then click the Upload button to import your GPX file

  • Enter edit mode with the pencil button, followed by the next button to appear below that one. The tool tip calls it "Manual Track."
    • In edit mode, WTracks will want to add points to the end of the track, but you just have to ignore the dotted line that follows your cursor around from the last recorded point
    • To move an existing point, simply click on it and drag it to the desired location
    • To delete a point, click on it once and select DELETE in the box that pops up. Ignore the semi-transparent points. They are not really there. Clicking them will make them into real points.
    • To insert new points, find the semi-transparent midpoint on the line you want to modify and drag it to a desired location. This will make it a fixed point and will create two new semi-transparent midpoints on either side. You can then drag those as desired to make further bends in the line.

  • Once editing is complete, download the edited route in GPX format

  • If you have not added any new points, skip to step 9 and breathe a small sigh of relief that you are nearly finished

  • If you have added new points, open the edited GPX file in a text or XML editor of your choice
    • Add a <time> tag to each of the new points. GC will not accept the upload without these. See examples later in this post.
    • The file is in XML format, and some text editors are better than others at displaying formatted XML. Formatting is irrelevant to computers, but it makes navigating and editing XML easier for humans. If you don't feel like downloading an XML editor, you can first view a GPX file in a web browser, then edit it in Notepad. Simply drag the GPX file into a web browser window and it will appear nicely formatted, but in read-only mode. Scroll down until you spot the new points (they look noticeably different with the <time> tag missing), copy one of the GPS coordinates for use in Notepad's Find feature, and then proceed with your edits there.

  • Save the edited and time-tagged GPX file

  • Import this latest GPX file to Garmin Connect. Depending on which page you start from, the Import button will vary in appearance.

  • Check to see if the route looks right in Garmin Connect
    • Note: GC seems to ignore some points when displaying routes in the browser. If you added only a few new points, GC may literally cut some corners in the displayed version. I was able to get around this by adding a whole bunch of points in WTracks so that the route still looks right when several points are ignored.

Now, let's talk about <time> tags

Garmin Connect requires a <time> tag for each point in the route. If you simply moved or deleted existing points while editing, you can ignore the rest of this post because the time tag should have remained in place. Unfortunately, I have not found a GPX editor that includes <time> in newly added XML nodes, including BaseCamp. Alas, don't expect Garmin Connect to tell you that the reason it rejected an otherwise acceptable GPX file is that it lacks <time> tags in one or more nodes. It will instead give you an unrelated error message, such as "This file has already been uploaded." No, it hasn't been uploaded. GC's error handling doesn't seem equipped for this failure, so it sadistically throws you a red herring with this morsel of misinformation. If it does specifically tell you that there was a problem with the file you tried to import, then chances are that the XML structure is a little messed up (note that a missing <time> tag isn't a structural problem). You might have deleted one of the existing tags or inserted a <time> tag in the wrong place, like after </trkpt> instead of before it.

Below is an example of a properly formed GPS point in XML. Make all of your new points look similar to this by adding a full <time></time> tag before the closing </trkpt> tag. You can simply copy the previous point's <time> tag and paste it into the newly added point's XML. Though I did not experiment with time data very much, I assume that the time you use should be fall between the recorded times of the previous and next GPS points in the route.

<trkpt lat="52.35454570502043" lon="4.912475366145372"><ele>4.400000095367432</ele><time>2016-09-15T06:49:31.000Z</time></trkpt>

Note that elevation <ele> is optional and other tags, such as <extensions>, are probably acceptable as long as the XML is well-formed.

In an XML viewer, the above XML node may appear like this:
<trkpt lat="52.35454570502043" lon="4.912475366145372">

So there you have it. I hope I have saved you some time and frustration. Even better, I hope Garmin adds (real) activity editing to Garmin Connect one of these days/years. At least their devices' GPS accuracy is superior to many others, so route editing is less essential than it is for other activity trackers; however, there have still been many times I've wished it were there, and I know I'm not alone in this.