getMarkers(); $gpx = new Gpx(); $gpx->addLink('github.com', 'php-owntracks-recorder'); $gpx->addTrack('Exported Track', 'other'); foreach ($markers['markers'] as $tid => $markerList) { foreach ($markerList as $marker) { $lo = new Location(); $lo->fillFromDbArray($marker); $trkpt = $lo->getGpxDom(); $gpx->addPoint($trkpt->documentElement); } } header('Content-type: application/gpx+xml'); header('Content-Disposition: attachment; filename=export.gpx'); echo $gpx->getXml();