From 4d4a3d02ed04d3e6cd78aeed6c7224064f050c32 Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Tue, 15 Dec 2015 13:23:27 +0300 Subject: [PATCH] A side_road tag support for the OSRM car profile. --- profiles/car.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/profiles/car.lua b/profiles/car.lua index d246934d9..30d143c4f 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -131,6 +131,8 @@ maxspeed_table = { traffic_signal_penalty = 2 use_turn_restrictions = true +side_road_speed_multiplier = 0.8 + local turn_penalty = 10 -- Note: this biases right-side driving. Should be -- inverted for left-driving countries. @@ -310,6 +312,14 @@ function way_function (way, result) return end + -- reduce speed on special side roads + local sideway = way:get_value_by_key("side_road") + if "yes" == sideway or + "rotary" == sideway then + result.forward_speed = result.forward_speed * side_road_speed_multiplier + result.backward_speed = result.backward_speed * side_road_speed_multiplier + end + -- reduce speed on bad surfaces local surface = way:get_value_by_key("surface") local tracktype = way:get_value_by_key("tracktype")