public class GPXUtils {
public static List<TrackPoint> loadGPXTrack(PApplet p, String gpxFilename) {
List<TrackPoint> trackPoints = new ArrayList<TrackPoint>();
Calendar prevTime = null;
Location prevLocation = null;
// Load GPX file
XML gpx = p.loadXML(gpxFilename);
// Get all track points
XML[] itemXML = gpx.getChildren("trk/trkseg/trkpt");
for (int i = 0; i < itemXML.length; i++) {
// Creates location for track point
float lat = itemXML[i].getFloat("lat");
float lon = itemXML[i].getFloat("lon");
Location location = new Location(lat, lon);
// Calculates speed for track point
// Uses time span (h) and distance (km) to previous point to get km/h
double speed = 0;
try {