Skip to content

Commit 5266ac1

Browse files
authored
Add support for multiple via-way restrictions (#5907)
Currently OSRM only supports turn restrictions with a single via-node or one via-way. OSM allows for multiple via-ways to represent longer and more complex restrictions. This PR extends the use of duplicate nodes for representng via-way turn restrictions to also support multi via-way restrictions. Effectively, this increases the edge-based graph size by the number of edges in multi via-way restrictions. However, given the low number of these restrictions it has little effect on total graph size. In addition, we add a new step in the extraction phase that constructs a restriction graph to support more complex relationships between restrictions, such as nested restrictions and overlapping restrictions.
1 parent eb1d399 commit 5266ac1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3171
-1407
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22
- Changes from 5.23.0
3-
- Features:
3+
- Features
4+
- ADDED: Added support for multiple via-way restrictions. [#5907](https://github.com/Project-OSRM/osrm-backend/pull/5907)
45
- ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
56
- REMOVED: we no longer publish Node 8 binary modules (they are still buildable from source) [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
67
- Misc:

features/car/conditional_restrictions.feature

Lines changed: 18 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -387,217 +387,37 @@ Feature: Car - Turn restrictions
387387
| m | p | mj,jp,jp |
388388

389389
@no_turning @conditionals
390-
Scenario: Car - only_right_turn
390+
Scenario: Car - Multiple conditional restrictions applicable to same turn
391391
Given the extract extra arguments "--parse-conditional-restrictions"
392392
# time stamp for 10am on Tues, 02 May 2017 GMT
393393
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
394394
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
395-
Given the node map
396-
"""
397-
a
398-
d j b
399-
c
400-
"""
401395

402-
And the ways
403-
| nodes | oneway |
404-
| aj | no |
405-
| jc | no |
406-
| bj | yes |
407-
| jd | yes |
408-
409-
And the relations
410-
| type | way:from | way:to | node:via | restriction:conditional |
411-
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
412-
413-
When I route I should get
414-
| from | to | route |
415-
| b | c | bj,aj,aj,jc,jc |
416-
| b | a | bj,aj,aj |
417-
| b | d | bj,aj,aj,jd,jd |
418-
419-
@no_turning @conditionals
420-
Scenario: Car - No right turn
421-
Given the extract extra arguments "--parse-conditional-restrictions"
422-
# time stamp for 10am on Tues, 02 May 2017 GMT
423-
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
424-
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
425396
Given the node map
426397
"""
427-
a
428-
d j b
429-
c
398+
j
399+
|
400+
k - l - m
401+
|
402+
n
430403
"""
431404

432405
And the ways
433-
| nodes | oneway |
434-
| aj | no |
435-
| jc | no |
436-
| bj | yes |
437-
| jd | yes |
406+
| nodes |
407+
| kl |
408+
| jl |
409+
| ln |
410+
| lm |
438411

439412
And the relations
440413
| type | way:from | way:to | node:via | restriction:conditional |
441-
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
442-
443-
When I route I should get
444-
| from | to | route | # |
445-
| b | c | bj,jc,jc | normal turn |
446-
| b | a | bj,jc,jc,aj,aj | avoids right turn |
447-
| b | d | bj,jd,jd | normal maneuver |
448-
449-
@only_turning @conditionals
450-
Scenario: Car - only_left_turn
451-
Given the extract extra arguments "--parse-conditional-restrictions"
452-
# time stamp for 10am on Tues, 02 May 2017 GMT
453-
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
454-
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
455-
Given the node map
456-
"""
457-
a
458-
d j b
459-
c
460-
"""
461-
462-
And the ways
463-
| nodes | oneway |
464-
| aj | no |
465-
| jc | no |
466-
| bj | yes |
467-
| jd | yes |
468-
469-
And the relations
470-
| type | way:from | way:to | node:via | restriction:conditional |
471-
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
472-
473-
When I route I should get
474-
| from | to | route |
475-
| b | c | bj,jc,jc |
476-
| b | a | bj,jc,jc,aj,aj |
477-
| b | d | bj,jc,jc,jd,jd |
478-
479-
@no_turning @conditionals
480-
Scenario: Car - No left turn
481-
Given the extract extra arguments "--parse-conditional-restrictions"
482-
# time stamp for 10am on Tues, 02 May 2017 GMT
483-
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
484-
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
485-
Given the node map
486-
"""
487-
a
488-
d j b
489-
c
490-
"""
491-
492-
And the ways
493-
| nodes | oneway |
494-
| aj | no |
495-
| jc | no |
496-
| bj | yes |
497-
| jd | yes |
498-
499-
And the relations
500-
| type | way:from | way:to | node:via | restriction:conditional |
501-
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
502-
503-
When I route I should get
504-
| from | to | route |
505-
| b | c | bj,aj,aj,jc,jc |
506-
| b | a | bj,aj,aj |
507-
| b | d | bj,jd,jd |
508-
509-
@no_turning @conditionals
510-
Scenario: Car - Conditional restriction is off
511-
Given the extract extra arguments "--parse-conditional-restrictions"
512-
# time stamp for 10am on Tues, 02 May 2017 GMT
513-
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
514-
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
515-
Given the node map
516-
"""
517-
a
518-
d j b
519-
c
520-
"""
521-
522-
And the ways
523-
| nodes | oneway |
524-
| aj | no |
525-
| jc | no |
526-
| bj | yes |
527-
| jd | yes |
528-
529-
And the relations
530-
| type | way:from | way:to | node:via | restriction:conditional |
531-
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
532-
533-
When I route I should get
534-
| from | to | route |
535-
| b | c | bj,jc,jc |
536-
| b | a | bj,aj,aj |
537-
| b | d | bj,jd,jd |
538-
539-
@no_turning @conditionals
540-
Scenario: Car - Conditional restriction is on
541-
Given the extract extra arguments "--parse-conditional-restrictions"
542-
# 10am utc, wed
543-
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
544-
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
545-
Given the node map
546-
"""
547-
a
548-
d j b
549-
c
550-
"""
551-
552-
And the ways
553-
| nodes | oneway |
554-
| aj | no |
555-
| jc | no |
556-
| bj | yes |
557-
| jd | yes |
558-
559-
And the relations
560-
| type | way:from | way:to | node:via | restriction:conditional |
561-
| restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
414+
| restriction | kl | lj | l | only_left_turn @ (Sa-Su 07:00-10:30) |
415+
| restriction | kl | ln | l | only_right_turn @ (Mo-Fr 07:00-10:30) |
562416

563417
When I route I should get
564418
| from | to | route |
565-
| b | c | bj,jc,jc |
566-
| b | a | bj,jc,jc,aj,aj |
567-
| b | d | bj,jd,jd |
419+
| k | m | kl,ln,ln,lm,lm |
568420

569-
@no_turning @conditionals
570-
Scenario: Car - Conditional restriction with multiple time windows
571-
Given the extract extra arguments "--parse-conditional-restrictions"
572-
# 5pm Wed 02 May, 2017 GMT
573-
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
574-
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
575-
576-
Given the node map
577-
"""
578-
a
579-
p |
580-
\ |
581-
j
582-
| \
583-
c m
584-
"""
585-
586-
And the ways
587-
| nodes | oneway |
588-
| aj | no |
589-
| jc | no |
590-
| jp | yes |
591-
| mj | yes |
592-
593-
And the relations
594-
| type | way:from | way:to | node:via | restriction:conditional |
595-
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
596-
597-
When I route I should get
598-
| from | to | route |
599-
| a | p | aj,jc,jc,jp,jp |
600-
| m | p | mj,jp,jp |
601421

602422
@restriction-way
603423
Scenario: Car - prohibit turn
@@ -719,7 +539,7 @@ Feature: Car - Turn restrictions
719539
When I route I should get
720540
| from | to | route | turns |
721541
| a | e | cap south,florida nw,florida nw,florida ne | depart,turn right,continue uturn,arrive |
722-
| f | d | cap north,florida nw,florida nw | depart,turn left,arrive |
542+
| f | d | cap north,florida nw,florida nw | depart,turn left,arrive |
723543
| e | c | florida ne,florida nw,cap south,cap south | depart,continue uturn,turn right,arrive |
724544

725545
@no_turning @conditionals
@@ -796,8 +616,8 @@ Feature: Car - Turn restrictions
796616
| nodes | name |
797617
| ab | albic |
798618
| bc | albic |
799-
| db | dobe |
800-
| be | dobe |
619+
| db | dobe |
620+
| be | dobe |
801621

802622
And the relations
803623
| type | way:from | way:to | node:via | restriction:conditional |
@@ -1047,7 +867,7 @@ Feature: Car - Turn restrictions
1047867
| type | way:from | node:via | way:to | restriction:conditional |
1048868
| restriction | be | e | de | no_right_turn @ (Mo-Fr 07:00-11:00) |
1049869

1050-
# node restrictino is off, way restriction is on
870+
# node restriction is off, way restriction is on
1051871
When I route I should get
1052872
| from | to | route | turns | locations |
1053873
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |

0 commit comments

Comments
 (0)