-
-
Notifications
You must be signed in to change notification settings - Fork 312
Expand file tree
/
Copy pathcoordinates.py
More file actions
23 lines (17 loc) · 583 Bytes
/
coordinates.py
File metadata and controls
23 lines (17 loc) · 583 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""app.coordinates.py"""
class Coordinates:
"""
A position on earth using decimal coordinates (latitude and longitude).
"""
def __init__(self, latitude, longitude):
self.latitude = latitude
self.longitude = longitude
def serialize(self):
"""
Serializes the coordinates into a dict.
:returns: The serialized coordinates.
:rtype: dict
"""
return {"latitude": self.latitude, "longitude": self.longitude}
def __str__(self):
return "lat: %s, long: %s" % (self.latitude, self.longitude)