def find_close_parks(origin, time, routing, parks):
"""Create a dictionary with park objects corresponding to a distance radius heuristic.
Use Vincenty's solution to the inverse geodetic problem to find straight-line
distance from the origin to each park location and determine whether the
distance is within the bounding box heuristic.
"""
close_parks = {}
for park in parks:
dist = vincenty((origin.latitude, origin.longitude),
(park.latitude, park.longitude)).miles
if dist < find_appx_dist(time, routing):
# close_parks[park.name] = park
close_parks[(dist, park.name)] = park
return close_parks
评论列表
文章目录