Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 whole bunch of GPX files that I need to load into qgis and loading them one at a time using the GPS plugin is a bit painful. It will not allow one to select multiple files -- is there another way?

I did find this: Automating batch load of multiple GPX files into PostGIS but I need to figure out a lot more about postgis and gdal before trying that approach.

BTW I am using Mac version of QGIS -- just realised that this may be OS related

share|improve this question
up vote 3 down vote accepted

Using Add Vector layer you can select multiple files by mouseclicking (at least on Windows), but you have to select for each GPX file what layer you want to add (most probably "tracks").

I guess this could be a good idea for a selfmade plugin, but I have not yet found the time to do that.

share|improve this answer
Ah! yes that works. The small catch is that you still need to select between track, waypoint, route, etc. with no indication of which gpx file you are referring to. Still beats going throught all the menus for each file. Also the file names are not reflected in the layer names. – Russell Fulton Apr 6 '13 at 7:14
True, but you still get the filename as tooltip if you hover over with the mouse. I use that step only temporarily to add the geometries with copy and paste to my spatialite db. – AndreJ Apr 6 '13 at 7:59

I know that this has already been answered .. but I couldn't use the answer and kept coming back to this question on every google search I did. So I made a mini python program to make a bunch of .gpx files into one big file. Thus getting around the problem of loading multiple files. Hopefully this helps someone else.

Once you have your new gpx file load it through the GPXtools plugin.

Copy and paste into a PLAIN text file. This code assumes you have python (2.x) installed. Made for Ubuntu, but should work on Windows or Mac

#!/usr/bin/env python
    1. Open a terminal (Linux, Mac) or command prompt (Windows).
    2. Type in "python <the name of this file> <the name of the folder containing
        you gpx files to combine>" 'Naturally withought quotes ;|'
    3. Visit said folder and look for a file called "CombinedGPX.gpx"
    4. Post if this doesn't work and/or maybe update this program so it does.
# This program will combind all gpx files in a given location into one large file.
# NOTE: the metadata of the first file (this is arbitrary and decided by the OS)
# is kept, all other metadata is forgotten.

# Possible additions .. make program execute from drag and drop **later
#chmod +x <filename>
#!/usr/bin/env bash
#python <> "$1"

import sys
import glob

# Get location from user
# This input should be in the form: $ python <> <GPXFolder/>
# NOTE: the second argument MUST end with a "/"

gpxdir = sys.argv[1]
gpxfiles = glob.glob(gpxdir + "*.gpx")
bigGPX = gpxdir + 'CombindedGPX.gpx'

# Remove precombined GPX file so you don't get an infintely expanding file
except ValueError: # Ignore this if file doesn't exist

print "Directory contains: " + str(len(gpxfiles)) + " .gpx files to be amalgamated."

def split_file(filename, body_start_split='</metadata>', body_end_split='</gpx>'):
    data =
    start_body = data.find(body_start_split) + len(body_start_split)
    end_body = data.find(body_end_split)
    header = data[:start_body]
    body = data[start_body:end_body]
    footer = data[end_body:]
    return header, body, footer

first_file, gpxfiles = gpxfiles[0], gpxfiles[1:]
with open(first_file, 'r') as infile:
    header, body, footer = split_file(infile)

    with open(bigGPX, 'w') as outfile:

        for fname in gpxfiles:
            with open(fname, 'r') as infile:
                header, body, null = split_file(infile)


print bigGPX + " created, contains combined data."
share|improve this answer
thanks for the nice scirpt - works great ! ! – user37333 Sep 23 '14 at 14:16

DNR GPS loads multiple GPX files. Then, Save As -> new shapefile.

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.