Working with GPS tracks in Quantum GIS (QGIS)

Problem: You want to compare your GPS data with OpenStreetMap data in a GIS… for free!

I am beginning to explore the world of free GIS software. QGIS has been recommended to me as one of the best out there. As an ArcGIS user, I found it easy to learn because the features are very similar. I am also impressed with the number of things it can do. I am going to write about just a small sample of them:

  • Georeferencing raster imagery
  • Loading OpenStreetMap data
  • Viewing GPS tracks and waypoints (.gpx files)

My goal when I started this project was to contribute some new information to OpenStreetMap. Since I arrived in Huntsville, I have had a lot of fun walking around Monte Sano State Park. I also recently obtained a GPS unit that I’ve been using for car navigation, and I thought I could use it to record the path of one of the hiking trails.

On my first visit to the park, the gate attendant gave me a trail map that looked close to this.

(Click to see full size)

A blue line surrounding the parking area, called the North Plateau Loop, looked to me like a good place to start. It passes some lovely scenic viewpoints.

I wanted to check if this trail has been added to OpenStreetMap yet. I decided to georeference the trail map and then download the OpenStreetMap data that falls within its bounds. Georefrencing within QGIS is a little different than what I am used to because it uses a separate window.

To start the process, select Georefrencer from the Plugins menu. Then, press the Open Raster button in the new Georefrencer window, and navigate to your image. Mine was montesano.jpg.

Press the Add Point button to start adding control points. When you click on the image, a box will come up that allows you to enter x,y coordinates or load the coordinates from the map canvas (your other window).

I loaded some vector street lines into my other window that I got from the City of Huntsville GIS Department’s FTP site. I georeferenced to the street intersections. When you’ve added enough control points–at least three, but more is better, go to the Settings menu to open the Transformation Settings.

The QGIS User Guide explained that Thin Plate Spline is a good transformation type to use when you have a lower-quality original, because it will introduce┬álocal deformations. Cubic is a good resampling method for smoothing things like scanned maps where we don’t need to worry about maintaining precise grid cell values. The only output format available is GeoTIFF. Chose the save location, then press ok. To initiate the georeferencing process, press the green start arrow.

If you checked “Load in QGIS when done”, the image will show up in your map canvas table of contents, and you can check your work. Everything will stay loaded in the Georefrencer window the way you left it, so it’s easy to add or remove control points and try again.

Now, it is time to load OpenStreetMap data on top of my map. The OpenStreepMap plugin is included with the core QGIS software, but it isn’t turned on by default. Go to the Plugins menu and select Manage Plugins to check it on. This will add the OSM buttons to the toolbar and will open OSM widget to the right of the map window. (I will talk more about the widget in my next entry.)

I zoomed so the trail map filled the screen, then pressed the Download OSM data button.

QGIS will grab the current extent of your map window. If the area is too big, it will tell you and you will need to zoom in. Select a place to save your .osm file and then press the Download button.

QGIS will automatically symbolize the layers similar to how they look on the OpenStreetMap website. When I looked at the data, I could tell that someone had added a couple footways near the bottom half of the North Plateau Loop, but they were not connected or complete.

So, I headed back to Monte Sano to walk the trail with my GPS device. I have a Garmin Nuvi 255w. The OSM wiki has instructions for how to collect traces with this device, but I didn’t find that I needed to do all that. My Nuvi has a Trip Log feature that is actually always recordings paths. It saves them to a standard .gpx file. You don’t need to tell it to start doing that, but you can turn on the lines so you can see it working. To do that, press Tools on the opening screen, then Settings, and then choose Show under Trip Log.

Now, whenever you move, you’ll see a cyan line being built behind you. If you want to start anew without all the clutter from your previous trips, press Tools, then My Data, then Clear Trip Log. I told my Nuvi to navigate me to the front gate of Monte Sano. Then I turned off my car, but left the Nuvi on and took it with me. I walked the trail and watched the line grow.

When I got home, I plugged the Nuvi into my computer and grabbed Current.gpx from the Garmin/GPX folder.

I added it to QGIS along with the OSM layers I had downloaded previously. To add a GPS track, press the Add vector Layer button. You will need to select the GPX file type from the long list in the browse data box.

Then, a window will come up asking you to choose which GPX sublayers to load. Tracks is the only one I need for this project. Waypoints holds your saved favorite places, and track_points holds the time when each point along the track was recorded.

I changed the symbol of my track line to a thicker bright magenta so it would show up more clearly. You can get to the symbology settings by right-clicking on the layer and selecting Properties, just like you would in ArcMap.

You can see that the GPS recorded my driving, parking, and walking movements all in the same layer. I think that the wiki instructions I linked to above might have allowed me to isolate just the trail, but then I would have had to do an extra file conversion step, and it is pretty easy for me to tell which is which.

My plan next was to edit the OpenStreetMap data that I downloaded to include this trail, and then upload my changes to the OSM server. I will compare the process of doing that with QGIS and Merkaartor in my next entry.

Tags: , , , , ,

Leave a Reply