GPXIN-27: Route Support



Issue Information

Issue Type: New Feature
 
Priority: Major
Status: Open

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: PHP GPXIngest (GPXIN)
Resolution: Unresolved
Affects Version: 1.02,
Target version: 1.02,

Created: 2016-02-20 23:35:36
Time Spent Working
Estimated:
 
120 minutes
Remaining:
  
75 minutes
Logged:
  
45 minutes


Description
GPXIN-24 introduced support for ingesting waypoints defined in the source GPX file. A natural extension of that would be to add support for the rteType .

For purposes of clarity: A route is the planned route, whereas the track is the path ultimately followed.

There'll normally only be the one route, but as with tracks, it's best to work on the basis that there may be more than one


Issue Links

rteType (GPX Documentation)
Toggle State Changes

Activity


An example GPX might be (from CycleSeven)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="RouteConverter">
    <metadata>
        <name>Test file by Patrick</name>
   </metadata>
    <wpt lon="9.860624216140083" lat="54.9328621088893">
        <ele>0.0</ele>
        <name>Position 1</name>
    </wpt>
    <wpt lon="9.86092208681491" lat="54.93293237320851">
        <ele>0.0</ele>
        <name>Position 2</name>
    </wpt>
    <wpt lon="9.86187816543752" lat="54.93327743521187">
        <ele>0.0</ele>
        <name>Position 3</name>
    </wpt>
    <wpt lon="9.862439849679859" lat="54.93342326167919">
        <ele>0.0</ele>
        <name>Position 4</name>
    </wpt>
    <rte>
        <name>Patrick's Route</name>
        <rtept lon="9.860624216140083" lat="54.9328621088893">
            <ele>0.0</ele>
            <name>Position 1</name>
        </rtept>
        <rtept lon="9.86092208681491" lat="54.93293237320851">
            <ele>0.0</ele>
            <name>Position 2</name>
        </rtept>
        <rtept lon="9.86187816543752" lat="54.93327743521187">
            <ele>0.0</ele>
            <name>Position 3</name>
        </rtept>
        <rtept lon="9.862439849679859" lat="54.93342326167919">
            <ele>0.0</ele>
            <name>Position 4</name>
        </rtept>
    </rte>
  <trk>
    <name>24-JUL-09</name>
    <extensions>
      <gpxx:TrackExtension xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
        <gpxx:DisplayColor>DarkRed</gpxx:DisplayColor>
      </gpxx:TrackExtension>
    </extensions>
    <trkseg>
      <trkpt lat="53.623000" lon="-2.574910">
       <ele>143.94</ele>
       <time>2009-07-11T21:37:58Z</time>
      </trkpt>
      <trkpt lat="53.624500" lon="-2.569600">
       <ele>136.06</ele>
       <time>2009-07-11T21:38:55Z</time>
      </trkpt>
      <trkpt lat="53.624500" lon="-2.569410">
       <ele>138.03</ele>
       <time>2009-07-11T21:38:57Z</time>
      </trkpt>
      <trkpt lat="53.624700" lon="-2.567970">
       <ele>148.75</ele>
       <time>2009-07-11T21:39:12Z</time>
      </trkpt>
    </trkseg>
  </trk>
</gpx>


Note that rtept is of type wptType so as in GPXIN-24 need to consider that extensions may be present
Given that the handling for a rtept is exactly the same as that for a waypoint, it probably makes sense to break some of the logic implemented in GPXIN-24 out into a new method to avoid duplication
btasker changed status from 'Open' to 'In Progress'

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

Date: Sun Feb 21 00:07:10 2016 +0000
Commit Message: Moved wptType logic into new method. See GPXIN-27



Modified (-)(+)
-------
GPXIngest.class.php




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit

Have created
private function buildWptType($wpt)

To handle building the object.

Now need to look at actually pulling the routes out of the GPX file so that they can be processed. They're more like tracks in the way that needs to be handled - there can be multiple routes (some named, but it's not mandatory) and it'll have multiple children.
Routes are now ingested under the related property of the journey object, with the following structure
                    [routes] => stdClass Object
                        (
                            [route0] => stdClass Object
                                (
                                    [name] => Patrick's Route
                                    [meta] => stdClass Object
                                        (
                                            [comment] => 
                                            [description] => 
                                            [src] => 
                                            [link] => 
                                            [number] => 
                                            [type] => 
                                        )

                                    [points] => stdClass Object
                                        (
                                            [rtpoint0] => stdClass Object

Need to add some public methods to allow retrieval of them yet though
btasker changed status from 'In Progress' to 'Open'
btasker changed timespent from '0 minutes' to '25 minutes'

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

Date: Sun Feb 21 00:26:09 2016 +0000
Commit Message: Added Route support into ingest method. See GPXIN-27



Modified (-)(+)
-------
GPXIngest.class.php




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit


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

Date: Sun Feb 21 06:25:32 2016 +0000
Commit Message: Added basic functions for retrieving routes. See GPXIN-27



Modified (-)(+)
-------
GPXIngest.class.php




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit

Added three methods for getting route information
public function getRouteNames()
public function getRouteByID($id)
public function getRouteCount()


It's a bit of a sledgehammer approach at the moment, there's no way to extract an individual route point. You'd need to use getRouteByID and then iterate over the points property.

Conversely, there's also no way to extract all routes in one hit either
btasker changed timespent from '25 minutes' to '45 minutes'

Work log


Ben Tasker
Permalink
2016-02-21 00:28:19

Time Spent: 25 minutes
Log Entry: Initial implementation

Ben Tasker
Permalink
2016-02-21 06:46:50

Time Spent: 20 minutes
Log Entry: Adding retrieval methods, testing and updating docs