wenfengyvn / open-gpstracker

Automatically exported from code.google.com/p/open-gpstracker
0 stars 0 forks source link

Statistics are wrong #399

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Record a track
2.Open statistics page

What is the expected output? What do you see instead?
Expect to see a total distance of a few miles (from one of my recorded tracks). 
Instead I see a very large distance, and the total distance is different each 
time I open the statistics page.

Which Android device are you using?
Blu Life Play

What version of Android are you running?
4.2.1

What version of the Open GPS Tracker are you running?
1.3.5

Please provide any additional information below.
I think this is due to a bug in the android implementation of 
Location.distanceTo(). This function seems to randomly return the wrong 
distance. The location.distanceBetween() function also has the same problem.

I was able to get the correct statistics to be consistently displayed by using 
the attached patch, which uses a modified form of the underlying code that 
distanceTo() uses. I'm not sure why my version of the function works and the 
original doesn't, because all I changed was to move the calculation of the 
variable "A" out of the loop.

In the original the variable "A" takes on very large values resulting in an 
incorrect distance. Also, this only occurs when the program is running without 
the debugger, so to see the incorrect behavior in the original function you 
should output the variable values to the log. Let me know if you can answer why 
my modification works.

Original issue reported on code.google.com by nico.sch...@gmail.com on 17 Nov 2013 at 11:12

Attachments: