Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Can you tell us more about your software preferences? Do you want help writing a script to do this? If so, in what language(s)? Will the data be in a database (in that case ST_AddMeasure would work)? Do you just want a black box tool? – katahdin Mar 6 '13 at 18:55
A blackbox tool is fine for me. The data is not in a database, just a plain GPX file. If I can't find a tool, I'll write a small script by myself, but I still hope that I can find such a tool. – RoflcoptrException Mar 6 '13 at 19:47
I don't know of any such tool, but perhaps someone else on the site does. – katahdin Mar 6 '13 at 19:53

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

share|improve this answer

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)

share|improve this answer

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'^[^_]*\.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 =
        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'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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