handle surfaces in bike profile
This commit is contained in:
parent
a7c32dfa95
commit
fcdee8f5d5
@ -65,6 +65,24 @@ route_speeds = {
|
|||||||
["ferry"] = 5
|
["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
|
take_minimum_of_speeds = true
|
||||||
obey_oneway = true
|
obey_oneway = true
|
||||||
obey_bollards = false
|
obey_bollards = false
|
||||||
@ -158,6 +176,7 @@ function way_function (way)
|
|||||||
local service = way.tags:Find("service")
|
local service = way.tags:Find("service")
|
||||||
local area = way.tags:Find("area")
|
local area = way.tags:Find("area")
|
||||||
local foot = way.tags:Find("foot")
|
local foot = way.tags:Find("foot")
|
||||||
|
local surface = way.tags:Find("surface")
|
||||||
|
|
||||||
-- name
|
-- name
|
||||||
if "" ~= ref then
|
if "" ~= ref then
|
||||||
@ -286,6 +305,15 @@ function way_function (way)
|
|||||||
elseif cycleway_right and cycleway_tags[cycleway_right] then
|
elseif cycleway_right and cycleway_tags[cycleway_right] then
|
||||||
way.speed = bicycle_speeds["cycleway"]
|
way.speed = bicycle_speeds["cycleway"]
|
||||||
end
|
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
|
-- maxspeed
|
||||||
-- TODO: maxspeed of backward direction
|
-- TODO: maxspeed of backward direction
|
||||||
|
Loading…
Reference in New Issue
Block a user