What i am after is the total distance traveled since a certain point in time including turns and in the smallest possible unit (probably meters). The starting point for the counter could be from when the phone starts or when the program was started.
Originally Posted by JOM
Im not sure if the code above make sense since it is very early
if __name__ == "__main__":
start_dist = gps.global_distance()
last_dist = start_dist
glob_dist = gps.global_distance()
current_dist = glob_dist - start_dist
print 'you have traveled %d meters since the app started' \
# calculate the speed, since the update is per second
# the distance since the last update is the speed
dist_since_update = glob_dist - last_dist
last_dist = glob_dist
print '%d meters per second' % (dist_since_update)
and i am on vacation and could not sleep, but it is the global_distance
that is the interesting function. :-)
The code above would work with any return value the first time the global_distance was called. So if the global distance counters starts counting on the first invocation or any point in time before the first invocation does not matter as long as the subsequent calls returns a value that is the same or has increased since the first call.
It would be a nice to have method for apps that just tracks distance or calculates current speed.