src/Workout/Dumper/GPX.php
private function writeTrackPoints(\XMLWriter $xmlWriter, array $trackPoints)
    {
        foreach ($trackPoints as $trackPoint) {
            $xmlWriter->startElement('trkpt');

            // Location.
            $xmlWriter->writeAttribute('lat', (string)$trackPoint->latitude());
            $xmlWriter->writeAttribute('lon', (string)$trackPoint->longitude());

            // Elevation.
            $xmlWriter->writeElement('ele', (string)$trackPoint->elevation());

            // Time of position
            $dateTime = clone $trackPoint->dateTime();
            $dateTime->setTimezone(new \DateTimeZone('UTC'));
            $xmlWriter->writeElement('time', $dateTime->format(\DateTime::W3C));

            // Extensions.
            $this->writeExtensions($xmlWriter, $trackPoint->extensions());

            $xmlWriter->endElement();
        }
    }
private function writeTrackPoints(\XMLWriter $xmlWriter, array $trackPoints)
    {
        foreach ($trackPoints as $trackPoint) {
            $xmlWriter->startElement('trkpt');

            // Location.
            $xmlWriter->writeAttribute('lat', (string)$trackPoint->latitude());
            $xmlWriter->writeAttribute('lon', (string)$trackPoint->longitude());

            // Elevation.
            $xmlWriter->writeElement('ele', (string)$trackPoint->elevation());

            // Time of position
            $dateTime = clone $trackPoint->dateTime();
            $dateTime->setTimezone(new \DateTimeZone('UTC'));
            $xmlWriter->writeElement('time', $dateTime->format(\DateTime::W3C));

            // Extensions.
            $this->writeExtensions($xmlWriter, $trackPoint->extensions());

            $xmlWriter->endElement();
        }
    }
private function writeTrackPoints ( \ XMLWriter $ xmlWriter , array $ trackPoints ) { foreach ( $ trackPoints as $ trackPoint ) { $ xmlWriter -> startElement ( 'trkpt' ) ; // Location. $ xmlWriter -> writeAttribute ( 'lat' , ( string ) $ trackPoint -> latitude ( ) ) ; $ xmlWriter -> writeAttribute ( 'lon' , ( string ) $ trackPoint -> longitude ( ) ) ; // Elevation. $ xmlWriter -> writeElement ( 'ele' , ( string ) $ trackPoint -> elevation ( ) ) ; // Time of position $ dateTime = clone $ trackPoint -> dateTime ( ) ; $ dateTime -> setTimezone ( new \ DateTimeZone ( 'UTC' ) ) ; $ xmlWriter -> writeElement ( 'time' , $ dateTime -> format ( \ DateTime :: W3C ) ) ; // Extensions. $ this -> writeExtensions ( $ xmlWriter , $ trackPoint -> extensions ( ) ) ; $ xmlWriter -> endElement ( ) ; } }
Write the track points to the GPX.

@param \XMLWriter $xmlWriter The XML writer.
@param TrackPoint[] $trackPoints The track points to write.
Write the track points to the GPX .