This will not solve all your issues, but its a good start.
This script in python 2 works with a csv file with three fields: id, latitude, longitude.
You can also add time field and implement the codes for calculate the average speed.
It calculates absolute distance walked(diference between last and first point), also calculates the sum of distance to all points, and how many times walked to north, south, east and west.
The algorithm is very simple but you can improve it.
from math import sqrt
def openCSV(self, filename, delimitador):
self.csvfile = csv.reader(open(filename), delimiter= delimitador)
for i in self.csvfile:
matrix.append( [ float(i), float(i), float(i)] )
def total_walked(self, matrix):
distX = 0.
distY = 0.
x_ant = 0.
y_ant = 0.
## if walked north or south, east or west this is relative,
## if analyzed move is in south hemisphere for example, the
## walked_south will be walked_north and vice-versa becouse
## south latitude coordinates are negative.
## if the moves cross equatorial line these values will be worthless.
walked_east = 0
walked_west = 0
walked_north = 0
walked_south = 0
for i in matrix:
if(x_ant != 0):
if (i-x_ant > 0):
distX= distX + (i - x_ant)
walked_east= walked_east + 1
if(i -x_ant < 0 ):
distX= distX - (i - x_ant)
walked_west = walked_west + 1
x_ant = i
if (y_ant != 0):
if (i - y_ant > 0):
distY = distY+ (i - y_ant)
walked_north = walked_north + 1
if(i - y_ant < 0 ):
distY = distY - (i - y_ant)
walked_south = walked_south + 1
y_ant = i
print "Walked Norte %s times" % walked_north
print "Walked South %s times" % walked_south
print "Walked East %s times" % walked_east
print "Walked West %s times" % walked_west
print "Total distance X walked: %.2f" % distX
print "Total distance Y walked: %.2f" % distY
print "Total distance: %.2f" % sqrt(pow(distX,2)+ pow(distY,2))
def total_distance(self, matrix):
num = len(matrix)-1
distanceY = matrix[num] - matrix
distanceX = matrix[num] - matrix
print "Absolute Distance Y: %s" % distanceY
print "Absolute Distance X: %s" % distanceX
print "Total Absolute Distance: %s" % sqrt(pow(distanceX,2)+ pow(distanceY,2))
matrix = 
delimiter = ','
print "Type path of csv file:"
path = raw_input()
csv_file = CSVFile()
matrix = csv_file.values()
calculum = Distance()