From 77b4fbb69c921f95ffcb56a72bf5718e8d0ebc28 Mon Sep 17 00:00:00 2001 From: Huyen Chau Nguyen Date: Sat, 15 Dec 2018 04:42:44 +0000 Subject: [PATCH] Fix maxspeed to consider `source:maxspeed` tags (#5217) * In Belgium the maximum speed in rural areas is 70 in the region Flanders * parse maxspeed using source:maxspeed and maxspeed:type tags * add changelog * make maxspeed:advisory more important than maxspeed * add test for source:maxspeed --- CHANGELOG.md | 2 ++ features/car/maxspeed.feature | 25 +++++++++++++++++++++++++ profiles/car.lua | 1 + profiles/lib/way_handlers.lua | 2 +- taginfo.json | 1 + 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d8d72523ad..44864a837db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ - FIXED: don't override default permissions on /opt [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311) - Matching: - CHANGED: matching will now consider edges marked with is_startpoint=false, allowing matching over ferries and other previously non-matchable edge types. [#5297](https://github.com/Project-OSRM/osrm-backend/pull/5297) + - Profile: + - ADDED: Parse `source:maxspeed` and `maxspeed:type` tags to apply maxspeeds and add belgian flanders rural speed limit. [#5217](https://github.com/Project-OSRM/osrm-backend/pull/5217) # 5.20.0 - Changes from 5.19.0: diff --git a/features/car/maxspeed.feature b/features/car/maxspeed.feature index 2c6da2714e8..c7169b37c3f 100644 --- a/features/car/maxspeed.feature +++ b/features/car/maxspeed.feature @@ -137,3 +137,28 @@ OSRM will use 4/5 of the projected free-flow speed. | primary | | | 30 | -1 | | 23 km/h | | 6.7 | | primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 | | primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 | + + + Scenario: Car - Respect source:maxspeed + Given the node map + """ + a b c d e f g + """ + + And the ways + | nodes | highway | source:maxspeed | maxspeed | + | ab | trunk | | | + | bc | trunk | | 60 | + | cd | trunk | FR:urban | | + | de | trunk | CH:rural | | + | ef | trunk | CH:trunk | | + | fg | trunk | CH:motorway | | + + When I route I should get + | from | to | route | speed | + | a | b | ab,ab | 85 km/h | + | b | c | bc,bc | 48 km/h | + | c | d | cd,cd | 40 km/h | + | d | e | de,de | 64 km/h | + | e | f | ef,ef | 80 km/h | + | f | g | fg,fg | 96 km/h | \ No newline at end of file diff --git a/profiles/car.lua b/profiles/car.lua index a73980d919c..02f185abb20 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -269,6 +269,7 @@ function setup() ["at:rural"] = 100, ["at:trunk"] = 100, ["be:motorway"] = 120, + ["be-vlg:rural"] = 70, ["by:urban"] = 60, ["by:motorway"] = 110, ["ch:rural"] = 80, diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index 265929d733c..968cc9aa6cb 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -432,7 +432,7 @@ end -- maxspeed and advisory maxspeed function WayHandlers.maxspeed(profile,way,result,data) - local keys = Sequence { 'maxspeed:advisory', 'maxspeed' } + local keys = Sequence { 'maxspeed:advisory', 'maxspeed', 'source:maxspeed', 'maxspeed:type' } local forward, backward = Tags.get_forward_backward_by_set(way,data,keys) forward = WayHandlers.parse_maxspeed(forward,profile) backward = WayHandlers.parse_maxspeed(backward,profile) diff --git a/taginfo.json b/taginfo.json index 0bb923ecf7d..38f50bd9711 100644 --- a/taginfo.json +++ b/taginfo.json @@ -148,6 +148,7 @@ {"key": "maxspeed", "value": "AT:rural"}, {"key": "maxspeed", "value": "AT:trunk"}, {"key": "maxspeed", "value": "BE:motorway"}, + {"key": "maxspeed", "value": "BE-VLG:rural"}, {"key": "maxspeed", "value": "BY:urban"}, {"key": "maxspeed", "value": "BY:motorway"}, {"key": "maxspeed", "value": "CH:rural"},