Reduced need for routing by limiting to a radius of 7 miles
This commit is contained in:
parent
6a43a7f485
commit
c8c53b8696
4 changed files with 82 additions and 23 deletions
|
|
@ -1,10 +1,21 @@
|
|||
from data_access import Listing
|
||||
from tqdm import tqdm
|
||||
from geopy.distance import geodesic
|
||||
|
||||
listings = Listing.get_all_listings()
|
||||
BROCK_STREET_LAT_LONG = 51.52570434674584, -0.13956495005056113
|
||||
|
||||
for listing in tqdm(listings):
|
||||
# reduce listings to everything within 7 miles
|
||||
filtered_listings = []
|
||||
for listing in listings:
|
||||
miles = geodesic(BROCK_STREET_LAT_LONG, (listing.latitude, listing.longitude)).miles
|
||||
if miles <= 7:
|
||||
filtered_listings.append(listing)
|
||||
|
||||
print(f"Filtered listings from {len(listings)} to {len(filtered_listings)}")
|
||||
|
||||
|
||||
for listing in tqdm(filtered_listings):
|
||||
lat, long = BROCK_STREET_LAT_LONG
|
||||
listing.calculate_route(lat, long, recalculate=False)
|
||||
traveltime = listing.travel_time[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue