GPXIN-26: Calculate Min/Max Lat and Lon and add to Stats



Issue Information

Issue Type: New Feature
 
Priority: Minor
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: PHP GPXIngest (GPXIN)
Resolution: Done (2016-02-20 20:53:31)
Affects Version: 1.02,
Target version: 1.02,

Created: 2016-02-20 19:24:49
Time Spent Working
Estimated:
  
30 minutes
Remaining:
 
0 minutes
Logged:
 
32 minutes


Description
Requested on Github as #7

Add new stats indicating the highest and lowest lat/lon pairs seen.



Issue Links

Github FR #7
Toggle State Changes

Activity


Need to know more about the use-case the user has in mind, do they want the actual coordinates for max/min (so an actual lat/lon pair) or are they simply interested in extracting the maximum/minimum recorded latitude - essentially meaning those stats properties will simply be decimal.

One option might be to make the relevant stats property an object in itself, so we'd have something like
$stats->maxLon->Lon = 1234
$stats->maxLon->Lat = 4567
$stats->maxLat->Lon = 1134
$stats->maxLat->Lat = 5567


Which would give the option of either, but then when retrieving it you'd have to do something like
$foo = $o->getStats('MaxLon');
echo $foo->Lon;

Which feels a bit ugly and un-necessary
btasker changed priority from 'Major' to 'Minor'
The user has said they need square bounds on a per-file, per-track and per-segment basis. Makes sense, it'd allow you (for example) to easily extract the bounds to pass into Google Maps to ensure it's correctly centred around the track you're displaying.
btasker changed status from 'Open' to 'In Progress'
Commit 6d9e313 implements bounds calculations for the overall file, and also on a per-segment basis, so we just need to calculate per-track now.
btasker changed status from 'In Progress' to 'Open'

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

Date: Sat Feb 20 20:16:13 2016 +0000
Commit Message: Implemented Segment and overall lat/lon bounds for GPXIN-26



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




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit

btasker changed timespent from '0 minutes' to '26 minutes'
We now have a bounds object within the stats for
- the entire file
- each track
- each segment

Running a print_r() on each gives
gpx->getJourneyStats()
stdClass Object
(
    [trackpoints] => 778
    [recordedDuration] => 7556
    [segments] => 16
    [tracks] => 16
    [maxacceleration] => 0
    [maxdeceleration] => 0
    [minacceleration] => 0
    [mindeceleration] => 0
    [avgacceleration] => 0
    [avgdeceleration] => 0
    [speedUoM] => Array
        (
        )

    [timeMoving] => 0
    [timeStationary] => 0
    [timeAccelerating] => 0
    [timeDecelerating] => 0
    [distanceTravelled] => 0
    [bounds] => stdClass Object
        (
            [Lat] => stdClass Object
                (
                    [min] => 56.114105
                    [max] => 56.179494
                )

            [Lon] => stdClass Object
                (
                    [min] => 43.346461
                    [max] => 43.522420
                )

        )

    [start] => 1368860043
    [end] => 1368888867
)

gpx->getStats('journey0')
stdClass Object
(
    [journeyDuration] => 1562
    [maxacceleration] => 0
    [maxdeceleration] => 0
    [minacceleration] => 0
    [mindeceleration] => 0
    [avgacceleration] => 0
    [avgdeceleration] => 0
    [speedUoM] => Array
        (
        )

    [timeMoving] => 0
    [timeStationary] => 0
    [timeAccelerating] => 0
    [timeDecelerating] => 0
    [distanceTravelled] => 0
    [bounds] => stdClass Object
        (
            [Lat] => stdClass Object
                (
                    [min] => 56.114105
                    [max] => 56.119712
                )

            [Lon] => stdClass Object
                (
                    [min] => 43.503630
                    [max] => 43.522420
                )

        )

    [start] => 1368860043
    [end] => 1368861605
    [recordedDuration] => 1562
    [elevation] => stdClass Object
        (
            [max] => 129.22
            [min] => 60.83
            [avgChange] => 0.38
        )

)

gpx->getStats('journey0','seg0')
stdClass Object
(
    [distanceTravelled] => 0
    [bounds] => stdClass Object
        (
            [Lat] => stdClass Object
                (
                    [min] => 56.114105
                    [max] => 56.119712
                )

            [Lon] => stdClass Object
                (
                    [min] => 43.503630
                    [max] => 43.522420
                )

        )

    [start] => 1368860043
    [end] => 1368861605
    [journeyDuration] => 1562
    [elevation] => stdClass Object
        (
            [max] => 129.22
            [min] => 60.83
            [avgChange] => 0.38
        )

    [timeMoving] => 0
    [timeStationary] => 0
    [timeAccelerating] => 0
    [timeDecelerating] => 0
)
btasker changed timespent from '26 minutes' to '32 minutes'

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

Date: Sat Feb 20 20:32:26 2016 +0000
Commit Message: Added per track lat/lon bounds for GPXIN-26 (FR #7)



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




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit

I've updated the documentation (https://www.bentasker.co.uk/documentation/development-programming/222-php-gpx-ingest) to reflect the change to the stats objects
btasker changed status from 'Open' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'

Work log


Ben Tasker
Permalink
2016-02-20 20:17:32

Time Spent: 26 minutes
Log Entry: Initial implementation and testing

Ben Tasker
Permalink
2016-02-20 20:32:57

Time Spent: 6 minutes
Log Entry: Implementing per-track stats and testing