########################################################################################## GPXIN-6: Distance calculations ########################################################################################## Issue Type: Improvement ----------------------------------------------------------------------------------------- Issue Information ==================== Priority: Major Status: Closed Resolution: Done (2015-04-15 10:07:18) Project: PHP GPXIngest (GPXIN) Reported By: btasker Assigned To: btasker Targeted for fix in version: - 1.02 Time Estimate: 0 minutes Time Logged: 0 minutes ----------------------------------------------------------------------------------------- Issue Description ================== This may have a severe performance impact (potentially), but it'd be pretty awesome if we could calculate the distance travelled using Greater Circle on the lat/lons. GPX track files normally contain a capture every 5 seconds or so, the usual inaccuracy with using greater circle shouldn't apply quite as dramatically here. ----------------------------------------------------------------------------------------- Issue Relations ================ - is blocked by GPXIN-17: Expose a method to enable 'experimental' features - relates to GPXIN-22: Measure impact of Distance Calculations - relates to GPXIN-23: Move calcDistance out of Experimental Features - Design Notes (http://projectsstatic.bentasker.co.uk/GPXIN/GPXIN-6-Distance_Calculations/Design_Notes.txt) ----------------------------------------------------------------------------------------- Activity ========== ----------------------------------------------------------------------------------------- 2013-11-17 20:16:09 ----------------------------------------------------------------------------------------- btasker added '1.02' to Fix Version ----------------------------------------------------------------------------------------- 2013-11-17 20:19:08 ----------------------------------------------------------------------------------------- btasker changed status from 'Open' to 'Closed' ----------------------------------------------------------------------------------------- 2013-11-17 20:19:08 ----------------------------------------------------------------------------------------- btasker added 'Done' to resolution ----------------------------------------------------------------------------------------- 2015-01-13 10:27:06 btasker ----------------------------------------------------------------------------------------- Re-Opening as have found a use-case for this (received an email which appears to be asking if it's possible) ----------------------------------------------------------------------------------------- 2015-01-13 10:27:06 ----------------------------------------------------------------------------------------- btasker removed 'Done' from resolution ----------------------------------------------------------------------------------------- 2015-01-13 10:27:06 ----------------------------------------------------------------------------------------- btasker changed status from 'Closed' to 'Reopened' ----------------------------------------------------------------------------------------- 2015-01-13 10:27:06 ----------------------------------------------------------------------------------------- btasker added 'Ben Tasker' to assignee ----------------------------------------------------------------------------------------- 2015-01-13 10:29:58 btasker ----------------------------------------------------------------------------------------- Still a little concerned about the processing overhead, but I think the work-around is to have it disabled by default and to expose a method which will allow it to be enabled (GPXIN-17). ----------------------------------------------------------------------------------------- 2015-01-13 10:50:02 btasker ----------------------------------------------------------------------------------------- GPXIN-17 has been implemented, so this functionality can now be implemented as an experimental feature ----------------------------------------------------------------------------------------- 2015-01-13 11:08:36 btasker ----------------------------------------------------------------------------------------- As noted in the design notes (see Links section), the experimental key for this functionality is _calcDistance_ ----------------------------------------------------------------------------------------- 2015-01-13 11:33:12 btasker ----------------------------------------------------------------------------------------- Basic calculations have been implemented (though currently only tested with one dataset). Example usage is -- BEGIN SNIPPET -- loadFile('gpxtestfile.gpx'); $gpx->enableExperimental('calcDistance'); $gpx->ingest(); $tpts = $gpx->getTrackPointNames('journey0','seg0'); print_r($gpx->getTrackPoint('journey0','seg0',$tpts[3])); print_r($gpx->getTrackPoint('journey0','seg0',$tpts[4])); -- END SNIPPET -- The returned distance travelled was then calculated manually and using online calculators. Looks like the calculations are correct. Commit 0312b20 refers. Still need to push the distance out to an array of some form so that stats can be used/updated for each Segment/Track. If the functionality is not enabled, the method _calculateTravelledDistance_ will return _0_ which might get confusing somewhere down the line - it's probably worth having a list of which experimental features are enabled pushed to the metadata (have raised GPXIN-18 for implementation). ----------------------------------------------------------------------------------------- 2015-01-13 11:37:10 git ----------------------------------------------------------------------------------------- -- BEGIN QUOTE -- Repo: PHP-GPX-Ingest Commit: 0312b20464d628b671ce1c70b867e737321c9946 Author: Ben Tasker