handle surfaces in bike profile
This commit is contained in:
parent
a7c32dfa95
commit
fcdee8f5d5
@ -65,6 +65,24 @@ route_speeds = {
|
||||
["ferry"] = 5
|
||||
}
|
||||
|
||||
surface_speeds = {
|
||||
["cobblestone:flattened"] = 10,
|
||||
["paving_stones"] = 10,
|
||||
["compacted"] = 10,
|
||||
["cobblestone"] = 6,
|
||||
["unpaved"] = 6,
|
||||
["fine_gravel"] = 6,
|
||||
["gravel"] = 6,
|
||||
["fine_gravel"] = 6,
|
||||
["pebbelstone"] = 6,
|
||||
["ground"] = 6,
|
||||
["dirt"] = 6,
|
||||
["earth"] = 6,
|
||||
["grass"] = 6,
|
||||
["mud"] = 3,
|
||||
["sand"] = 3
|
||||
}
|
||||
|
||||
take_minimum_of_speeds = true
|
||||
obey_oneway = true
|
||||
obey_bollards = false
|
||||
@ -158,6 +176,7 @@ function way_function (way)
|
||||
local service = way.tags:Find("service")
|
||||
local area = way.tags:Find("area")
|
||||
local foot = way.tags:Find("foot")
|
||||
local surface = way.tags:Find("surface")
|
||||
|
||||
-- name
|
||||
if "" ~= ref then
|
||||
@ -287,6 +306,15 @@ function way_function (way)
|
||||
way.speed = bicycle_speeds["cycleway"]
|
||||
end
|
||||
|
||||
-- surfaces
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
-- maxspeed
|
||||
-- TODO: maxspeed of backward direction
|
||||
if take_minimum_of_speeds then
|
||||
|
Loading…
Reference in New Issue
Block a user