Skip to content

Commit

Permalink
Fix maxspeed to consider source:maxspeed tags (#5217)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
chaupow authored and danpat committed Dec 15, 2018
1 parent 11fde86 commit 77b4fbb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 25 additions & 0 deletions features/car/maxspeed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
1 change: 1 addition & 0 deletions profiles/car.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion profiles/lib/way_handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions taginfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 77b4fbb

Please sign in to comment.