Depending on the system used to generate the GPX file, speed may be listed under an extension, as below (from
GPXIN-19)
<trk>
<trkseg>
<trkpt lat=3D"11.543009877" lon=3D"-85.697211027">
<ele>55.0</ele>
<time>2015-07-25T12:02:02.989Z</time>
<extensions>
<nmea:course>11.6</nmea:course>
<nmea:speed>1.7</nmea:speed>
</extensions>
</trkpt>
There's no way to know for sure what extension the data we need will be listed under, so will need to add a method so that the class can be told what to look for (and perhaps set some known defaults too?)
Activity
2015-08-11 00:08:11
I think the first thing I'd like to do is to at least get the extensions data into the object's output, then look at ways in which developers can tell the class to use those extensions.
Taking the example above, it'd be good to be able to do something similar to the following
But, if we can at least get the extensions written into the JSON first, there'll at least be a way to grab the raw data.
2015-08-11 00:26:09
That aside, dropping the following in seems to work OK
So should just be a case of getting the class to look for namespaces in the GPX file, cycle through those and then add values for each of the extensions to an array or object.
2015-08-11 00:38:52
Each of the namespaces is it's own array, so the seperation is maintained.
Not sure if I like the implementation yet, but it is at least functional.
2015-08-11 00:40:08
Webhook User-Agent
View Commit
2015-08-11 00:49:46
2015-08-11 00:50:12
Webhook User-Agent
View Commit
2015-08-11 00:56:22
We'd call something like
To create a mapping.
It means adding additional complexity to ingest though, and that method is already overly complex to read through. Might need to look at breaking the processing logic for this out into another function. Also need to work out the best failure scenario, if I've used the example above but the trackpoint XML is
Do we fall back to using desc (the default), ignore or throw an exception?
Will need to give it some more thought before doing much more.
2015-08-13 17:58:01
The existing calculations around https://github.com/bentasker/PHP-GPX-Ingest/blob/8a3da3a4f7543a74642d7fd9489a1827005607bf/GPXIngest.class.php#L276 will need to be moved/removed.
The idea being that the method should return two values which will be pushed into ptspeed and speed_string
Any direct references to trkpt->desc will need to be replaced with speed_string
The auto-calculation logic introduced in 05af1e8 (View Commit) can largely stay unchanged - if the field used is empty (or doesn't exist) the class can then autocalc the speed based on position data.
That way the new chunk of logic can go into a new method (avoiding adding extra length to ingest itself) and the decision as to where the values of ptspeed and speed_string can be centralised to one location.
The decision as to whether to automatically suppress speed (https://github.com/bentasker/PHP-GPX-Ingest/blob/8a3da3a4f7543a74642d7fd9489a1827005607bf/GPXIngest.class.php#L282) will likely need to move though.
Haven't got time to start implementing the changes right now, so largely noting the plans down for when I have a minute free.
2017-07-04 13:13:11
2017-07-04 13:13:11