calculate route duration
This commit is contained in:
parent
676a561578
commit
54c25e9f94
2 changed files with 21 additions and 3 deletions
|
@ -396,7 +396,7 @@ class Router:
|
|||
origin_addition = origin.nodes_addition.get(origin_node)
|
||||
destination_addition = destination.nodes_addition.get(destination_node)
|
||||
|
||||
return Route(self, origin, destination, distances[origin_node, destination_node], path_nodes,
|
||||
return Route(self, origin, destination, path_nodes, options,
|
||||
origin_addition, destination_addition)
|
||||
|
||||
|
||||
|
@ -543,6 +543,14 @@ class RouterWayType:
|
|||
raise AttributeError
|
||||
return getattr(self.src, name)
|
||||
|
||||
def get_duration(self, edge, walk_factor):
|
||||
if edge.rise > 0:
|
||||
duration = edge.distance / (float(self.speed_up) * walk_factor)
|
||||
else:
|
||||
duration = edge.distance / (float(self.speed) * walk_factor)
|
||||
duration += self.extra_seconds
|
||||
return duration
|
||||
|
||||
|
||||
class RouterLocation:
|
||||
def __init__(self, locations=()):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue