def estimate_walk_time_to(self, lat, lng): return int(geo.haversine(self.lng, self.lat, lng, lat) * 60 / 80) # result in seconds
def estimate_distance(start_location, end_location): return geo.haversine(start_location.lng, start_location.lat, end_location.lng, end_location.lat)
def resolve_name(name, transport, location): graph = load_graph() stations = [x for x in graph.steps if x.transport == transport and geo.haversine(location.lng, location.lat, x.lng, x.lat) < 500] if len(stations) > 0: return stations[0]