diff --git a/features/bicycle/surface.feature b/features/bicycle/surface.feature new file mode 100644 index 000000000..a723119e7 --- /dev/null +++ b/features/bicycle/surface.feature @@ -0,0 +1,40 @@ +@routing @surface @bicycle +Feature: Bike - Surfaces + + Background: + Given the profile "bicycle" + + Scenario: Bicycle - Slow surfaces + Then routability should be + | highway | surface | bothw | + | cycleway | | 49s | + | cycleway | asphalt | 49s | + | cycleway | cobblestone:flattened | 73s | + | cycleway | paving_stones | 73s | + | cycleway | compacted | 73s | + | cycleway | cobblestone | 121s | + | cycleway | unpaved | 121s | + | cycleway | fine_gravel | 121s | + | cycleway | gravel | 121s | + | cycleway | pebbelstone | 121s | + | cycleway | dirt | 121s | + | cycleway | earth | 121s | + | cycleway | grass | 121s | + | cycleway | mud | 241s | + | cycleway | sand | 241s | + + Scenario: Bicycle - Good surfaces on small paths + Then routability should be + | highway | surface | bothw | + | cycleway | | 49s | + | path | | 61s | + | track | | 61s | + | track | asphalt | 49s | + | path | asphalt | 49s | + + Scenario: Bicycle - Surfaces should not make unknown ways routable + Then routability should be + | highway | surface | bothw | + | cycleway | | 49s | + | nosense | | | + | nosense | asphalt | | diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 5fd680239..048963c94 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -66,6 +66,7 @@ route_speeds = { } surface_speeds = { + ["asphalt"] = default_speed, ["cobblestone:flattened"] = 10, ["paving_stones"] = 10, ["compacted"] = 10, @@ -317,8 +318,12 @@ function way_function (way) if surface then surface_speed = surface_speeds[surface] if surface_speed then - way.speed = math.min(way.speed, surface_speed) - way.backward_speed = math.min(way.backward_speed, surface_speed) + if way.speed > 0 then + way.speed = surface_speed + end + if way.backward_speed > 0 then + way.backward_speed = surface_speed + end end end