Skip to content
Snippets Groups Projects
Commit 19df1979 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Explanation of magic constants

parent 589ecaa5
No related branches found
No related tags found
No related merge requests found
......@@ -28,9 +28,14 @@ def dist(a, b):
assert 40 < a[0] and a[0] < 60, a[0]
assert 5 < a[1] and a[1] < 25, a[1]
assert 40 < b[0] and b[0] < 60, b[0]
assert 5 < b[1] and b[1] < 25, b[1]
assert 5 < b[1] and b[1] < 25, b[1] # Check that we are somewhere near Prague
# lat lon
return math.sqrt(((a[0]-b[0])*111.2)**2 + ((a[1]-b[1])*71.50)**2)
# ... and then use distance approximation based on length of one degree there.
lon_muntiplicator = 71.50/111.2
# This is magic constant for approximation globe to plane working near Prague.
# If lon is multiplied with this constant, one unit of lat and multiplied lon will have approximately the same distance
def shape_indexer(shape, i: float):
ii = int(i)
......@@ -40,7 +45,6 @@ def shape_indexer(shape, i: float):
return shape[ii]*(1-rest) + shape[ii+1]*rest
lon_muntiplicator = 71.50/111.2
async def get_data_of_trip(trip_id, date_from, date_to):
c = await get_communication()
dts = await c.list_realtime_data(date_from, date_to)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment