diff options
Diffstat (limited to 'algorithms.py')
| -rw-r--r-- | algorithms.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/algorithms.py b/algorithms.py index 9f3fd78..e2da8f0 100644 --- a/algorithms.py +++ b/algorithms.py @@ -10,8 +10,7 @@ def length_haversine(p1, p2): lat1, lng1, lat2, lng2 = map(math.radians, [lat1, lng1, lat2, lng2]) dlat = lat2 - lat1 dlng = lng2 - lng1 - a = math.sin(dlat / 2) ** 2 + math.cos(lat1) * math.cos(lat2) * math.sin( - dlng / 2) ** 2 + a = math.sin(dlat / 2) ** 2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlng / 2) ** 2 c = 2 * math.asin(math.sqrt(a)) return 6372797.560856 * c # return the distance in meters @@ -33,7 +32,6 @@ def grid_search(grid, source_node): closest_nodes.append(get_closest_node(tile_nodes, source_node)) closest_node_id = get_closest_node(closest_nodes, source_node).id - return closest_node_id @@ -56,14 +54,10 @@ def look_for_nodes(offset, grid, source_key): tiles = [] for i in range(-offset, offset + 1): for j in range(-offset, offset + 1): - if i in (-offset, offset) or j in (-offset, offset): - key = (source_key[0] + j, source_key[1] + i) - if key in grid.keys(): tiles.append(grid[key]) - return tiles |
