Allow specifing a weight for routing that is independent of duration

This commit is contained in:
Patrick Niklaus
2016-05-12 18:50:10 +02:00
committed by Patrick Niklaus
parent e463733138
commit 279f8aabfb
85 changed files with 2100 additions and 853 deletions
+15 -3
View File
@@ -1,4 +1,4 @@
api_version = 0
api_version = 1
-- Testbot profile
-- Moves at fixed, well-known speeds, practical for testing speed and travel times:
@@ -19,9 +19,11 @@ speed_profile = {
properties.continue_straight_at_waypoint = true
properties.use_turn_restrictions = true
properties.traffic_signal_penalty = 7 -- seconds
properties.u_turn_penalty = 20
properties.max_speed_for_map_matching = 30/3.6 --km -> m/s
properties.weight_name = 'duration'
local uturn_penalty = 20
local traffic_light_penalty = 7 -- seconds
function limit_speed(speed, limits)
-- don't use ipairs(), since it stops at the first nil value
@@ -114,3 +116,13 @@ function way_function (way, result)
result.roundabout = true
end
end
function turn_function (turn)
if turn.direction_modifier == direction_modifier.uturn then
turn.duration = uturn_penalty
turn.weight = uturn_penalty
end
if turn.has_traffic_light then
turn.duration = turn.duration + traffic_light_penalty
end
end