bike speeds on pedestrian areas
This commit is contained in:
parent
3ec4a049c5
commit
f40550b18c
@ -6,9 +6,10 @@ access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
|
|||||||
access_tags_hierachy = { "bicycle", "vehicle", "access" }
|
access_tags_hierachy = { "bicycle", "vehicle", "access" }
|
||||||
cycleway_tags = {["track"]=true,["lane"]=true,["opposite"]=true,["opposite_lane"]=true,["opposite_track"]=true,["share_busway"]=true,["sharrow"]=true,["shared"]=true }
|
cycleway_tags = {["track"]=true,["lane"]=true,["opposite"]=true,["opposite_lane"]=true,["opposite_track"]=true,["share_busway"]=true,["sharrow"]=true,["shared"]=true }
|
||||||
service_tag_restricted = { ["parking_aisle"] = true }
|
service_tag_restricted = { ["parking_aisle"] = true }
|
||||||
ignore_in_grid = { ["ferry"] = true }
|
|
||||||
|
|
||||||
speed_profile = {
|
default_speed = 16
|
||||||
|
|
||||||
|
main_speeds = {
|
||||||
["cycleway"] = 18,
|
["cycleway"] = 18,
|
||||||
["primary"] = 17,
|
["primary"] = 17,
|
||||||
["primary_link"] = 17,
|
["primary_link"] = 17,
|
||||||
@ -23,18 +24,30 @@ speed_profile = {
|
|||||||
["service"] = 16,
|
["service"] = 16,
|
||||||
["track"] = 13,
|
["track"] = 13,
|
||||||
["path"] = 13,
|
["path"] = 13,
|
||||||
|
["footway"] = 12,
|
||||||
|
["pedestrian"] = 12,
|
||||||
|
["pier"] = 12,
|
||||||
|
["steps"] = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
pedestrian_speeds = {
|
||||||
["footway"] = 5,
|
["footway"] = 5,
|
||||||
["pedestrian"] = 5,
|
["pedestrian"] = 5,
|
||||||
["pier"] = 5,
|
["pier"] = 5,
|
||||||
["steps"] = 1,
|
["steps"] = 2,
|
||||||
["default"] = 18,
|
}
|
||||||
["ferry"] = 5,
|
|
||||||
["train"] = 80,
|
railway_speeds = {
|
||||||
["railway"] = 60,
|
["train"] = 10,
|
||||||
["subway"] = 50,
|
["railway"] = 10,
|
||||||
["light_rail"] = 40,
|
["subway"] = 10,
|
||||||
["monorail"] = 40,
|
["light_rail"] = 10,
|
||||||
["tram"] = 40
|
["monorail"] = 10,
|
||||||
|
["tram"] = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
route_speeds = {
|
||||||
|
["ferry"] = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
take_minimum_of_speeds = true
|
take_minimum_of_speeds = true
|
||||||
@ -131,33 +144,37 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
way.name = highway -- if no name exists, use way type
|
way.name = highway -- if no name exists, use way type
|
||||||
end
|
end
|
||||||
|
|
||||||
if (speed_profile[route] and speed_profile[route] > 0) or (speed_profile[man_made] and speed_profile[man_made] > 0) then
|
if route_speeds[route] then
|
||||||
-- ferries and piers
|
-- ferries
|
||||||
|
way.direction = Way.bidirectional
|
||||||
|
way.ignore_in_grid = true
|
||||||
if durationIsValid(duration) then
|
if durationIsValid(duration) then
|
||||||
way.speed = math.max( duration / math.max(1, numberOfNodesInWay-1) )
|
way.speed = math.max( parseDuration(duration) / math.max(1, numberOfNodesInWay-1) )
|
||||||
way.is_duration_set = true;
|
way.is_duration_set = true
|
||||||
|
else
|
||||||
|
way.speed = route_speeds[route]
|
||||||
end
|
end
|
||||||
way.direction = Way.bidirectional;
|
elseif railway and railway_speeds[railway] then
|
||||||
if speed_profile[route] ~= nil then
|
|
||||||
highway = route;
|
|
||||||
elseif speed_profile[man_made] ~= nil then
|
|
||||||
highway = man_made;
|
|
||||||
end
|
|
||||||
if not way.is_duration_set then
|
|
||||||
way.speed = speed_profile[highway]
|
|
||||||
end
|
|
||||||
elseif railway and speed_profile[railway] then
|
|
||||||
-- trains and subways
|
-- trains and subways
|
||||||
if access and access_tag_whitelist[access] then
|
if access and access_tag_whitelist[access] then
|
||||||
way.speed = speed_profile[railway]
|
way.speed = railway_speeds[railway]
|
||||||
way.direction = Way.bidirectional
|
way.direction = Way.bidirectional
|
||||||
end
|
end
|
||||||
|
elseif pedestrian_speeds[highway] and main_speeds[highway] then
|
||||||
|
-- pedestrian areas
|
||||||
|
if access_tag_whitelist[access] then
|
||||||
|
way.speed = main_speeds[highway] -- biking
|
||||||
|
else
|
||||||
|
way.speed = pedestrian_speeds[highway] -- pushing bikes
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- ways
|
-- regular ways
|
||||||
if speed_profile[highway] then
|
if main_speeds[highway] then
|
||||||
way.speed = speed_profile[highway]
|
way.speed = main_speeds[highway]
|
||||||
elseif access_tag_whitelist[access] then
|
elseif main_speeds[man_made] then
|
||||||
way.speed = speed_profile["default"]
|
way.speed = main_speeds[man_made]
|
||||||
|
elseif access_tag_whitelist[access] then
|
||||||
|
way.speed = default_speed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -212,11 +229,11 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
|
|
||||||
-- cycleways
|
-- cycleways
|
||||||
if cycleway and cycleway_tags[cycleway] then
|
if cycleway and cycleway_tags[cycleway] then
|
||||||
way.speed = speed_profile["cycleway"]
|
way.speed = main_speeds["cycleway"]
|
||||||
elseif cycleway_left and cycleway_tags[cycleway_left] then
|
elseif cycleway_left and cycleway_tags[cycleway_left] then
|
||||||
way.speed = speed_profile["cycleway"]
|
way.speed = main_speeds["cycleway"]
|
||||||
elseif cycleway_right and cycleway_tags[cycleway_right] then
|
elseif cycleway_right and cycleway_tags[cycleway_right] then
|
||||||
way.speed = speed_profile["cycleway"]
|
way.speed = main_speeds["cycleway"]
|
||||||
end
|
end
|
||||||
|
|
||||||
way.type = 1
|
way.type = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user