Manipulate track lists (track)

WARNING: This filter always drops empty tracks.

This filter performs various operations on track data.

move option

Correct trackpoint timestamps by a delta.

This option changes the time of all trackpoints. This might be useful if your track must be moved by one or more hours because of an incorrect time zone.

Example 4.8. Time-shifting a track with the track filter

The following command line will shift all tracks to be one hour later.

gpsbabel -t -i gpx -f in.gpx -x track,move=+1h -o gpx -F out.gpx


pack option

Pack all tracks into one.

This option causes all tracks to be appended to one another to form a single track. This option does not work if any two tracks overlap in time; in that case, consider using the merge option.

This option is most useful for rejoining tracks that might have been interrupted by an equipment malfunction or an overnight stop.

If no other option is given to the track filter, this option is assumed.

split option

Split by date or time interval (see README).

The input track will be split into several tracks depending on date of track points. If there is more than one track, use the pack option before before using this. To split a single tracks into separate tracks for each day and name them, use this:

gpsbabel -t -i gpx -f in.gpx -x track,split,title="ACTIVE LOG # %Y%m%d" -o gpx -F out.gpx

If the input has multiple tracks, pack them together before splitting them back apart per day thusly:

gpsbabel -t -i gpx -f in.gpx -x track,pack,split,title="ACTIVE LOG # %D" -o gpx -F out.gpx

Additionally you can add an interval to the split option. With this the track will be split if the time between two points is greater than this parameter. The interval must be numeric and can be int days, hours, minutes or seconds, expressed as one of the character "d", "h", "m", or "s". If no trailing character is present, the units are assumed to be in seconds.

For example, to split a track based on an four hour interval, use this:

gpsbabel -t -i gpx -f in.gpx -x track,pack,split=4h,title="LOG # %c" -o gpx -F out.gpx

sdistance option

Split by distance.

The input track will be split into several tracks if the distance between successive track points is greater than the distance given as a parameter. The distance must be numeric and can be in miles or kilometers, expressed as one of the character "k", or "m". If sdistance is given no parameters, this option has the same effect as the split option without parameters. If there is more than one track, use the pack option before before using this.

For example, to split the track if the distance between points is greater than 100 meters, use this:

gpsbabel -t -i gpx -f in.gpx -x track,pack,sdistance=0.1k" -o gpx -F out.gpx

The sdistance option can be combined with the split option. The track then will be split only if both time and distance interval exceeds the supplied values. This technique can be used to filter out gaps from the tracklog. The gap is kept only if the gps device is without signal for longer time than that given and during that time it moves a distance over that given. This example splits the track if the device is without signal for at least 5 minutes and during this time moves more than 300 meters:

gpsbabel -t -i gpx -f in.gpx -x track,pack,sdistance=0.3k,split=5m -o gpx -F out.gpx

merge option

Merge multiple tracks for the same way.

This option puts all track points from all tracks into a single track and sorts them by time stamp. Points with identical time stamps will be dropped.

Example 4.9. Merging tracks with the track filter

Suppose you want to merge tracks recorded with two different GPS devices at the same time. To do that, use this command line:

gpsbabel -t -i gpx -f john.gpx -i gpx -f doe.gpx -x track,merge,title="COMBINED LOG" -o gpx -F john_doe.gpx


name option

Use only track(s) where title matches given name.

With the name option you can filter out a track by title.

The comparison is always non-case-sensitive. Wildcards are allowed.

start option

Use only track points after this timestamp.

This option is used along with the stop to discard trackpoints that were recorded outside of a specific period of time. This option specifies the beginning of the time period.

If this option is not specified, the time period is assumed to begin at the dawn of time or January 1, 1970, whichever was later. The time for this option is expressed in UTC.

The value of this option must be in the form of YYYYMMDDHHMMSS, but it is not necessary to specify the smaller time units if they are not needed. That is, if you only care about points logged between 10 AM and 6 PM on a given date, you need not specify the minutes or seconds.

Example 4.10. Extracting a period of time with the track filter

To get only the parts of a track that were mapped on 20 July 2005 between 10 AM and 6 PM, use this command line:

