Skip to content
Snippets Groups Projects
Commit 6c7725ab authored by markn92's avatar markn92
Browse files

test

parent 831c22e4
No related branches found
No related tags found
No related merge requests found
......@@ -66,3 +66,18 @@ def shortest_path(G, s: point, t: point, profile):
) / profile['maxspeed'] * ms_to_kmh
return nx.astar_path(G, _s, _t, heuristic=dist)
def to_coordinates(G, path):
"""
Path of nodes to path of coordinates.
Note: Coordinates are (lon, lat) to conform to
geojson.
"""
def get_coordinates(n):
lat = G.nodes[n]['lat']
lon = G.nodes[n]['lon']
return lon, lat
return list(map(get_coordinates, path))
......@@ -73,3 +73,20 @@ def test_shortest_route(map_graph):
]
assert route == shortest_path(map_graph, s, t, car)
def test_other_shortest_route(map_graph):
s = (51.75344308292687, 6.943187713623048)
t = (51.754452602619935, 6.958980560302735)
route = [
"1827268706",
"1826594887",
"4955446046",
"4955446048",
"34053450",
"4955446051",
"418009799"
]
assert route == shortest_path(map_graph, s, t, car)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment