// Load GPX file
XML gpx = p.loadXML(gpxFilename);
Calendar prevTime = null;
Location prevLocation = null;
// Create track with all track points
ShapeFeature trackFeature = new ShapeFeature(FeatureType.LINES);
List<Double> speedList = new ArrayList<Double>();
XML[] itemXML = gpx.getChildren("trk/trkseg/trkpt");
for (int i = 0; i < itemXML.length; i++) {
// Adds 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 {