Friday, May 1, 2015

How to edit .GPX files in Base Camp

I have several different GPS's that I use frequently for a number of different activities.  The thing I like the most though, other than the built in on the ground data that it gives you is to be able to take that data and analyze it later.  This, however is where a lot of GPS's fall short.  I will give a couple of quick examples of GPS data problems and how to fix them.  I use all Garmin devices so I will be using the Garmin Basecamp software to edit my tracks.  I have used this for my Garmin 310XT (that I use mainly for running and Biking), and on my Garmin Fortrex 401 that I use for Hiking and in the field with the Army, and on my Garmin Etrex Venture HC which is my backup GPS just in case something goes wrong.  I just recently got back from a trip hiking Mt. Elbert in Colorado and had to use a few of these different techniques to get my data to look like it needed to so I hope you will find this useful.

Problem 1:  GPS track records stuff you don't want it to (ie Starts at your house, or records after activity is over)

This is probably the most common issue with the hiking (on the trail) versions of Garmin GPS devices and stems from the fact that the GPS is basically always recording data when it is on.  So essentially if you turn your GPS on at your house to check the batteries then shut it off, drive to where you will be hiking, and then turn it back on and do your hike the GPS will "think" that all of that data was the same event and it will join it up into one track.  Something similar might also happen if you forget to turn off your GPS and/or save your track when you are complete with an activity.  For the fitness based GPS's like the forerunner series you could run into something similar with your data, if for instance, you forget to turn off your watch after a race and then wander around the expo for a half hour recording the whole time.  In my case below you can see at the top left of my track, when I turned on my GPS for the descent down Mt Elbert it popped up with two random data points that I didn't do.  So the distances traveled and elevation gained was way off.  Ok so here's how to deal with that problem.

Step 1: Import your .GPX file into Garmin BaseCamp. Once that is complete your tracks will show up under Data received from: and then the name of your Device.  In my case I have two devices on here, my Fortrex 401 and my Venture HC.  The file I am trying to edit is the Elbert Descent data 1 track from my Garmin Etrex Venture HC.  You can see where I found that track here:

Step 2: Ok so now you have your track selected and you can see the data points that you don't want.  Now is the easy part.  Just double click the track (footprints icon) in the menu on the left and a new window will pop up that looks like this:

Now you can see clearly that the first two data points just don't make any sense, there is no way I was at 6539' of elevation and then suddenly jumped to 14,425' of elevation.  As the GPS was calibrating it went bonkers for a few seconds and I got some strange data, now the rest of the 814 points on here were actually accurate so I don't want to throw out the whole thing but I was also getting "credit" for about a mile of travel and 8,000' of elevation gain that I didn't do.  So all I need to do is to go ahead and delete those incorrect points.

Step 3: Simply go ahead and select the point (or points, you can delete multiple points at a time).  Once the points are selected just right click and click delete. Viola!  Now your data looks like you want it to.

Now you can see that my track looks much cleaner and my track log is showing the correct data from my descent on the summary at the top.

Here you can see my track is now "clean" without the two pesky data points at the beginning.

...and here is the correct "clean" track log showing the correct Summary information and only 814 data points.

 I already Feel better. But... you say that was only the data from the descent! what about the ascent of this fine peak.

Problem 2:  You have two different tracks that need to be joined but the software won't cooperate.

Ok, this is the next thing that happens a lot with the "on the trail" GPS's but also can happen from time to time on a fitness model GPS.  A lot of times tracks will be split up.  This could happen if you shut off your GPS to change out batteries or if you accidentally stop the activity (for a fitness GPS) or save the track (for a hiking GPS) and then start it up again to finish the activity.  This might also happen if you use two different devices for different parts of the same activity.  There are two different ways to join your tracks, so lets get started.

First way:  use Garmin's Join Tracks option (see... Garmin thought about this one) the problem is that the software doesn't always work out perfectly so I will also show you how to manually join tracks, which I like a lot better.  Ok so for the Join Tracks Option here we go. 

Step 1:  Locate the two tracks you want to Join.  From that same climb I worked on earlier I saved the first part of the Descent as one track and then started a new track for the second half of the descent.  So now I need to join those two tracks.  I have them saved in the Folder:  Data received from Etrex Venture HC, and they are both under the list titled Elbert Descent. 


You can see that Elbert descent data 1 is the top half of the descent with Elbert Data 2 being the bottom part of the Descent and that they do not quite Join up.  This isn't really a problem as the Program will essentially just "Draw a line" between the two tracks and create a segment to fill the distance and time it would have taken you to move between the last two known points.  Here is the map of the two segments.

You can see that with both tracks selected they both appear on the screen and you can see the break between Descent Data 1on the left and Descent Data 2 on the right, what I want is for both of these to be in one track.

Step 2:  At this point all you need to do is select both tracks, and right click.  A popup will appear and you just select "Join Selected Tracks".  Go ahead and click that link.

Once you click "Join the Selected Tracks..." you will get another popup on the screen and you will notice that Garmin has drawn a helpful little line showing you where they will connect the track. If you didn't want the track to connect in that way you can select the track and then hit the little turn around arrow icon on the left side of the window and it will reverse the direction.  You can play around with that for a little bit if you need to to get it right.  They will also come up with a generic name, in this case it is "Track 001"  you can change that name later.

