bikes, handle parking areas and train platforms

This commit is contained in:
Emil Tin 2012-10-13 23:38:54 +02:00
parent ad5b96d6f2
commit 57dc1e03b1
3 changed files with 79 additions and 6 deletions

View File

@ -3,7 +3,8 @@ Feature: Bike - Squares and other areas
Background: Background:
Given the speedprofile "bicycle" Given the speedprofile "bicycle"
@square
Scenario: Bike - Route along edge of a squares Scenario: Bike - Route along edge of a squares
Given the node map Given the node map
| x | | | x | |
@ -25,7 +26,8 @@ Feature: Bike - Squares and other areas
| d | c | abcda | | d | c | abcda |
| d | a | abcda | | d | a | abcda |
| a | d | abcda | | a | d | abcda |
@building
Scenario: Bike - Don't route on buildings Scenario: Bike - Don't route on buildings
Given the node map Given the node map
| x | | | x | |
@ -47,3 +49,55 @@ Feature: Bike - Squares and other areas
| d | c | | | d | c | |
| d | a | | | d | a | |
| a | d | | | a | d | |
@parking
Scenario: Bike - parking areas
Given the node map
| e | | | f |
| x | a | b | y |
| | d | c | |
And the ways
| nodes | highway | amenity |
| xa | primary | |
| by | primary | |
| xefy | primary | |
| abcda | (nil) | parking |
When I route I should get
| from | to | route |
| x | y | xa,abcda,by |
| y | x | by,abcda,xa |
| a | b | abcda |
| a | d | abcda |
| b | c | abcda |
| c | b | abcda |
| c | d | abcda |
| d | c | abcda |
| d | a | abcda |
| a | d | abcda |
@train @platform
Scenario: Bike - railway platforms
Given the node map
| x | a | b | y |
| | d | c | |
And the ways
| nodes | highway | railway |
| xa | primary | |
| by | primary | |
| abcda | (nil) | platform |
When I route I should get
| from | to | route |
| x | y | xa,abcda,by |
| y | x | by,abcda,xa |
| a | b | abcda |
| a | d | abcda |
| b | c | abcda |
| c | b | abcda |
| c | d | abcda |
| d | c | abcda |
| d | a | abcda |
| a | d | abcda |

View File

@ -1,4 +1,4 @@
@routing @bicycle @train @todo @routing @bicycle @train
Feature: Bike - Handle ferry routes Feature: Bike - Handle ferry routes
Bringing bikes on trains and subways Bringing bikes on trains and subways

View File

@ -34,7 +34,7 @@ pedestrian_speeds = {
["footway"] = 5, ["footway"] = 5,
["pedestrian"] = 5, ["pedestrian"] = 5,
["pier"] = 5, ["pier"] = 5,
["steps"] = 2, ["steps"] = 2
} }
railway_speeds = { railway_speeds = {
@ -46,6 +46,15 @@ railway_speeds = {
["tram"] = 10 ["tram"] = 10
} }
platform_speeds = {
["platform"] = 5
}
amenity_speeds = {
["parking"] = 10,
["parking_entrance"] = 10
}
route_speeds = { route_speeds = {
["ferry"] = 5 ["ferry"] = 5
} }
@ -123,10 +132,14 @@ function way_function (way, numberOfNodesInWay)
local duration = way.tags:Find("duration") local duration = way.tags:Find("duration")
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 amenity = way.tags:Find("amenity")
local access = find_access_tag(way) local access = find_access_tag(way)
-- only route on things with highway tag set (not buildings, boundaries, etc) -- only route on things with highway tag set (not buildings, boundaries, etc)
if (not highway or highway == '') and (not route or route == '') and (not railway or railway=='') then if (not highway or highway == '') and
(not route or route == '') and
(not railway or railway=='') and
(not amenity or amenity=='') then
return 0 return 0
end end
@ -154,8 +167,11 @@ function way_function (way, numberOfNodesInWay)
else else
way.speed = route_speeds[route] way.speed = route_speeds[route]
end end
elseif railway and platform_speeds[railway] then
-- railway platforms
way.speed = platform_speeds[railway]
elseif railway and railway_speeds[railway] then elseif railway and railway_speeds[railway] then
-- trains and subways -- railways
if access and access_tag_whitelist[access] then if access and access_tag_whitelist[access] then
way.speed = railway_speeds[railway] way.speed = railway_speeds[railway]
way.direction = Way.bidirectional way.direction = Way.bidirectional
@ -167,6 +183,9 @@ function way_function (way, numberOfNodesInWay)
else else
way.speed = pedestrian_speeds[highway] -- pushing bikes way.speed = pedestrian_speeds[highway] -- pushing bikes
end end
elseif amenity and amenity_speeds[amenity] then
-- parking areas
way.speed = amenity_speeds[amenity]
else else
-- regular ways -- regular ways
if main_speeds[highway] then if main_speeds[highway] then