-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
44 lines (40 loc) · 1.56 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from geopy.distance import vincenty
from casap.utilities.utils import get_address_map_google
def print_test():
address = \
'Mundy Park Hillcrest Parking Lot, Hillcrest Street, Coquitlam, BC, Canada'
address_list = [
['Mundy Park Off Leash Dog Park, Mariner Way, Coquitlam, BC, Canada'
, 3],
['Mundy Lake, Coquitlam, BC, Canada', 1],
['Lost Lake, Coquitlam, BC, Canada', 3],
['Mundy Park Softball Fields, Coquitlam, BC, Canada', 1],
['Starbucks, 2662 Austin Avenue, Coquitlam, BC, Canada', 3],
['Coquitlam Alliance Church, Spuraway Avenue, Coquitlam, BC, Canada'
, 3],
['Riverview Forest, Coquitlam, BC, Canada', 3],
['Spani Outdoor Pool, Coquitlam, BC, Canada', 1],
]
for i in range(10):
add = get_address_map_google(address)
if add is None:
add = get_address_map_google(address)
else:
break
add_lat = add['lat']
add_lng = add['lng']
print('Missing Location: {}'.format(address))
for x in address_list:
for i in range(10):
x_add = get_address_map_google(x[0])
if x_add is None:
x_add = get_address_map_google(x[0])
else:
break
x_lat = x_add['lat']
x_lng = x_add['lng']
vin = vincenty((x_lat, x_lng), (add_lat, add_lng)).kilometers
if vin <= x[1]:
print('{} | {} | {} | {}'.format(x[0], x[1], vin, 'yes'))
else:
print('{} | {} | {} | {}'.format(x[0], x[1], vin, 'yes'))