Once you see this popup go ahead and click "OK".  Garmin will Give you another Popup saying "A new joined track has been created.  Do you want to delete the original tracks?"

 I always click no here, and this is because you don't really know what your track is going to look like in the end so I find it better to hold onto the original data just in case I made a mistake joining the tracks. and Viola! your track is now joined.  You can see below what it will look like when it is all put together into a single track.

At this point all you need to do is rename the file to something other than Track 001 so it is easy to find.  You do this by selecting the Track and right clicking and then selecting Rename.  I renamed mine to Elbert Full Descent.

And now you are done, from here you can do a ton of different things with the file that I will cover in other blog posts.

Joining tracks Manually:
Sometimes the Join Tracks option doesn't want to cooperate so it is too easy to just bypass and join your own tracks manually.  On the same files I have been working on I used my Fortrex 401 for the ascent and my Etrex venture for the descent (due to my Fortrex running out of batteries right at the top).  I already showed you how to fix data that was skewed and how to join two tracks for the descent lets finish off this trip by combining the Ascent Data with the Descent data.  This would be useful any time you have a device run out of batteries or break and need to switch to a backup device.

Ok so this one is really easy: you are literally just copying and pasting data points from one data log to the other.  The first thing you need to do is just find your two tracks.  For me the first one is the Ascent under my Fortrex 401 folder.  The other track is the Elbert Full Descent that we just made under the ETrex folder.  You can really use either file just pick which one you want to be your "master copy" and then go from there.  I will be using my Elbert Full Descent as my "Master Copy".

Something that makes it easier as well is building a new folder for each trip, that way it keeps you organized.  I won't cover that here but it is useful.

Step 1:  Make duplicate of one of the files to become your master copy and then rename it to something that makes sense.  To duplicate a file simply select the track and right click and then click on duplicate.

Once you select Duplicate it will create a new track with a generic name, usually by adding a 001 to the end of the existing name.  I will go ahead and rename Elbert Full Descent 001 to Elbert Master Copy so I don't get confused.

Step 2:  Copy data from second source into track log of your Master Copy.  You do this by opening up the file that you want to copy from.  In my case it is Elbert Ascent from my Fortrex 401.  Once I have the track log open you just simply select all of the points and  right click and select Copy.

You can see that there are a lot of points to copy on this trip.  729 to be exact.  That is going to make a big file once we put it all together.  I will show you how to drop the file size down after this.

Ok, so now I have the data from the Ascent copied on my clipboard, all I need to do is paste it in place in the Master Copy.

So we just need to select the track for the Master Copy and Paste in the new points.  I have found that sometimes (an I don't know why) the copy option won't work and I will need to use Cut instead.  You might try that if you are having trouble.  All you need to do here is just select the first point (or the last one depending on if you are adding to the beginning or the end of a trip)  and then right click and click paste.

Great, now we are basically done.  Lets take a look at the new track log.  You can see that I now have 1655 data points and a total distance of 11.5 miles hiked with accurate elapsed and moving times for the whole trip.  At this point the data is in a useable format to start exporting it and using it.  I usually publish this stuff using Garmin Connect but you can push this new .GPX data to Google earth, post it to a website, use it to geotag photos, send it back to another device or a million other things.  I wont cover that here but the possibilities are endless if you know what to do with it.

One thing that you might run into though is that the file size can get pretty big.  So I will cover that real quick.

Problem 3: My .GPX file  is too big to do anything with

This problem is one of the easiest to fix.  You simply work on the file using the "Filter" button on the bottom of the track log window.  I will use the same file I have been working on (which has 1655 data points) I want this file to be smaller so I need to take out some of the data that doesn't matter.  For instance I don't really need to know about every second of a trip especially if I was stopped, or traveling in a straight line at a similar pace for a while.  By filtering the data we  an filter out the unnecessary points so the ones that really matter, like when we change direction or speed up or slow down will show and it will reduce the file size without reducing the quality of the data.

Step 1:  Open up the Track Log file of the track you want to reduce the size of and select "Filter"

This will open up another window with a number of options. You can choose to filter by time (ie a data point every second or every 10 seconds etc, by distance, or a number of other factors.  I usually use the max number of data points option.  Garmin is defaulted to 3000 for the max number of points (which is incredibly high, unless this is a file from a multi day trip).  I am going to use 500 points and then make sure you click "save original Track in the lower left just in case you get too carried away and take away too many points. 

And that's it.  The software will take it over from there and determine which points are unnecessary.  In my case it dropped it down to 339 points.  The really cool part is that you can see on the map where it chose points close together where there were a lot of direction changes and took a lot of points out where I was walking relatively straight. 

I hope you found this information useful.  Feel free to ask any questions you have below and get out there and do something with all that data!


  1. I've tried to delete the straight lines from home but they just don't disappear. Followed all your instructions and right-clicked the points I want to erase but delete does nothing. Any ideas?

    1. Hey Laurence, You need to select the points first before you can right click to delete. So once you select them (and they appear highlighted) it should be as easy as right clicking and then selecting delete.

      That is for the desktop version of the software on a PC. If you are on a Mac or a mobile version I am not sure how it would work.

      Hope this helps!