Reading GPX Data

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2018.x


Many GPS devices offer the option to export data to GPS eXchange format (GPX). This XML-based format can be easily read using FME. In this tutorial, we will take GPS waypoints that were acquired using an Android mobile phone and a free app called Ramblr. The waypoints were collected while hiking around Kerið Crater in Iceland, but the user forgot to turn their GPS off before driving back to their accommodation. Using FME, we will read in the exported GPX data, clean it up and then write it out to KML. For information on how to write to GPX, see the Writing GPX Data article.


GPX Overview

When adding a GPX Reader to the canvas, six feature types are available to read from that each have their own purpose.

  • Metadata: The metadata contains the details about the author and copyright information

  • Waypoints: Particular points along a route, when following a GPS route these are the main points you would pass over.

  • Route: The intended path of travel

  • Route Points: Points along the path of travel, there may be more route points than waypoints.

  • Track: While in the field this is the path of actual travel

  • Track Points: The points along the track while following the waypoints.


Step-by-step Instructions

The data has been exported from the Ramblr app in GPX format. The GPX data can be downloaded above.


1. Open FME Workbench

In a blank FME workspace, add a GPS eXchange Format (GPX) reader to the canvas. For the dataset select CraterHike.gpx, then set the Coord. System to LL84. We can assume that this is the correct coordinate system because while the data was being collected, it was displayed on a Google Map, which uses a latitude-longitude coordinate system. Click OK. In the Select Feature Types window, only select TrackPoint. We don’t need the Track because we will recreate it using the cleaned up points.

GPX Reader, set the Coord. System parameter to LL84


2. Inspect the Data

Once the TrackPoints have been added to the canvas, inspect the data in the FME Data Inspector. We need to determine where the hike ended, and the drive home began. Add a Background Map to help visualize the area. 


Area of hike indicated by red circle. Background map provided by Mapbox, using a free API.


Once the background map has been set up, zoom into the points on the right side, this is where the hike took place. We will use the car in the parking lot as the endpoint, which is 46 for track_segment_point_index.


End of hike indicated by blue circle and arrow. Background map provided by Mapbox, using a free API.


3. Test For Trail

Back in FME Workbench, add a Tester transformer after the TrackPoint feature type. In the Tester parameters, set the test to track_segement_point_index < 47, this way we will only keep the points 0-46, which is the hike. Anything after 46 is the drive back to the hotel.

Tester parameters, track_segment_point_index < 47


4. Create Line from Points

Now that we have determined which section is the hike, add a LineBuilder transformer to the canvas and connect it to the Passed output port on the Tester. The LineBuilder default parameters will work for this example.


5. Clean up Attributes

The GPS creates several attributes that aren’t needed for our final output. Add an AttributeKeeper transformer and connect to the Line output port on the LineBuilder. In the parameters select the following parameters to keep:

  • track_id

  • track_segment_point_index

  • elevation

  • Creation_time


5. Run the Workspace

Enable Feature Caching by going to Run > Enable Feature Caching then run the workspace, then run the translation and view the Line output in the FME Data Inspector. You should now have a line connecting all of the points for only the hike around the crater.

Feature caching enabled, view the AttributeKeeper cache.



AttributeKeeper cache viewed in the FME Data Inspector. Background map provided by Mapbox, using a free API.


6. Write out to KML

The purpose of collecting this hike was to share it with people. Add a Google KML writer to the canvas and connect it to the Line output port on the LineBuilder. You can add a KMLStyler before the Google KML writer if you want to customize the line type or color. Run the workspace again, then open up the output file in Google Earth. This file can now be shared and easily viewed by others.

Output (1).png

Final output viewed in Google Earth. Note, a KMLStyler transformer was not used in this output image.


Data Attribution

Data collected by Liz Sanderson using Ramblr

Was this article helpful?



Please sign in to leave a comment.