diff --git a/prog/data_utils.py b/prog/data_utils.py index 525bc135688184c2406dab8df19d4151de4e7b98..d2e99b6a752d98b915dcd93303c6916fff739c36 100644 --- a/prog/data_utils.py +++ b/prog/data_utils.py @@ -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)