GPXIN-24: Waypoint Support

Issue Information

Issue Type: New Feature
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: PHP GPXIngest (GPXIN)
Resolution: Done (2017-07-04 12:07:42)
Affects Version: 1.03,
Target version: 1.03,

Created: 2016-02-13 09:58:31
Time Spent Working
90 minutes
35 minutes
55 minutes

Suggested on Github -

Implement support for Waypoints as defined in the GPX spec.

Issue Links

Waypoints (GPX Schema)
FR #4
Toggle State Changes


Replied with the following on Github:

Could conceivably be added, sure (for reference - relevant part of schema is ). In fact, it should be fairly straightforward to drop in as they'll need processing (at ingest) independently of the trackpoints anyway

I guess you'd then want to be able to do something like

To return all included Waypoints, or

To grab by a numerical identifier. Maybe even be able to retrieve by the name specified in the source GPX?

Probably also worth adding something to the JSON metadata to indicate whether there are any waypoints included.
An example GPX file (cobbled together using examples on Cycleseven) might be
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gpx xmlns="" version="1.1" creator="RouteConverter">
        <name>Test file by Patrick</name>
    <wpt lon="9.860624216140083" lat="54.9328621088893">
        <name>Position 1</name>
    <wpt lon="9.86092208681491" lat="54.93293237320851">
        <name>Position 2</name>
    <wpt lon="9.86187816543752" lat="54.93327743521187">
        <name>Position 3</name>
    <wpt lon="9.862439849679859" lat="54.93342326167919">
        <name>Position 4</name>
      <gpxx:TrackExtension xmlns:gpxx="">
      <trkpt lat="53.623000" lon="-2.574910">
      <trkpt lat="53.624500" lon="-2.569600">
      <trkpt lat="53.624500" lon="-2.569410">
      <trkpt lat="53.624700" lon="-2.567970">

So, we're going to want to look at creating a new object property to house the waypoints, and add the various possible attributes

Note that waypoints can have their own extensions (for example)
  <wpt lat="53.9927816" lon="-1.5425382">
    <cmt>02-FEB-10 14:10:06</cmt>
    <desc>02-FEB-10 14:10:06</desc>
    <sym>Flag, Blue</sym>
      <gpxx:WaypointExtension xmlns:gpxx="">

So support for those may need to be added later
btasker changed status from 'Open' to 'In Progress'

Repo: PHP-GPX-Ingest
Commit: c33637bcbeb75dae8dc783f1ffb555c8e46cea2d
Author: B Tasker <github@<Domain Hidden>>

Date: Sat Feb 20 22:37:38 2016 +0000
Commit Message: Implemented parsing of waypoints for GPXIN-24

Modified (-)(+)

Webhook User-Agent


View Commit

Have come across a slight hiccup with the implementation so far.

When exporting JSON, we only pass out the journey property (and conversely, only populate that when reading in from a JSON source). The current implementation adds waypoints as a completely separate property (as, really, they should be), which means they won't be included in a JSON dump.

Changing the JSON output so that it no longer solely pushes out journey would change the structure of the output and break b/c.

Although I don't overly like it as a solution, waypoints (and if they're added at a later date, route points) should probably be added as a property of journey to ensure they're included in the JSON output. Perhaps grouped under "related" or similar

Repo: PHP-GPX-Ingest
Commit: 08f22bfff6130c9f6e605670995c14ff29d81226
Author: B Tasker <github@<Domain Hidden>>

Date: Sat Feb 20 22:45:04 2016 +0000
Commit Message: Moved waypoints to being a property of journey. See GPXIN-24

Modified (-)(+)

Webhook User-Agent


View Commit

Have added 3 public methods to the class to provide basic handling of waypoints
public function getWayPointCount() // return INT
public function getWaypoints() // return array
public function getWaypoint($id) // return object

Where the structure of a waypoint is as follows
stdClass Object
    [name] => Position 1
    [description] => 
    [comment] => 
    [position] => stdClass Object
            [lat] => 54.9328621088893
            [lon] => 9.860624216140083
            [ele] => 0.0
            [geoidheight] => 

    [meta] => stdClass Object
            [time] => 
            [magvar] => 
            [source] => 
            [link] => 
            [symbol] => 
            [type] => 
            [GPS] => stdClass Object
                    [fix] => 
                    [sat] => 
                    [hdop] => 
                    [vdop] => 
                    [pdop] => 
                    [ageofdgpsdata] => 
                    [dgpsid] => 


All properties defined within wptType in the spec will always be present in the output, however if they weren't present in the source they will be null
Have updated the documentation to give details of the current waypoint support -
btasker changed status from 'In Progress' to 'Open'
btasker changed timespent from '0 minutes' to '55 minutes'
btasker changed status from 'Open' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'

Work log

Ben Tasker
2016-02-20 23:08:32

Time Spent: 55 minutes
Log Entry: Implementing base support, testing and updating documentation