]> gitweb.michael.orlitzky.com - dead/census-tools.git/blob - GPS.py
bc2e20be64b5e04e62ea836369aa73ae601de4fe
[dead/census-tools.git] / GPS.py
1 from math import sqrt
2
3
4 class Coordinates:
5 """Represents a set of GPS coordinates (latitude/longitude)."""
6
7 def __init__(self):
8 self.latitude = 0
9 self.longitude = 0
10
11
12
13 def CalculateDistance(p1, p2):
14 """
15 Calculate the distance between two Coordinates, p1 and p2.
16 """
17 delta_x = p2.longitude - p1.longitude
18 delta_y = p2.latitude - p1.latitude
19 euclidean_distance = sqrt(delta_x**2 + delta_y**2)
20
21 return euclidean_distance