Working with GPS data in QGIS
Last updated
Last updated
GPS devices use a file format called GPX (GPS eXchange File) to record data. Each GPX coming from a Garmin unit is split into:
Waypoints - points, describing locations or features.
Routes - lines leading to a destination, where waypoints or route points show stage points/turns.
Tracks - describe a path, usually formed of a series of track points.
We can use GIS to create, view, and edit data, and export it to a GPS device for use in the field.
QGIS allows users to create new GPX files very easily.
Go to "Layer" in the top bar
Select "Create Layer"
Choose "Create new GPX Layer"
Choose a name for your new layer, and where you would like to save it.
Once you have clicked "Save" a set of 3 new files should have appeared in you Layers Panel:
Lets look at one of these files in more detail.
Double-clicking the waypoint layer in the Layers Panel, we can see some more information about the layer:
Name
Source - where it is saved
Storage - what file type it is. In this case, we have made a GPX file
Geometry - whether it is a Point, Line/Linestring or Polygon
CRS - Coordinate reference system. GPS devices read data in standard WGS1984, or EPSG 4326
Let's look at the Attribute table next:
As you can see, this table is empty - that's because we haven't added any data yet!
As we have created a GPX file, QGIS has made the attribute table fields match what a GPS is looking for:
Name
Elevation
Comment
Description
Source
URL
URL_Name
The important fields are "Name" and "Description" - so you can tell which point is which!
Please see the QGIS Tutorial for more information about editing data in QGIS
Let's add some data to our new layers.
Select the Routes layer in the Layers Panel, and toggle the Edit button on and start drawing a line:
Once you have drawn your route, right-click to finish the line.
A pop-up will appear, allowing you to fill in information about the line - fill in the "name" and "description" sections so you can identify the route on your device!
Let's do the same as the above, but this time lets create Waypoints along the route.
Select the layer in the Layer Panel, and toggle Editing on.
We want to ensure that the Waypoints we make are on the route. Let's use Snapping to do this.
Toggle the Snapping Toolbar on, and make the Snapping Tolerance "20 px"
If you can't see this tool, check that the Snapping toolbar is enabled. Check that there is a check mark next to the toolbar by accessing it through View, Toolbars.
Once you have snapping and editing on, we can start creating new points along the line.
Start by hovering near the line - once you get close enough, a pink box should appear near a line vertex (endpoint or turning point).
Click to add the point.
An attribute box should appear, similar to the routes one earlier. Fill this in with information about the point you have just added.
If nothing else, just add the Name and Description information
Once you are happy, click "Save" and toggle Editing off.
That's it! you have now made a Route line and a series of Waypoints along it.
Adding data toa GPS is similar to adding data to any other USB device. After you have connected your GPS to the PC you are using, just click and drag the .gpx file from where you have saved it to the relevant folder in the device.
Garmin devices use "Spanner Mode" to show up on a PC and access the data on it.
Got to System Setup -> Interface, and select "Garmin Spanner."
Then when you connect it to the PC you can choose Mass Storage
Following the same process above, go to where the file is saved in your Garmin device. The you can drag and drop it into QGIS.
Once you have added the file to QGIS, it looks like this:
This data has been added as READ-ONLY - this is because the data has been locked by the device, and can't be edited.
In order to edit data that's come out of a Garmin device, we need to convert it.
We need to convert the Waypoints and Routes to seperate Geopackages so we can edit the copies.
Right-click the layer in the Layer Panel
Select "Export"
Select "Save Features As"
Then fill in the box with the new filename, and click "OK"
We often use "filename_working_date.gpkg" naming convention, so we know which data is in progress, and which is a working file.
You should have a geopackage of your waypoints! Do the same for your routes.
Now, you can edit the files.
Follow the instructions above and there is more information on editing/creating data in the QGIS Tutorial.
If this is an updated version of an older file, it is useful to include "v2" or "proposed_date" in the file name.
This ensures you don't accidentally work off of out of date information!
We need to make sure our new data can be read by a GPS. To do this, we're going to export the data and make sure that the attribute table has the information it needs.
Format = GPS eXchange Format (GPX) - make sure you are exporting to the right format!
File name = choose where to save the data
CRS = make sure it says EPSG:4326 - WGS 84
GPX_USE_EXTENSION = YES
Format = GPS eXchange Format (GPX) - make sure you are exporting to the right format!
File name = choose where to save the data
CRS = make sure it says EPSG:4326 - WGS 84
GPX_USE_EXTENSION = YES
FORCE_GPX_ROUTE = YES
And that's it! Just transfer the files back to your device, and you will have a working GPX file.