add routing and util to the right places

This commit is contained in:
Kadir 2024-03-13 16:22:53 +00:00
parent a9b8d4d630
commit d4f87bed76
3 changed files with 130 additions and 0 deletions

13
crawler/5_routing.py Normal file
View file

@ -0,0 +1,13 @@
from data_access import Listing
from tqdm import tqdm
listings = Listing.get_all_listings()
BROCK_STREET_LAT_LONG = 51.52570434674584, -0.13956495005056113
for listing in tqdm(listings):
lat, long = BROCK_STREET_LAT_LONG
listing.calculate_route(lat, long, recalculate=False)
traveltime = listing.travel_time[0]
duration_minutes = traveltime['duration'] / 60.
tqdm.write(f"{listing.identifier} {duration_minutes}")