gpsbabel -t -i gpx -f in.gpx -x track,start=2005072010,stop=2005072018 -o gpx -F out.gpx


stop option

Use only track points before this timestamp.

This option is used in conjunction with the start option to discard all trackpoints outside of a given period of time. This option defines the end of the time period.

If this option is not specified, the time period is assumed to end at the end of civilization as we know it or the year 2038, whichever comes first. The time for this option is expressed in UTC.

See the start option for the format of this value and an example of usage.

title option

Basic title for new track(s).

This option specifies a title for tracks generated by the track filter. By default, the title of the new track is composed of the start time of the track appended to this value.

If this value contains a percent (%) character, it is treated as a format string for the POSIX strftime function, allowing custom time-based track names.

fix option

Synthesize GPS fixes (PPS, DGPS, 3D, 2D, NONE).

This option sets the GPS fix status for all trackpoints to the specified value. Valid values for this option are PPS, DGPS, 3D, 2D, or NONE.

This option is most useful when converting from a format that doesn't contain GPS fix status to one that requires it.

course option

Synthesize course.

This option computes (or recomputes) a value for the GPS heading at each trackpoint. This is most useful with trackpoints from formats that don't support heading information or for trackpoints synthesized by the interpolate filter. The heading at each trackpoint is simply the course from the previous trackpoint in the track. The first trackpoint in each track is arbitrarily assigned a heading of 0 degrees.

speed option

Synthesize speed.

This option computes a value for the GPS speed at each trackpoint. This is most useful with trackpoints from formats that don't support speed information or for trackoints synthesized by the interpolate filter. The speed at each trackpoint is the average speed from the previous trackpoint (distance divided by time). The first trackpoint in each track is assigned a speed of "unknown."

seg2trk option

Split track at segment boundaries into multiple tracks.

This option splits tracks at segment boundaries into multiple tracks. This is useful to restore the behaviour of GPSBabel versions up to 1.3.6 which didn't support track segment markers and automatically put each segment into a separate track.

trk2seg option

Merge tracks inserting segment separators at boundaries.

This option merges multiple tracks, inserting segment separators at track boundaries. It expects the tracks to already be in the right order for merging, i.e. it does not check timestamps and reorder track points so that their timestamps are monotonically increasing.

segment option

segment tracks with abnormally long gaps.

faketime option

Add specified timestamp to each trackpoint.

This option assigns a time value to each trackpoint.

The value of this option must be in the form of fYYYYMMDDHHMMSS+SS.

The parameter f (force) is optional and means that the time value of each trackpoint is replaced. If f is not specified, the time value of each trackpoint is only replaced when the trackpoint contains no time value.

YYYYMMDDHHMMSS is the pattern for the timestamp and is required.

The plus sign is the delimiter between the timestamp and the step time in seconds. The first trackpoint receives the time value of the timestamp and each following trackpoint receives the timestamp incremented by the step time. The specification of the steptime is optional.

The parameter was added because some software products (e.g. garmin training center) require a time value for each trackpoint.

Example 4.11. Replace time values of a track

Replace all time values with new time values. Start at the 5 th of July, 2010 at 8 PM and increment 2 seconds between each trackpoint:

gpsbabel -i kml -f in.kml -x track,faketime=f20100705200000+2 -o gtrnctr -F out.tcx


Example 4.12. Add time values to a track

Add a time value to a trackpoint, if the trackpoint contains no time value. Start at the 6 th of May, 2010 at 6 AM and increment 5 seconds between each trackpoint:

gpsbabel -i kml -f in.kml -x track,faketime=20100506060000+5 -o gtrnctr -F out.tcx


discard option

Discard track points without timestamps during merge.

This option is used in conjunction with the merge option to discard track points with missing timestamps instead of aborting with the "Found track point at lat,lon without time!" error.

Example 4.13. Merging tracks with missing timestamps with the track filter

Suppose you want to merge tracks that may have missing timestamps. To do that, use this command line:

gpsbabel -t -i gpx -f john.gpx -f doe.gpx -x track,merge,discard -o gpx -F john_doe.gpx