Support trunk access for some countries
This commit is contained in:
parent
becfd8a56d
commit
4b24713d76
7
data/notrunk.geojson
Normal file
7
data/notrunk.geojson
Normal file
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ Feature: Bike - Accessability of different way types
|
||||
Background:
|
||||
Given the profile "bicycle"
|
||||
|
||||
Scenario: Bike - Routability of way types
|
||||
Scenario: Bike - Routability of way types trunk not supported
|
||||
# Bikes are allowed on footways etc because you can pull your bike at a lower speed.
|
||||
# Pier is not allowed, since it's tagged using man_made=pier.
|
||||
|
||||
@ -40,3 +40,40 @@ Feature: Bike - Accessability of different way types
|
||||
| highway | man_made | bothw |
|
||||
| (nil) | (nil) | |
|
||||
| (nil) | pier | x |
|
||||
|
||||
Scenario: Bike - Routability of way types trunk supported
|
||||
# Bikes are allowed on footways etc because you can pull your bike at a lower speed.
|
||||
# Pier is not allowed, since it's tagged using man_made=pier.
|
||||
|
||||
Given the profile file "bicycle" initialized with
|
||||
"""
|
||||
profile.uselocationtags.trunk = true
|
||||
"""
|
||||
|
||||
Then routability should be
|
||||
| highway | bothw |
|
||||
| (nil) | |
|
||||
| motorway | |
|
||||
| motorway_link | |
|
||||
| trunk | x |
|
||||
| trunk_link | x |
|
||||
| primary | x |
|
||||
| primary_link | x |
|
||||
| secondary | x |
|
||||
| secondary_link | x |
|
||||
| tertiary | x |
|
||||
| tertiary_link | x |
|
||||
| residential | x |
|
||||
| service | x |
|
||||
| unclassified | x |
|
||||
| living_street | x |
|
||||
| road | x |
|
||||
| track | x |
|
||||
| path | x |
|
||||
| footway | x |
|
||||
| pedestrian | x |
|
||||
| steps | x |
|
||||
| cycleway | x |
|
||||
| bridleway | |
|
||||
| pier | |
|
||||
|
||||
|
183
features/bicycle/way_notrunk.feature
Normal file
183
features/bicycle/way_notrunk.feature
Normal file
@ -0,0 +1,183 @@
|
||||
@testbot @way @notrunk
|
||||
Feature: Testbot - notrunk allowed
|
||||
|
||||
# Check that Nodes need to be in the geojson file to support trunk access.
|
||||
# Use the default geopoint around 0.0.
|
||||
# This covers both trunk allowed notrunk allowed and no motorroad
|
||||
|
||||
Scenario: bicycle trunk allowed - notrunk failure original behavior
|
||||
|
||||
Given the profile "bicycle"
|
||||
And the extract extra arguments "--threads 1"
|
||||
And the partition extra arguments "--threads 1"
|
||||
And the customize extra arguments "--threads 1"
|
||||
|
||||
And the node locations
|
||||
# f through o should all fail
|
||||
|
||||
| node | lat | lon |
|
||||
| a | 48.65729 | 22.26471 |
|
||||
| b | 48.65648 | 22.26486 |
|
||||
| c | 48.65503 | 22.26521 |
|
||||
| d | 48.65489 | 22.26520 |
|
||||
| e | 48.65426 | 22.26533 |
|
||||
| f | 48.65277 | 22.26556 |
|
||||
| g | 48.65026 | 22.26606 |
|
||||
| h | 48.64937 | 22.26618 |
|
||||
| i | 48.64858 | 22.26634 |
|
||||
| j | 48.64763 | 22.26652 |
|
||||
| k | 48.64730 | 22.26658 |
|
||||
| l | 48.64616 | 22.26681 |
|
||||
| m | 48.64599 | 22.26685 |
|
||||
| n | 48.64568 | 22.26690 |
|
||||
|
||||
|
||||
And the ways
|
||||
| nodes | highway | motorroad |
|
||||
| ab | primary | |
|
||||
| bc | primary | |
|
||||
| cd | primary | yes |
|
||||
| de | primary | |
|
||||
| ef | primary | |
|
||||
| fg | trunk | |
|
||||
| gh | trunk | |
|
||||
| hi | trunk | |
|
||||
| ij | trunk | |
|
||||
| jk | trunk | |
|
||||
| kl | trunk | |
|
||||
| lm | trunk | yes |
|
||||
| mn | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | status| message | # |
|
||||
| a | c | ab,bc,bc | 200 | | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| d | f | de,ef,ef | 200 | | |
|
||||
| d | g | de,ef,ef | 200 | | |
|
||||
| d | n | | 400 | Impossible route between points | |
|
||||
|
||||
Scenario: bicycle trunk allowed - trunk ok with no geojson
|
||||
|
||||
Given the extract extra arguments "--threads 1"
|
||||
And the partition extra arguments "--threads 1"
|
||||
And the customize extra arguments "--threads 1"
|
||||
|
||||
And the profile file "bicycle" initialized with
|
||||
"""
|
||||
profile.uselocationtags.trunk = true
|
||||
"""
|
||||
|
||||
And the node locations
|
||||
# a through g are in Slovakia - in the no trunk allowed set
|
||||
# h is on the edge (i.e. in Ukraine)
|
||||
# i through n are in Ukraine
|
||||
|
||||
| node | lat | lon |
|
||||
| a | 48.65729 | 22.26471 |
|
||||
| b | 48.65648 | 22.26486 |
|
||||
| c | 48.65503 | 22.26521 |
|
||||
| d | 48.65489 | 22.26520 |
|
||||
| e | 48.65426 | 22.26533 |
|
||||
| f | 48.65277 | 22.26556 |
|
||||
| g | 48.65026 | 22.26606 |
|
||||
| h | 48.64937 | 22.26618 |
|
||||
| i | 48.64858 | 22.26634 |
|
||||
| j | 48.64763 | 22.26652 |
|
||||
| k | 48.64730 | 22.26658 |
|
||||
| l | 48.64616 | 22.26681 |
|
||||
| m | 48.64599 | 22.26685 |
|
||||
| n | 48.64568 | 22.26690 |
|
||||
|
||||
|
||||
And the ways
|
||||
| nodes | highway | motorroad |
|
||||
| ab | primary | |
|
||||
| bc | primary | |
|
||||
| cd | primary | yes |
|
||||
| de | primary | |
|
||||
| ef | primary | |
|
||||
| fg | trunk | |
|
||||
| gh | trunk | |
|
||||
| hi | trunk | |
|
||||
| ij | trunk | |
|
||||
| jk | trunk | |
|
||||
| kl | trunk | |
|
||||
| lm | trunk | yes |
|
||||
| mn | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | status| message | # |
|
||||
| a | c | ab,bc,bc | 200 | | |
|
||||
| a | d | | 400 | Impossible route between points | |
|
||||
| d | f | de,ef,ef | 200 | | |
|
||||
| d | g | de,ef,fg,fg | 200 | | |
|
||||
| e | n | | 400 | Impossible route between points | |
|
||||
| f | h | fg,gh | 200 | | |
|
||||
| g | l | gh,ij,kl,kl | 200 | | |
|
||||
| h | l | hi,ij,kl,kl | 200 | | |
|
||||
| i | l | ij,kl,kl | 200 | | |
|
||||
| i | m | | 400 | Impossible route between points | |
|
||||
|
||||
Scenario: bicycle trunk allowed - notrunk failure with geojson
|
||||
|
||||
Given the extract extra arguments "--threads 1 --location-dependent-data data/notrunk.geojson"
|
||||
And the partition extra arguments "--threads 1"
|
||||
And the customize extra arguments "--threads 1"
|
||||
|
||||
And the profile file "bicycle" initialized with
|
||||
"""
|
||||
profile.uselocationtags.trunk = true
|
||||
"""
|
||||
|
||||
And the node locations
|
||||
# a through g are in Slovakia - in the no trunk allowed set
|
||||
# h is on the edge (i.e. in Ukraine)
|
||||
# i through n are in Ukraine
|
||||
|
||||
| node | lat | lon |
|
||||
| a | 48.65729 | 22.26471 |
|
||||
| b | 48.65648 | 22.26486 |
|
||||
| c | 48.65503 | 22.26521 |
|
||||
| d | 48.65489 | 22.26520 |
|
||||
| e | 48.65426 | 22.26533 |
|
||||
| f | 48.65277 | 22.26556 |
|
||||
| g | 48.65026 | 22.26606 |
|
||||
| h | 48.64937 | 22.26618 |
|
||||
| i | 48.64858 | 22.26634 |
|
||||
| j | 48.64763 | 22.26652 |
|
||||
| k | 48.64730 | 22.26658 |
|
||||
| l | 48.64616 | 22.26681 |
|
||||
| m | 48.64599 | 22.26685 |
|
||||
| n | 48.64568 | 22.26690 |
|
||||
|
||||
|
||||
And the ways
|
||||
| nodes | highway | motorroad |
|
||||
| ab | primary | |
|
||||
| bc | primary | |
|
||||
| cd | primary | yes |
|
||||
| de | primary | |
|
||||
| ef | primary | |
|
||||
| fg | trunk | |
|
||||
| gh | trunk | |
|
||||
| hi | trunk | |
|
||||
| ij | trunk | |
|
||||
| jk | trunk | |
|
||||
| kl | trunk | |
|
||||
| lm | trunk | yes |
|
||||
| mn | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | status| message | # |
|
||||
| a | c | ab,bc,bc | 200 | | |
|
||||
| a | d | | 400 | Impossible route between points | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| d | f | de,ef,ef | 200 | | |
|
||||
| d | g | | 400 | Impossible route between points | |
|
||||
| e | n | | 400 | Impossible route between points | |
|
||||
| f | h | | 400 | Impossible route between points | |
|
||||
| g | l | hi,ij,kl,kl | 200 | | |
|
||||
| h | l | hi,ij,kl,kl | 200 | | |
|
||||
| i | l | ij,kl,kl | 200 | | |
|
||||
| i | m | | 400 | Impossible route between points | |
|
||||
|
@ -42,3 +42,37 @@ Feature: Foot - Accessability of different way types
|
||||
| footway | | | x |
|
||||
| proposed | | | |
|
||||
| proposed | yes | yes | |
|
||||
|
||||
Scenario: Foot - Basic access with profile.uselocationtags.trunk = true
|
||||
|
||||
Given the profile file "foot" initialized with
|
||||
"""
|
||||
profile.uselocationtags.trunk = true
|
||||
"""
|
||||
|
||||
Then routability should be
|
||||
| highway | forw |
|
||||
| motorway | |
|
||||
| motorway_link | |
|
||||
| trunk | x |
|
||||
| trunk_link | x |
|
||||
| primary | x |
|
||||
| primary_link | x |
|
||||
| secondary | x |
|
||||
| secondary_link | x |
|
||||
| tertiary | x |
|
||||
| tertiary_link | x |
|
||||
| residential | x |
|
||||
| service | x |
|
||||
| unclassified | x |
|
||||
| living_street | x |
|
||||
| road | x |
|
||||
| track | x |
|
||||
| path | x |
|
||||
| footway | x |
|
||||
| pedestrian | x |
|
||||
| steps | x |
|
||||
| pier | x |
|
||||
| cycleway | |
|
||||
| bridleway | |
|
||||
|
||||
|
186
features/foot/way_notrunk.feature
Normal file
186
features/foot/way_notrunk.feature
Normal file
@ -0,0 +1,186 @@
|
||||
@testbot @way @notrunk
|
||||
Feature: Testbot - notrunk allowed
|
||||
|
||||
# Check that Nodes need to be in the geojson file to support trunk access.
|
||||
# Use the default geopoint around 0.0.
|
||||
# This covers both trunk allowed notrunk allowed and no motorroad
|
||||
|
||||
Scenario: foot trunk allowed - notrunk failure original behavior
|
||||
|
||||
Given the profile "foot"
|
||||
And the extract extra arguments "--threads 1"
|
||||
And the partition extra arguments "--threads 1"
|
||||
And the customize extra arguments "--threads 1"
|
||||
|
||||
And the node locations
|
||||
# f through o should all fail
|
||||
|
||||
| node | lat | lon |
|
||||
| a | 48.65729 | 22.26471 |
|
||||
| b | 48.65648 | 22.26486 |
|
||||
| c | 48.65503 | 22.26521 |
|
||||
| d | 48.65489 | 22.26520 |
|
||||
| e | 48.65426 | 22.26533 |
|
||||
| f | 48.65277 | 22.26556 |
|
||||
| g | 48.65026 | 22.26606 |
|
||||
| h | 48.64937 | 22.26618 |
|
||||
| i | 48.64858 | 22.26634 |
|
||||
| j | 48.64763 | 22.26652 |
|
||||
| k | 48.64730 | 22.26658 |
|
||||
| l | 48.64616 | 22.26681 |
|
||||
| m | 48.64599 | 22.26685 |
|
||||
| n | 48.64568 | 22.26690 |
|
||||
|
||||
|
||||
And the ways
|
||||
| nodes | highway | motorroad |
|
||||
| ab | primary | |
|
||||
| bc | primary | |
|
||||
| cd | primary | yes |
|
||||
| de | primary | |
|
||||
| ef | primary | |
|
||||
| fg | trunk | |
|
||||
| gh | trunk | |
|
||||
| hi | trunk | |
|
||||
| ij | trunk | |
|
||||
| jk | trunk | |
|
||||
| kl | trunk | |
|
||||
| lm | trunk | yes |
|
||||
| mn | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | status| message | # |
|
||||
| a | c | ab,bc,bc | 200 | | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| d | f | de,ef,ef | 200 | | |
|
||||
| d | g | de,ef,ef | 200 | | |
|
||||
| d | n | | 400 | Impossible route between points | |
|
||||
|
||||
#
|
||||
|
||||
Scenario: foot trunk allowed - trunk ok with no geojson
|
||||
|
||||
Given the extract extra arguments "--threads 1"
|
||||
And the partition extra arguments "--threads 1"
|
||||
And the customize extra arguments "--threads 1"
|
||||
|
||||
And the profile file "foot" initialized with
|
||||
"""
|
||||
profile.uselocationtags.trunk = true
|
||||
"""
|
||||
|
||||
And the node locations
|
||||
# a through g are in Slovakia - in the no trunk allowed set
|
||||
# h is on the edge (i.e. in Ukraine)
|
||||
# i through n are in Ukraine
|
||||
|
||||
| node | lat | lon |
|
||||
| a | 48.65729 | 22.26471 |
|
||||
| b | 48.65648 | 22.26486 |
|
||||
| c | 48.65503 | 22.26521 |
|
||||
| d | 48.65489 | 22.26520 |
|
||||
| e | 48.65426 | 22.26533 |
|
||||
| f | 48.65277 | 22.26556 |
|
||||
| g | 48.65026 | 22.26606 |
|
||||
| h | 48.64937 | 22.26618 |
|
||||
| i | 48.64858 | 22.26634 |
|
||||
| j | 48.64763 | 22.26652 |
|
||||
| k | 48.64730 | 22.26658 |
|
||||
| l | 48.64616 | 22.26681 |
|
||||
| m | 48.64599 | 22.26685 |
|
||||
| n | 48.64568 | 22.26690 |
|
||||
|
||||
|
||||
And the ways
|
||||
| nodes | highway | motorroad |
|
||||
| ab | primary | |
|
||||
| bc | primary | |
|
||||
| cd | primary | yes |
|
||||
| de | primary | |
|
||||
| ef | primary | |
|
||||
| fg | trunk | |
|
||||
| gh | trunk | |
|
||||
| hi | trunk | |
|
||||
| ij | trunk | |
|
||||
| jk | trunk | |
|
||||
| kl | trunk | |
|
||||
| lm | trunk | yes |
|
||||
| mn | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | status| message | # |
|
||||
| a | c | ab,bc,bc | 200 | | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| d | f | de,ef,ef | 200 | | |
|
||||
| d | g | de,ef,fg,fg | 200 | | |
|
||||
| e | n | | 400 | Impossible route between points | |
|
||||
| f | h | fg,gh | 200 | | |
|
||||
| g | l | gh,ij,kl,kl | 200 | | |
|
||||
| h | l | hi,ij,kl,kl | 200 | | |
|
||||
| i | l | ij,kl,kl | 200 | | |
|
||||
| i | m | | 400 | Impossible route between points | |
|
||||
|
||||
Scenario: foot trunk allowed - notrunk failure with geojson
|
||||
|
||||
Given the extract extra arguments "--threads 1 --location-dependent-data data/notrunk.geojson"
|
||||
And the partition extra arguments "--threads 1"
|
||||
And the customize extra arguments "--threads 1"
|
||||
|
||||
And the profile file "foot" initialized with
|
||||
"""
|
||||
profile.uselocationtags.trunk = true
|
||||
"""
|
||||
|
||||
And the node locations
|
||||
# a through g are in Slovakia - in the no trunk allowed set
|
||||
# h is on the edge (i.e. in Ukraine)
|
||||
# i through n are in Ukraine
|
||||
|
||||
| node | lat | lon |
|
||||
| a | 48.65729 | 22.26471 |
|
||||
| b | 48.65648 | 22.26486 |
|
||||
| c | 48.65503 | 22.26521 |
|
||||
| d | 48.65489 | 22.26520 |
|
||||
| e | 48.65426 | 22.26533 |
|
||||
| f | 48.65277 | 22.26556 |
|
||||
| g | 48.65026 | 22.26606 |
|
||||
| h | 48.64937 | 22.26618 |
|
||||
| i | 48.64858 | 22.26634 |
|
||||
| j | 48.64763 | 22.26652 |
|
||||
| k | 48.64730 | 22.26658 |
|
||||
| l | 48.64616 | 22.26681 |
|
||||
| m | 48.64599 | 22.26685 |
|
||||
| n | 48.64568 | 22.26690 |
|
||||
|
||||
|
||||
And the ways
|
||||
| nodes | highway | motorroad |
|
||||
| ab | primary | |
|
||||
| bc | primary | |
|
||||
| cd | primary | yes |
|
||||
| de | primary | |
|
||||
| ef | primary | |
|
||||
| fg | trunk | |
|
||||
| gh | trunk | |
|
||||
| hi | trunk | |
|
||||
| ij | trunk | |
|
||||
| jk | trunk | |
|
||||
| kl | trunk | |
|
||||
| lm | trunk | yes |
|
||||
| mn | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | status| message | # |
|
||||
| a | c | ab,bc,bc | 200 | | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| a | f | | 400 | Impossible route between points | |
|
||||
| d | f | de,ef,ef | 200 | | |
|
||||
| d | g | | 400 | Impossible route between points | |
|
||||
| e | n | | 400 | Impossible route between points | |
|
||||
| f | h | | 400 | Impossible route between points | |
|
||||
| g | l | hi,ij,kl,kl | 200 | | |
|
||||
| h | l | hi,ij,kl,kl | 200 | | |
|
||||
| i | l | ij,kl,kl | 200 | | |
|
||||
| i | m | | 400 | Impossible route between points | |
|
||||
|
@ -27,6 +27,7 @@ function setup()
|
||||
mode_change_penalty = 30,
|
||||
},
|
||||
|
||||
profile = 'bicycle',
|
||||
default_mode = mode.cycling,
|
||||
default_speed = default_speed,
|
||||
walking_speed = walking_speed,
|
||||
@ -35,10 +36,6 @@ function setup()
|
||||
turn_bias = 1.4,
|
||||
use_public_transport = true,
|
||||
|
||||
-- Exclude narrow ways, in particular to route with cargo bike
|
||||
width = nil, -- Cargo bike could 0.5 width, in meters
|
||||
exclude_cargo_bike = false,
|
||||
|
||||
allowed_start_modes = Set {
|
||||
mode.cycling,
|
||||
mode.pushing_bike
|
||||
@ -140,6 +137,11 @@ function setup()
|
||||
path = 13
|
||||
},
|
||||
|
||||
trunk_speeds = {
|
||||
trunk = default_speed,
|
||||
trunk_link = default_speed,
|
||||
},
|
||||
|
||||
pedestrian_speeds = {
|
||||
footway = walking_speed,
|
||||
pedestrian = walking_speed,
|
||||
@ -220,9 +222,15 @@ function setup()
|
||||
|
||||
avoid = Set {
|
||||
'impassable',
|
||||
'motorroad',
|
||||
'construction',
|
||||
'proposed'
|
||||
},
|
||||
|
||||
uselocationtags = Set {
|
||||
-- 'trunk'
|
||||
}
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
@ -247,27 +255,6 @@ function process_node(profile, node, result)
|
||||
end
|
||||
end
|
||||
|
||||
if profile.exclude_cargo_bike then
|
||||
local cargo_bike = node:get_value_by_key("cargo_bike")
|
||||
if cargo_bike and cargo_bike == "no" then
|
||||
result.barrier = true
|
||||
end
|
||||
end
|
||||
|
||||
-- width
|
||||
if profile.width then
|
||||
-- From barrier=cycle_barrier or other barriers
|
||||
local maxwidth_physical = node:get_value_by_key("maxwidth:physical")
|
||||
local maxwidth_physical_meter = maxwidth_physical and Measure.parse_value_meters(maxwidth_physical) or 99
|
||||
local opening = node:get_value_by_key("opening")
|
||||
local opening_meter = opening and Measure.parse_value_meters(opening) or 99
|
||||
local width_meter = math.min(maxwidth_physical_meter, opening_meter)
|
||||
|
||||
if width_meter and width_meter < profile.width then
|
||||
result.barrier = true
|
||||
end
|
||||
end
|
||||
|
||||
-- check if node is a traffic light
|
||||
result.traffic_lights = TrafficSignal.get_value(node)
|
||||
end
|
||||
@ -324,8 +311,6 @@ function handle_bicycle_tags(profile,way,result,data)
|
||||
|
||||
bike_push_handler(profile,way,result,data)
|
||||
|
||||
-- width should be after bike_push
|
||||
width_handler(profile,way,result,data)
|
||||
|
||||
-- maxspeed
|
||||
limit( result, data.maxspeed, data.maxspeed_forward, data.maxspeed_backward )
|
||||
@ -391,9 +376,16 @@ function speed_handler(profile,way,result,data)
|
||||
data.way_type_allows_pushing = true
|
||||
elseif profile.bicycle_speeds[data.highway] then
|
||||
-- regular ways
|
||||
-- check trunk
|
||||
result.forward_speed = profile.bicycle_speeds[data.highway]
|
||||
result.backward_speed = profile.bicycle_speeds[data.highway]
|
||||
data.way_type_allows_pushing = true
|
||||
elseif profile.trunk_speeds[data.highway] and profile.uselocationtags and profile.uselocationtags.trunk then
|
||||
if not way:get_location_tag(data.highway) or way:get_location_tag(data.highway) ~= "no" then
|
||||
result.forward_speed = profile.trunk_speeds[data.highway]
|
||||
result.backward_speed = profile.trunk_speeds[data.highway]
|
||||
data.way_type_allows_pushing = true
|
||||
end
|
||||
elseif data.access and profile.access_tag_whitelist[data.access] then
|
||||
-- unknown way, but valid access tag
|
||||
result.forward_speed = profile.default_speed
|
||||
@ -480,27 +472,6 @@ function cycleway_handler(profile,way,result,data)
|
||||
end
|
||||
end
|
||||
|
||||
function width_handler(profile,way,result,data)
|
||||
if profile.exclude_cargo_bike then
|
||||
local cargo_bike = way:get_value_by_key("cargo_bike")
|
||||
if cargo_bike and cargo_bike == "no" then
|
||||
result.forward_mode = mode.inaccessible
|
||||
result.backward_mode = mode.inaccessible
|
||||
end
|
||||
end
|
||||
|
||||
if profile.width then
|
||||
local width = way:get_value_by_key("width")
|
||||
if width then
|
||||
local width_meter = Measure.parse_value_meters(width)
|
||||
if width_meter and width_meter < profile.width then
|
||||
result.forward_mode = mode.inaccessible
|
||||
result.backward_mode = mode.inaccessible
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function bike_push_handler(profile,way,result,data)
|
||||
-- pushing bikes - if no other mode found
|
||||
if result.forward_mode == mode.inaccessible or result.backward_mode == mode.inaccessible or
|
||||
|
@ -20,6 +20,7 @@ function setup()
|
||||
use_turn_restrictions = false,
|
||||
},
|
||||
|
||||
profile = 'foot',
|
||||
default_mode = mode.walking,
|
||||
default_speed = walking_speed,
|
||||
oneway_handling = 'specific', -- respect 'oneway:foot' but not 'oneway'
|
||||
@ -70,9 +71,15 @@ function setup()
|
||||
|
||||
avoid = Set {
|
||||
'impassable',
|
||||
'proposed'
|
||||
'proposed',
|
||||
'motorroad'
|
||||
},
|
||||
|
||||
trunk_speeds = {
|
||||
trunk = walking_speed,
|
||||
trunk_link = walking_speed
|
||||
},
|
||||
|
||||
speeds = Sequence {
|
||||
highway = {
|
||||
primary = walking_speed,
|
||||
@ -132,6 +139,10 @@ function setup()
|
||||
},
|
||||
|
||||
smoothness_speeds = {
|
||||
},
|
||||
|
||||
uselocationtags = Set {
|
||||
-- 'trunk'
|
||||
}
|
||||
}
|
||||
end
|
||||
@ -190,7 +201,6 @@ function process_way(profile, way, result)
|
||||
amenity = way:get_value_by_key('amenity'),
|
||||
public_transport = way:get_value_by_key('public_transport')
|
||||
}
|
||||
|
||||
-- perform an quick initial check and abort if the way is
|
||||
-- obviously not routable. here we require at least one
|
||||
-- of the prefetched tags to be present, ie. the data table
|
||||
|
@ -276,6 +276,16 @@ function WayHandlers.speed(profile,way,result,data)
|
||||
|
||||
local key,value,speed = Tags.get_constant_by_key_value(way,profile.speeds)
|
||||
|
||||
-- if the highway is trunk or trunk_link and locationtag disables it
|
||||
-- then noroute available
|
||||
|
||||
if not speed and data.highway and profile.uselocationtags and profile.uselocationtags.trunk then
|
||||
if profile.trunk_speeds[data.highway] and
|
||||
(not way:get_location_tag(data.highway) or way:get_location_tag(data.highway) ~= "no") then
|
||||
speed = profile.trunk_speeds[data.highway]
|
||||
end
|
||||
end
|
||||
|
||||
if speed then
|
||||
-- set speed by way type
|
||||
result.forward_speed = speed
|
||||
@ -634,6 +644,11 @@ function WayHandlers.blocked_ways(profile,way,result,data)
|
||||
return false
|
||||
end
|
||||
|
||||
-- motorroad
|
||||
if profile.avoid.motorroad and way:get_value_by_key("motorroad") == "yes" then
|
||||
return false
|
||||
end
|
||||
|
||||
-- In addition to the highway=construction tag above handle the construction=* tag
|
||||
-- http://wiki.openstreetmap.org/wiki/Key:construction
|
||||
-- https://taginfo.openstreetmap.org/keys/construction#values
|
||||
|
Loading…
Reference in New Issue
Block a user