I have a GPS tracked stored in a GPX file. Now I'm looking for a tool that allows me to set the start time of the track and the duration, and the tool should automatically evenly distribute the appropriate timestamps for all my recorded points in the track.

The tool should be free and run on OSX.


7 Answers 7


You could try GPSBabel, with the faketime option. This will let you specify the timestamp for the first point, and set an increment for each subsequent point.

eg use a command like this:

gpsbabel -i gpx -f in.gpx -x track,faketime=f20100705200000+10 -o gpx -F out.gpx

Though I don't think there's any way of getting the duration of the track and setting the increment based on that. GPSBabel also has a move option, which will offset the timestamp on each point by a set amount.

Some more details on GPSBabel manipulate track lists


Here's one that is browser-based and does exactly what you asked for:

GOTOES: Add Time Stamps to GPX Files


I wrote a Python script to shift times in a .gpx file by a certain amount. You need to install Python (I use 2.7.6) and BeautifulSoup. It's easiest to do with the pip package manager.

When you have pip installed, use pip install beautifulsoup4 to use the package.

If the GPX files are in a slightly different format (I've only encountered the variety that works with the program below), then look up strftime formatting. Note that the output file will not be exactly the same as the input in terms of formatting irrelevant to the information contained in the XML tree, but it should still be readable.

import datetime
from bs4 import BeautifulSoup
import re
import os
import sys

directory = r'[replace this with whatever directory you have your gpx files in]'
#you can come up with your own implementation of how to select all the files
#file_list = []
file_list = os.listdir(directory)
#this omits gpx files with an underscore 
#(to avoid affecting ones with the _modified prefix
file_list = [file for file in file_list if re.search('^[^_]*\.gpx',file)]
print file_list
#this can be any decimal number
hour_shift = 1

for file in file_list:
    with open(file,'r') as f:
        xml = f.read()
        bx = BeautifulSoup(xml)
        times = bx.find_all('time')
        for stime in times:
            timestr = stime.text
            rawtime = datetime.datetime.strptime(timestr,'%Y-%m-%dT%H:%M:%SZ')
            rawtime = rawtime + datetime.timedelta(hours = hour_shift)
        new_filename = re.sub(r'(\..+)?$',r'_modified\1',file)
        with open(new_filename,'w') as g:
        print 'converted %s to %s' % (file,new_filename)
print 'done converting'

I would recommend uploading it to runkeeper. It imports the route and you can simply enter the duration time yourself. Then runkeeper wil evenly distribute the time among all the waypoints and you will get a flat speed during the complete route.

From there, you could export to a gpx file again (I have done this some times now, when I had a route and just a total time)

Timestamp=$(date "+%s")

IFS=$(echo -en "\n\b")
for i in $(cat $1 | grep -v time) ; do
   if [[ -n $(echo $i | grep ele) ]] ; then
       echo "$i"
       echo -en "\t<time>$(date +%FT%H:%M:%S.835Z -d @$Timestamp)</time>\n"
       Timestamp=$[$Timestamp + $Timestampinterval]
       echo "$i"

done > $1.parsed.gpx

usage : script.sh file.gpx


VisuGPX is a GPX track management and editing web site. If you load up a GPX file then open it in EditGPX, there is a tool to add time stamps but also rebuild missing timestamps, only filling-in missing ones. Handy when one wants to clean up noisy GPX files and adding new points.


GPS Utility, author Alan Murphy, can do this, allowing you to set start and end times and interpolate time stamp values between them.

  • Can you include an URL to this tool in the answer?
    – aldo_tapia
    Mar 16, 2018 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.