Skip to content


Subversion checkout URL

You can clone with
Download ZIP
a library to read GPX files (XML format for GPS data) using Processing
Java Shell
Latest commit b450e2d @RandomEtc correct CHANGELOG



Read and manipulate data in the GPX format. (see for more).

Uses Processing's XML parser so only basic information (lat/lon/ele/time) is parsed.

A GPX file is an xml file with a collection of GPX Tracks inside.  Each GPX Track has a name, and is a collection of GPX Track Segments, and each segment is a collection of GPX Points.  Each point has a latitude and longitude as well as an elevation and timestamp.  No other information is parsed by this library.  A GPX file can also contain waypoints, with lat/lon position and name and type.

This library has only been tested with a few different files, and I expect it will need updating to properly handle things like waypoints with elevation, and so on.  If you find a file that breaks it, please send it to me.


import tomc.gpx.*;

// outside setup()
GPX gpx;

  // inside setup()
  gpx = new GPX(this);

  // when you want to load data
  gpx.parse("test.gpx"); // or a URL

  // inside draw()
  for (int i = 0; i < gpx.getTrackCount(); i++) {
    GPXTrack trk = gpx.getTrack(i);
    // do something with
    for (int j = 0; j < trk.size(); j++) {
      GPXTrackSeg trkseg = trk.getTrackSeg(j);
      for (int k = 0; k < trkseg.size(); k++) {
        GPXPoint pt = trkseg.getPoint(k);
        // do something with or pt.lon

  for (int i = 0; i < gpx.getWayPointCount(); i++) {
    GPXWayPoint wpt = gpx.getWayPoint(i);
    // do something with or wpt.lon or or wpt.type


Place this folder (gpx) into your Processing/libraries folder, then restart Processing.
Then choose GPX from the library import options in the Processing application menu.
If it's working, "import tomc.gpx" should be added to the top of your application file.

Bugs / Requests

Please file an issue at

Enjoy! -- TomC.

Something went wrong with that request. Please try again.