support country in foot.lua and bicycle.lua
This commit is contained in:
parent
41fa6987ce
commit
f193b7cde0
89
features/bicycle/countrybikespeeds.feature
Normal file
89
features/bicycle/countrybikespeeds.feature
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@routing @bicycle @countrybikespeeds
|
||||||
|
Feature: Testbot - Country Profile Selection
|
||||||
|
|
||||||
|
# Check that country data is being selected
|
||||||
|
# CHE (a) does not support trunk on bike
|
||||||
|
# FIN (c) does not support trunk on bike
|
||||||
|
# GRC (m) and IRL (o) support bridleway
|
||||||
|
# LIU (s) is not a country in list so looks like worldwide
|
||||||
|
# so
|
||||||
|
# GRC (m) and LIU (s) support trunk
|
||||||
|
|
||||||
|
Scenario: Profile Selection - highway chosen for country
|
||||||
|
|
||||||
|
Given the extract extra arguments "--location-dependent-data test/data/countrytest.geojson"
|
||||||
|
And the partition extra arguments "--threads 1"
|
||||||
|
And the customize extra arguments "--threads 1"
|
||||||
|
|
||||||
|
And the profile file "bicycle" initialized with
|
||||||
|
"""
|
||||||
|
profile.uselocationtags.countryspeeds = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the node locations
|
||||||
|
| node | lat | lon |
|
||||||
|
| a | 9.5 | 5.0 |
|
||||||
|
| b | 9.5 | 10.0 |
|
||||||
|
| c | 9.5 | 15.0 |
|
||||||
|
| d | 9.0 | 5.0 |
|
||||||
|
| e | 9.0 | 10.0 |
|
||||||
|
| f | 9.0 | 15.0 |
|
||||||
|
| g | 8.5 | 5.0 |
|
||||||
|
| h | 8.5 | 10.0 |
|
||||||
|
| i | 8.5 | 15.0 |
|
||||||
|
| j | 8.0 | 5.0 |
|
||||||
|
| k | 8.0 | 10.0 |
|
||||||
|
| l | 8.0 | 15.0 |
|
||||||
|
| m | 7.5 | 5.0 |
|
||||||
|
| n | 7.5 | 10.0 |
|
||||||
|
| o | 7.5 | 15.0 |
|
||||||
|
| p | 7.0 | 5.0 |
|
||||||
|
| q | 7.0 | 10.0 |
|
||||||
|
| r | 7.0 | 15.0 |
|
||||||
|
| s | 6.5 | 5.0 |
|
||||||
|
| t | 6.5 | 10.0 |
|
||||||
|
| u | 6.5 | 15.0 |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | comment
|
||||||
|
| ab | trunk | CHE - FIN no
|
||||||
|
| bc | trunk |
|
||||||
|
| cf | trunk | FIN - BEL no
|
||||||
|
| fi | trunk |
|
||||||
|
| fl | trunk |
|
||||||
|
| or | trunk | IRL - world yes
|
||||||
|
| ru | trunk |
|
||||||
|
| mn | bridleway | GRC - IRL yes
|
||||||
|
| no | bridleway |
|
||||||
|
| mp | trunk | GRC - liu yes
|
||||||
|
| ps | trunk |
|
||||||
|
|
||||||
|
And the partition extra arguments "--threads 1"
|
||||||
|
And the customize extra arguments "--threads 1"
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | status | message |
|
||||||
|
| a,b,c | | 400 | Impossible route between points |
|
||||||
|
| c,l | | 400 | Impossible route between points |
|
||||||
|
| g,i | | 400 | Impossible route between points |
|
||||||
|
| o,u | or,ru,ru | 200 | |
|
||||||
|
| m,o | mn,no,no | 200 | |
|
||||||
|
| m,s | mp,ps,ps | 200 | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
39
features/bicycle/countrymotorroad.feature
Normal file
39
features/bicycle/countrymotorroad.feature
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
@routing @bicycle @countrymotorroad
|
||||||
|
Feature: Testbot - Country motorroad Selection
|
||||||
|
|
||||||
|
# Check that motorroad is avoided
|
||||||
|
|
||||||
|
Scenario: bicycle Profile Selection - motorroad avoided
|
||||||
|
|
||||||
|
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.countryspeeds = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the node locations
|
||||||
|
| node | lat | lon |
|
||||||
|
| a | 9.5 | 5.0 |
|
||||||
|
| b | 9.5 | 10.0 |
|
||||||
|
| c | 9.5 | 15.0 |
|
||||||
|
| d | 9.0 | 5.0 |
|
||||||
|
| e | 9.0 | 10.0 |
|
||||||
|
| f | 9.0 | 15.0 |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | motorroad |
|
||||||
|
| ab | trunk | yes |
|
||||||
|
| bc | trunk | |
|
||||||
|
| ad | trunk | |
|
||||||
|
| de | trunk | |
|
||||||
|
| ef | trunk | |
|
||||||
|
| cf | trunk | |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | status | message |
|
||||||
|
| a,c | ad,de,ef,cf,cf | 200 | |
|
||||||
|
| a,b | ad,de,ef,cf,bc,bc | 200 | |
|
||||||
|
|
42
features/bicycle/countryway.feature
Normal file
42
features/bicycle/countryway.feature
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
@routing @foot @countryway
|
||||||
|
Feature: bicycle - Accessability of different way types with countryspeeds
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the profile file "bicycle" initialized with
|
||||||
|
"""
|
||||||
|
profile.uselocationtags.countryspeeds = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Countrybicycle - Basic access
|
||||||
|
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 | x |
|
||||||
|
| bridleway | |
|
||||||
|
|
||||||
|
Scenario: Country bicycle - Routability of man_made structures
|
||||||
|
Then routability should be
|
||||||
|
| highway | man_made | bothw |
|
||||||
|
| (nil) | (nil) | |
|
||||||
|
| (nil) | pier | x |
|
||||||
|
|
55
features/foot/countrymotorroad.feature
Normal file
55
features/foot/countrymotorroad.feature
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
@routing @foot @countrymotorroad
|
||||||
|
Feature: Testbot - Country motorroad Selection
|
||||||
|
|
||||||
|
# Check that motorroad is avoided
|
||||||
|
|
||||||
|
Scenario: foot Profile Selection - motorroad avoided
|
||||||
|
|
||||||
|
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.countryspeeds = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the node locations
|
||||||
|
| node | lat | lon |
|
||||||
|
| a | 9.5 | 5.0 |
|
||||||
|
| b | 9.5 | 10.0 |
|
||||||
|
| c | 9.5 | 15.0 |
|
||||||
|
| d | 9.0 | 5.0 |
|
||||||
|
| e | 9.0 | 10.0 |
|
||||||
|
| f | 9.0 | 15.0 |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | motorroad |
|
||||||
|
| ab | trunk | yes |
|
||||||
|
| bc | trunk | |
|
||||||
|
| ad | trunk | |
|
||||||
|
| de | trunk | |
|
||||||
|
| ef | trunk | |
|
||||||
|
| cf | trunk | |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | status | message |
|
||||||
|
| a,c | ad,de,ef,cf,cf | 200 | |
|
||||||
|
| a,b | ad,de,ef,cf,bc,bc | 200 | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
85
features/foot/countryspeeds.feature
Normal file
85
features/foot/countryspeeds.feature
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
@routing @foot @countryspeeds
|
||||||
|
Feature: Testbot - Country Profile Selection
|
||||||
|
|
||||||
|
# Check that country data is being selected
|
||||||
|
# CHE (a) and FIN (c) support foot on cycleway
|
||||||
|
# FRA (g) does not support foot on cycleway
|
||||||
|
# BEL (i) and FIN (c) support foot on cycleway
|
||||||
|
# BEL (i) and IRL (o) support Bridleway
|
||||||
|
# GRC (m) and IRL (o) support trunk and bridleway
|
||||||
|
# LIU (s) is not a country in list so looks like worldwide
|
||||||
|
# so
|
||||||
|
# GRC (m) and LIU (s) support trunk
|
||||||
|
# LIU (s) does not support cycleway or bridleway
|
||||||
|
# Worldwide (u) is an area without boundaries (so like s)
|
||||||
|
|
||||||
|
Scenario: foot Profile Selection - highway chosen for country
|
||||||
|
|
||||||
|
Given the extract extra arguments "--threads 1 --location-dependent-data test/data/countrytest.geojson"
|
||||||
|
And the partition extra arguments "--threads 1"
|
||||||
|
And the customize extra arguments "--threads 1"
|
||||||
|
|
||||||
|
And the profile file "foot" initialized with
|
||||||
|
"""
|
||||||
|
profile.uselocationtags.countryspeeds = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the node locations
|
||||||
|
| node | lat | lon |
|
||||||
|
| a | 9.5 | 5.0 |
|
||||||
|
| b | 9.5 | 10.0 |
|
||||||
|
| c | 9.5 | 15.0 |
|
||||||
|
| d | 9.0 | 5.0 |
|
||||||
|
| e | 9.0 | 10.0 |
|
||||||
|
| f | 9.0 | 15.0 |
|
||||||
|
| g | 8.5 | 5.0 |
|
||||||
|
| h | 8.5 | 10.0 |
|
||||||
|
| i | 8.5 | 15.0 |
|
||||||
|
| j | 8.0 | 5.0 |
|
||||||
|
| k | 8.0 | 10.0 |
|
||||||
|
| l | 8.0 | 15.0 |
|
||||||
|
| m | 7.5 | 5.0 |
|
||||||
|
| n | 7.5 | 10.0 |
|
||||||
|
| o | 7.5 | 15.0 |
|
||||||
|
| p | 7.0 | 5.0 |
|
||||||
|
| q | 7.0 | 10.0 |
|
||||||
|
| r | 7.0 | 15.0 |
|
||||||
|
| s | 6.5 | 5.0 |
|
||||||
|
| t | 6.5 | 10.0 |
|
||||||
|
| u | 6.5 | 15.0 |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | comment
|
||||||
|
| ab | cycleway | CHE - FIN yes
|
||||||
|
| bc | cycleway |
|
||||||
|
| ad | cycleway | CHE - FRA no
|
||||||
|
| dg | cycleway |
|
||||||
|
| gj | cycleway |
|
||||||
|
| cf | bridleway | FIN - BEL no
|
||||||
|
| fi | bridleway |
|
||||||
|
| gh | trunk | FRA - BEL no
|
||||||
|
| hi | trunk |
|
||||||
|
| il | bridleway | BEL - IRL yes
|
||||||
|
| lo | bridleway |
|
||||||
|
| or | trunk | IRL - world yes
|
||||||
|
| ru | trunk |
|
||||||
|
| mn | trunk | GRC - IRL yes
|
||||||
|
| no | trunk |
|
||||||
|
| mp | trunk | GRC - liu yes
|
||||||
|
| ps | trunk |
|
||||||
|
|
||||||
|
And the partition extra arguments "--threads 1"
|
||||||
|
And the customize extra arguments "--threads 1"
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | status | message |
|
||||||
|
| a,c | ab,bc,bc | 200 | |
|
||||||
|
| a,j | | 400 | Impossible route between points |
|
||||||
|
| c,i | | 400 | Impossible route between points |
|
||||||
|
| g,i | | 400 | Impossible route between points |
|
||||||
|
| i,o | il,lo,lo | 200 | |
|
||||||
|
| o,u | or,ru,ru | 200 | |
|
||||||
|
| m,o | mn,no,no | 200 | |
|
||||||
|
| m,s | mp,ps,ps | 200 | |
|
||||||
|
|
41
features/foot/countryway.feature
Normal file
41
features/foot/countryway.feature
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
@routing @foot @countryway
|
||||||
|
Feature: foot - Accessability of different way types with countryspeeds
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the profile file "foot" initialized with
|
||||||
|
"""
|
||||||
|
profile.uselocationtags.countryspeeds = true
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Countryfoot - Basic access
|
||||||
|
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 | |
|
||||||
|
|
||||||
|
Scenario: Countryfoot - Basic access
|
||||||
|
Then routability should be
|
||||||
|
| highway | leisure | forw |
|
||||||
|
| (nil) | track | x |
|
||||||
|
|
@ -7,6 +7,7 @@ Sequence = require('lib/sequence')
|
|||||||
Handlers = require("lib/way_handlers")
|
Handlers = require("lib/way_handlers")
|
||||||
TrafficSignal = require("lib/traffic_signal")
|
TrafficSignal = require("lib/traffic_signal")
|
||||||
find_access_tag = require("lib/access").find_access_tag
|
find_access_tag = require("lib/access").find_access_tag
|
||||||
|
country_speeds = require("lib/country_speeds")
|
||||||
limit = require("lib/maxspeed").limit
|
limit = require("lib/maxspeed").limit
|
||||||
Measure = require("lib/measure")
|
Measure = require("lib/measure")
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ function setup()
|
|||||||
mode_change_penalty = 30,
|
mode_change_penalty = 30,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
profile = 'bicycle',
|
||||||
default_mode = mode.cycling,
|
default_mode = mode.cycling,
|
||||||
default_speed = default_speed,
|
default_speed = default_speed,
|
||||||
walking_speed = walking_speed,
|
walking_speed = walking_speed,
|
||||||
@ -217,7 +219,13 @@ function setup()
|
|||||||
avoid = Set {
|
avoid = Set {
|
||||||
'impassable',
|
'impassable',
|
||||||
'construction',
|
'construction',
|
||||||
'proposed'
|
'proposed',
|
||||||
|
'motorroad'
|
||||||
|
},
|
||||||
|
|
||||||
|
uselocationtags = Set
|
||||||
|
{
|
||||||
|
-- 'countryspeeds'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -315,11 +323,23 @@ function handle_bicycle_tags(profile,way,result,data)
|
|||||||
safety_handler(profile,way,result,data)
|
safety_handler(profile,way,result,data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function speed_handler(profile,way,result,data)
|
function speed_handler(profile,way,result,data)
|
||||||
|
|
||||||
data.way_type_allows_pushing = false
|
data.way_type_allows_pushing = false
|
||||||
|
local extra_speeds
|
||||||
|
local extraspeed = false
|
||||||
|
|
||||||
|
if profile.uselocationtags and profile.uselocationtags.countryspeeds then
|
||||||
|
extra_speeds = country_speeds.getAccessProfile(data, profile.profile)
|
||||||
|
if extra_speeds then
|
||||||
|
if extra_speeds.highway[data.highway] then
|
||||||
|
extraspeed = extra_speeds.highway[data.highway]
|
||||||
|
if extraspeed == -1 then
|
||||||
|
extraspeed = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- speed
|
-- speed
|
||||||
local bridge_speed = profile.bridge_speeds[data.bridge]
|
local bridge_speed = profile.bridge_speeds[data.bridge]
|
||||||
@ -362,6 +382,12 @@ function speed_handler(profile,way,result,data)
|
|||||||
result.forward_speed = profile.amenity_speeds[data.amenity]
|
result.forward_speed = profile.amenity_speeds[data.amenity]
|
||||||
result.backward_speed = profile.amenity_speeds[data.amenity]
|
result.backward_speed = profile.amenity_speeds[data.amenity]
|
||||||
data.way_type_allows_pushing = true
|
data.way_type_allows_pushing = true
|
||||||
|
elseif extraspeed then
|
||||||
|
if extraspeed ~= -1 then
|
||||||
|
result.forward_speed = extraspeed
|
||||||
|
result.backward_speed = extraspeed
|
||||||
|
data.way_type_allows_pushing = true
|
||||||
|
end
|
||||||
elseif profile.bicycle_speeds[data.highway] then
|
elseif profile.bicycle_speeds[data.highway] then
|
||||||
-- regular ways
|
-- regular ways
|
||||||
result.forward_speed = profile.bicycle_speeds[data.highway]
|
result.forward_speed = profile.bicycle_speeds[data.highway]
|
||||||
@ -606,6 +632,10 @@ function process_way(profile, way, result)
|
|||||||
implied_oneway = false
|
implied_oneway = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if profile.uselocationtags and profile.uselocationtags.countryspeeds then
|
||||||
|
data.location = country_speeds.getcountrytag(way)
|
||||||
|
end
|
||||||
|
|
||||||
local handlers = Sequence {
|
local handlers = Sequence {
|
||||||
-- set the default mode for this profile. if can be changed later
|
-- set the default mode for this profile. if can be changed later
|
||||||
-- in case it turns we're e.g. on a ferry
|
-- in case it turns we're e.g. on a ferry
|
||||||
|
@ -6,6 +6,7 @@ Set = require('lib/set')
|
|||||||
Sequence = require('lib/sequence')
|
Sequence = require('lib/sequence')
|
||||||
Handlers = require("lib/way_handlers")
|
Handlers = require("lib/way_handlers")
|
||||||
find_access_tag = require("lib/access").find_access_tag
|
find_access_tag = require("lib/access").find_access_tag
|
||||||
|
country_speeds = require("lib/country_speeds")
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
local walking_speed = 5
|
local walking_speed = 5
|
||||||
@ -20,6 +21,7 @@ function setup()
|
|||||||
use_turn_restrictions = false,
|
use_turn_restrictions = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
profile = 'foot',
|
||||||
default_mode = mode.walking,
|
default_mode = mode.walking,
|
||||||
default_speed = walking_speed,
|
default_speed = walking_speed,
|
||||||
oneway_handling = 'specific', -- respect 'oneway:foot' but not 'oneway'
|
oneway_handling = 'specific', -- respect 'oneway:foot' but not 'oneway'
|
||||||
@ -70,10 +72,11 @@ function setup()
|
|||||||
|
|
||||||
avoid = Set {
|
avoid = Set {
|
||||||
'impassable',
|
'impassable',
|
||||||
'proposed'
|
'proposed',
|
||||||
|
'motorroad'
|
||||||
},
|
},
|
||||||
|
|
||||||
speeds = Sequence {
|
hwyspeeds = Sequence {
|
||||||
highway = {
|
highway = {
|
||||||
primary = walking_speed,
|
primary = walking_speed,
|
||||||
primary_link = walking_speed,
|
primary_link = walking_speed,
|
||||||
@ -94,6 +97,9 @@ function setup()
|
|||||||
footway = walking_speed,
|
footway = walking_speed,
|
||||||
pier = walking_speed,
|
pier = walking_speed,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
otherspeeds = Sequence {
|
||||||
|
|
||||||
railway = {
|
railway = {
|
||||||
platform = walking_speed
|
platform = walking_speed
|
||||||
@ -132,6 +138,11 @@ function setup()
|
|||||||
},
|
},
|
||||||
|
|
||||||
smoothness_speeds = {
|
smoothness_speeds = {
|
||||||
|
},
|
||||||
|
|
||||||
|
uselocationtags = Set
|
||||||
|
{
|
||||||
|
-- 'countryspeeds'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -198,6 +209,12 @@ function process_way(profile, way, result)
|
|||||||
if next(data) == nil then -- is the data table empty?
|
if next(data) == nil then -- is the data table empty?
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local speedhandler = WayHandlers.speed
|
||||||
|
|
||||||
|
if profile.uselocationtags and profile.uselocationtags.countryspeeds then
|
||||||
|
data.location = country_speeds.getcountrytag(way)
|
||||||
|
speedhandler =country_speeds.wayspeed
|
||||||
|
end
|
||||||
|
|
||||||
local handlers = Sequence {
|
local handlers = Sequence {
|
||||||
-- set the default mode for this profile. if can be changed later
|
-- set the default mode for this profile. if can be changed later
|
||||||
@ -224,7 +241,7 @@ function process_way(profile, way, result)
|
|||||||
WayHandlers.movables,
|
WayHandlers.movables,
|
||||||
|
|
||||||
-- compute speed taking into account way type, maxspeed tags, etc.
|
-- compute speed taking into account way type, maxspeed tags, etc.
|
||||||
WayHandlers.speed,
|
speedhandler,
|
||||||
WayHandlers.surface,
|
WayHandlers.surface,
|
||||||
|
|
||||||
-- handle turn lanes and road classification, used for guidance
|
-- handle turn lanes and road classification, used for guidance
|
||||||
|
@ -274,8 +274,27 @@ function WayHandlers.speed(profile,way,result,data)
|
|||||||
return -- abort if already set, eg. by a route
|
return -- abort if already set, eg. by a route
|
||||||
end
|
end
|
||||||
|
|
||||||
local key,value,speed = Tags.get_constant_by_key_value(way,profile.speeds)
|
local wayspeeds
|
||||||
|
if profile.speeds then
|
||||||
|
wayspeeds = profile.speeds
|
||||||
|
elseif profile.hwyspeeds then
|
||||||
|
wayspeeds = profile.hwyspeeds
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local key,value,speed = Tags.get_constant_by_key_value(way,wayspeeds)
|
||||||
|
|
||||||
|
if speed then
|
||||||
|
-- set speed by way type
|
||||||
|
result.forward_speed = speed
|
||||||
|
result.backward_speed = speed
|
||||||
|
else
|
||||||
|
-- check for other speeds
|
||||||
|
if profile.otherspeeds then
|
||||||
|
key,value,speed = Tags.get_constant_by_key_value(way,profile.otherspeeds)
|
||||||
|
end
|
||||||
|
end
|
||||||
if speed then
|
if speed then
|
||||||
-- set speed by way type
|
-- set speed by way type
|
||||||
result.forward_speed = speed
|
result.forward_speed = speed
|
||||||
|
Loading…
Reference in New Issue
Block a user