GPXIN-6 - Distance Calculations =================================== [Issue](http://projects.bentasker.co.uk/jira_projects/browse/GPXIN-6.html) Aim ----- For each trackpoint, the class should calculate the distance travelled when compared to the previous trackpoint. Ultimately, each track segment, track and journey should have a new statistic added detailing the distance travelled. Unit Of Measure ---------------- The distance travelled is easiest to calculate in Miles, but given that most GPS systems generate a trackpoint at an interval of 5 seconds, it may be better to record in a smaller unit (whether yards, feet or metres). Method of Calculation ------------------------ Although it can introduce inaccuracies, the Greater Circle (haversine) method seems most appropriate. Given the short interval between trackpoints, the effect of inaccuracies in Greater Circle calculations (being a as-the-crow-flies measure) should theoretically be minimal. Assuming all degrees have been convered to radius, the formula can be expressed as acos(sin($lat1) * sin($lat2) + cos($lat1) + cos($lat2) + cos($theta)) To convert to miles, we simply need to convert back to degrees and then $dist * 60 * 1.1515; Implementation ---------------- The Distance calculation functionality is initially being implemented as 'experimental' functionality. The experimental key (see GPXIN-17) for this functionality is _calcDistance_