Use spaces instead of tabs
This commit is contained in:
parent
4146695f34
commit
0aba499c8e
@ -36,32 +36,32 @@ speeds = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
route_speeds = {
|
route_speeds = {
|
||||||
["ferry"] = 5
|
["ferry"] = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_speeds = {
|
platform_speeds = {
|
||||||
["platform"] = walking_speed
|
["platform"] = walking_speed
|
||||||
}
|
}
|
||||||
|
|
||||||
amenity_speeds = {
|
amenity_speeds = {
|
||||||
["parking"] = walking_speed,
|
["parking"] = walking_speed,
|
||||||
["parking_entrance"] = walking_speed
|
["parking_entrance"] = walking_speed
|
||||||
}
|
}
|
||||||
|
|
||||||
man_made_speeds = {
|
man_made_speeds = {
|
||||||
["pier"] = walking_speed
|
["pier"] = walking_speed
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_speeds = {
|
surface_speeds = {
|
||||||
["fine_gravel"] = walking_speed*0.75,
|
["fine_gravel"] = walking_speed*0.75,
|
||||||
["gravel"] = walking_speed*0.75,
|
["gravel"] = walking_speed*0.75,
|
||||||
["pebbelstone"] = walking_speed*0.75,
|
["pebbelstone"] = walking_speed*0.75,
|
||||||
["mud"] = walking_speed*0.5,
|
["mud"] = walking_speed*0.5,
|
||||||
["sand"] = walking_speed*0.5
|
["sand"] = walking_speed*0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
traffic_signal_penalty = 2
|
traffic_signal_penalty = 2
|
||||||
u_turn_penalty = 2
|
u_turn_penalty = 2
|
||||||
use_turn_restrictions = false
|
use_turn_restrictions = false
|
||||||
|
|
||||||
--modes
|
--modes
|
||||||
@ -69,144 +69,144 @@ local mode_normal = 1
|
|||||||
local mode_ferry = 2
|
local mode_ferry = 2
|
||||||
|
|
||||||
function get_exceptions(vector)
|
function get_exceptions(vector)
|
||||||
for i,v in ipairs(restriction_exception_tags) do
|
for i,v in ipairs(restriction_exception_tags) do
|
||||||
vector:Add(v)
|
vector:Add(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function node_function (node, result)
|
function node_function (node, result)
|
||||||
local barrier = node:get_value_by_key("barrier")
|
local barrier = node:get_value_by_key("barrier")
|
||||||
local access = find_access_tag(node, access_tags_hierachy)
|
local access = find_access_tag(node, access_tags_hierachy)
|
||||||
local traffic_signal = node:get_value_by_key("highway")
|
local traffic_signal = node:get_value_by_key("highway")
|
||||||
|
|
||||||
-- flag node if it carries a traffic light
|
-- flag node if it carries a traffic light
|
||||||
if traffic_signal and traffic_signal == "traffic_signals" then
|
if traffic_signal and traffic_signal == "traffic_signals" then
|
||||||
result.traffic_light = true
|
result.traffic_light = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- parse access and barrier tags
|
-- parse access and barrier tags
|
||||||
if access and access ~= "" then
|
if access and access ~= "" then
|
||||||
if access_tag_blacklist[access] then
|
if access_tag_blacklist[access] then
|
||||||
result.barrier = true
|
result.barrier = true
|
||||||
else
|
else
|
||||||
result.barrier = false
|
result.barrier = false
|
||||||
end
|
end
|
||||||
elseif barrier and barrier ~= "" then
|
elseif barrier and barrier ~= "" then
|
||||||
if barrier_whitelist[barrier] then
|
if barrier_whitelist[barrier] then
|
||||||
result.barrier = false
|
result.barrier = false
|
||||||
else
|
else
|
||||||
result.barrier = true
|
result.barrier = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function way_function (way, result)
|
function way_function (way, result)
|
||||||
-- initial routability check, filters out buildings, boundaries, etc
|
-- initial routability check, filters out buildings, boundaries, etc
|
||||||
local highway = way:get_value_by_key("highway")
|
local highway = way:get_value_by_key("highway")
|
||||||
local route = way:get_value_by_key("route")
|
local route = way:get_value_by_key("route")
|
||||||
local man_made = way:get_value_by_key("man_made")
|
local man_made = way:get_value_by_key("man_made")
|
||||||
local railway = way:get_value_by_key("railway")
|
local railway = way:get_value_by_key("railway")
|
||||||
local amenity = way:get_value_by_key("amenity")
|
local amenity = way:get_value_by_key("amenity")
|
||||||
local public_transport = way:get_value_by_key("public_transport")
|
local public_transport = way:get_value_by_key("public_transport")
|
||||||
if (not highway or highway == '') and
|
if (not highway or highway == '') and
|
||||||
(not route or route == '') and
|
(not route or route == '') and
|
||||||
(not railway or railway=='') and
|
(not railway or railway=='') and
|
||||||
(not amenity or amenity=='') and
|
(not amenity or amenity=='') and
|
||||||
(not man_made or man_made=='') and
|
(not man_made or man_made=='') and
|
||||||
(not public_transport or public_transport=='')
|
(not public_transport or public_transport=='')
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- don't route on ways that are still under construction
|
-- don't route on ways that are still under construction
|
||||||
if highway=='construction' then
|
if highway=='construction' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- access
|
-- access
|
||||||
local access = find_access_tag(way, access_tags_hierachy)
|
local access = find_access_tag(way, access_tags_hierachy)
|
||||||
if access_tag_blacklist[access] then
|
if access_tag_blacklist[access] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = way:get_value_by_key("name")
|
local name = way:get_value_by_key("name")
|
||||||
local ref = way:get_value_by_key("ref")
|
local ref = way:get_value_by_key("ref")
|
||||||
local junction = way:get_value_by_key("junction")
|
local junction = way:get_value_by_key("junction")
|
||||||
local onewayClass = way:get_value_by_key("oneway:foot")
|
local onewayClass = way:get_value_by_key("oneway:foot")
|
||||||
local duration = way:get_value_by_key("duration")
|
local duration = way:get_value_by_key("duration")
|
||||||
local service = way:get_value_by_key("service")
|
local service = way:get_value_by_key("service")
|
||||||
local area = way:get_value_by_key("area")
|
local area = way:get_value_by_key("area")
|
||||||
local foot = way:get_value_by_key("foot")
|
local foot = way:get_value_by_key("foot")
|
||||||
local surface = way:get_value_by_key("surface")
|
local surface = way:get_value_by_key("surface")
|
||||||
|
|
||||||
-- name
|
-- name
|
||||||
if ref and "" ~= ref and name and "" ~= name then
|
if ref and "" ~= ref and name and "" ~= name then
|
||||||
result.name = name .. ' / ' .. ref
|
result.name = name .. ' / ' .. ref
|
||||||
elseif ref and "" ~= ref then
|
elseif ref and "" ~= ref then
|
||||||
result.name = ref
|
result.name = ref
|
||||||
elseif name and "" ~= name then
|
elseif name and "" ~= name then
|
||||||
result.name = name
|
result.name = name
|
||||||
elseif highway then
|
elseif highway then
|
||||||
result.name = "{highway:"..highway.."}" -- if no name exists, use way type
|
result.name = "{highway:"..highway.."}" -- if no name exists, use way type
|
||||||
-- this encoding scheme is excepted to be a temporary solution
|
-- this encoding scheme is excepted to be a temporary solution
|
||||||
end
|
end
|
||||||
|
|
||||||
-- roundabouts
|
-- roundabouts
|
||||||
if "roundabout" == junction then
|
if "roundabout" == junction then
|
||||||
result.roundabout = true;
|
result.roundabout = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- speed
|
-- speed
|
||||||
if route_speeds[route] then
|
if route_speeds[route] then
|
||||||
-- ferries (doesn't cover routes tagged using relations)
|
-- ferries (doesn't cover routes tagged using relations)
|
||||||
result.ignore_in_grid = true
|
result.ignore_in_grid = true
|
||||||
if duration and durationIsValid(duration) then
|
if duration and durationIsValid(duration) then
|
||||||
result.duration = math.max( 1, parseDuration(duration) )
|
result.duration = math.max( 1, parseDuration(duration) )
|
||||||
else
|
else
|
||||||
result.forward_speed = route_speeds[route]
|
result.forward_speed = route_speeds[route]
|
||||||
result.backward_speed = route_speeds[route]
|
result.backward_speed = route_speeds[route]
|
||||||
end
|
end
|
||||||
result.forward_mode = mode_ferry
|
result.forward_mode = mode_ferry
|
||||||
result.backward_mode = mode_ferry
|
result.backward_mode = mode_ferry
|
||||||
elseif railway and platform_speeds[railway] then
|
elseif railway and platform_speeds[railway] then
|
||||||
-- railway platforms (old tagging scheme)
|
-- railway platforms (old tagging scheme)
|
||||||
result.forward_speed = platform_speeds[railway]
|
result.forward_speed = platform_speeds[railway]
|
||||||
result.backward_speed = platform_speeds[railway]
|
result.backward_speed = platform_speeds[railway]
|
||||||
elseif platform_speeds[public_transport] then
|
elseif platform_speeds[public_transport] then
|
||||||
-- public_transport platforms (new tagging platform)
|
-- public_transport platforms (new tagging platform)
|
||||||
result.forward_speed = platform_speeds[public_transport]
|
result.forward_speed = platform_speeds[public_transport]
|
||||||
result.backward_speed = platform_speeds[public_transport]
|
result.backward_speed = platform_speeds[public_transport]
|
||||||
elseif amenity and amenity_speeds[amenity] then
|
elseif amenity and amenity_speeds[amenity] then
|
||||||
-- parking areas
|
-- parking areas
|
||||||
result.forward_speed = amenity_speeds[amenity]
|
result.forward_speed = amenity_speeds[amenity]
|
||||||
result.backward_speed = amenity_speeds[amenity]
|
result.backward_speed = amenity_speeds[amenity]
|
||||||
elseif speeds[highway] then
|
elseif speeds[highway] then
|
||||||
-- regular ways
|
-- regular ways
|
||||||
result.forward_speed = speeds[highway]
|
result.forward_speed = speeds[highway]
|
||||||
result.backward_speed = speeds[highway]
|
result.backward_speed = speeds[highway]
|
||||||
elseif access and access_tag_whitelist[access] then
|
elseif access and access_tag_whitelist[access] then
|
||||||
-- unknown way, but valid access tag
|
-- unknown way, but valid access tag
|
||||||
result.forward_speed = walking_speed
|
result.forward_speed = walking_speed
|
||||||
result.backward_speed = walking_speed
|
result.backward_speed = walking_speed
|
||||||
end
|
end
|
||||||
|
|
||||||
-- oneway
|
-- oneway
|
||||||
if onewayClass == "yes" or onewayClass == "1" or onewayClass == "true" then
|
if onewayClass == "yes" or onewayClass == "1" or onewayClass == "true" then
|
||||||
result.backward_mode = 0
|
result.backward_mode = 0
|
||||||
elseif onewayClass == "no" or onewayClass == "0" or onewayClass == "false" then
|
elseif onewayClass == "no" or onewayClass == "0" or onewayClass == "false" then
|
||||||
-- nothing to do
|
-- nothing to do
|
||||||
elseif onewayClass == "-1" then
|
elseif onewayClass == "-1" then
|
||||||
result.forward_mode = 0
|
result.forward_mode = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- surfaces
|
-- surfaces
|
||||||
if surface then
|
if surface then
|
||||||
surface_speed = surface_speeds[surface]
|
surface_speed = surface_speeds[surface]
|
||||||
if surface_speed then
|
if surface_speed then
|
||||||
result.forward_speed = math.min(result.forward_speed, surface_speed)
|
result.forward_speed = math.min(result.forward_speed, surface_speed)
|
||||||
result.backward_speed = math.min(result.backward_speed, surface_speed)
|
result.backward_speed = math.min(result.backward_speed, surface_speed)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user