craygl/phpgpx

This package is abandoned and no longer maintained. No replacement package was suggested.

Simple GPX Parser

1.1.0 2016-02-03 21:32 UTC

This package is not auto-updated.

Last update: 2023-08-09 13:40:01 UTC


README

PHPGPX is an easy to use GPX Parser written in PHP.

Installation

Available via composer

"require": {
    "craygl/phpgpx": "^1.0"
}

Example Usage

$GPXParser = new GPXParser();

$gpx = $GPXParser->parseXML($xml);

foreach ($gpx->getTracks() as $track) {
    foreach ($track->getTrackSegments() as $trackSegment) {
        foreach ($trackSegment->getTrackPoints() as $waypoint) {
            echo 'Lat: ' . $waypoint->getLatitude() . ', Lon:' . $waypoint->getLongitude();
        }
    }
}

The above example will list the latitude and longitude of all the waypoints in all of the tracks.