osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

Setting speed to 0 via traffic updates does not prevent road from being used for routing

Open davidmurray opened this issue 2 years ago • 5 comments

Issue

I am trying to use traffic updates (csv file) to set the speed of a road to zero to indicate that this road is blocked and should not be used for routing.

As a basic test, I have a CSV file that sets the speed of all roads to zero. CSV file used for update (excerpt):

11419,14172,0
11423,14173,0
11427,14173,0
14172,14173,0
11310,14174,0
5712,14174,0
11315,14174,0
11345,14175,0
13918,14175,0
5738,14175,0
...

Output:

davidmurray@Davids-MacBook-Pro-2 osrm % osrm-contract osrm_network.xml --segment-speed-file tous_liens_vitesse_nulle.csv 
[2023-03-21T10:38:47.381584] [info] Input file: osrm_network.xml.osrm
[2023-03-21T10:38:47.382738] [info] Threads: 4
[2023-03-21T10:38:47.383745] [info] Reading node weights.
[2023-03-21T10:38:47.390509] [info] Done reading node weights.
[2023-03-21T10:38:47.390552] [info] Loading edge-expanded graph representation
[2023-03-21T10:38:47.476584] [info] Loaded tous_liens_vitesse_nulle.csv with 77104values
[2023-03-21T10:38:47.487085] [info] In total loaded 1 file(s) with a total of 37360 unique values
[2023-03-21T10:38:47.492443] [info] Used 0 speeds from LUA profile or input map
[2023-03-21T10:38:47.492506] [info] Used 37360 speeds from tous_liens_vitesse_nulle.csv
[2023-03-21T10:38:47.495440] [info] Updating segment data took 8.18164ms.
[2023-03-21T10:38:47.495961] [info] In total loaded 0 file(s) with a total of 0 unique values
[2023-03-21T10:38:47.502363] [info] Done reading edges in 111.467ms.
[2023-03-21T10:38:47.503366] [info] merged 0 edges out of 0
[2023-03-21T10:38:47.525099] [info] initializing node priorities... ok.
[2023-03-21T10:38:47.532976] [info] preprocessing 23160 (100%) nodes...
[2023-03-21T10:38:47.533083] [info] . 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100% 
[2023-03-21T10:38:47.568992] [info] Converting contracted graph with 0 to edge list (0 bytes)
[2023-03-21T10:38:47.569041] [info] Getting edges of minimized graph . 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
[2023-03-21T10:38:47.573441] [info] Contracted graph has 0 edges.
[2023-03-21T10:38:47.573475] [info] Contraction took 0.070622 sec
[2023-03-21T10:38:47.575632] [info] Preprocessing : 0.191874 seconds
[2023-03-21T10:38:47.575953] [info] finished preprocessing
[2023-03-21T10:38:47.576123] [info] RAM: peak bytes used: 39014400

Then, I have another CSV file that sets the speed to 80 km/h for a few roads.

2611,13846,20
13839,2611,20
13840,13839,20
13813,13840,20
13814,13813,20
13798,13814,20
13797,13798,20
13796,13797,20
13793,13796,20
13792,13793,20
13788,13792,20
3246,13788,20
...

Output:

davidmurray@Davids-MacBook-Pro-2 osrm % osrm-contract osrm_network.xml --segment-speed-file test_net.csv
[2023-03-21T11:12:57.366975] [info] Input file: osrm_network.xml.osrm
[2023-03-21T11:12:57.367974] [info] Threads: 4
[2023-03-21T11:12:57.368928] [info] Reading node weights.
[2023-03-21T11:12:57.369808] [info] Done reading node weights.
[2023-03-21T11:12:57.369832] [info] Loading edge-expanded graph representation
[2023-03-21T11:12:57.392862] [info] Loaded test_net.csv with 5102values
[2023-03-21T11:12:57.393320] [info] In total loaded 1 file(s) with a total of 5102 unique values
[2023-03-21T11:12:57.394917] [info] Used 32258 speeds from LUA profile or input map
[2023-03-21T11:12:57.394933] [info] Used 5102 speeds from test_net.csv
[2023-03-21T11:12:57.396818] [info] Updating segment data took 3.45788ms.
[2023-03-21T11:12:57.396875] [info] In total loaded 0 file(s) with a total of 0 unique values
[2023-03-21T11:12:57.407267] [info] Done reading edges in 37.3087ms.
[2023-03-21T11:12:57.416308] [info] merged 10 edges out of 122424
[2023-03-21T11:12:57.436784] [info] initializing node priorities... ok.
[2023-03-21T11:12:58.577662] [info] preprocessing 23160 (100%) nodes...
[2023-03-21T11:12:58.577721] [info] . 10% . 20% . 30% . 40% . 50% . 60% .[renumbered] 70% . 80% . 90% . 100%
[2023-03-21T11:13:35.318502] [info] Converting contracted graph with 185951 to edge list (4462824 bytes)
[2023-03-21T11:13:35.321054] [info] Getting edges of minimized graph . 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
[2023-03-21T11:13:35.340839] [info] Contracted graph has 185951 edges.
[2023-03-21T11:13:35.340891] [info] Contraction took 37.9327 sec
[2023-03-21T11:13:35.355873] [info] Preprocessing : 37.9864 seconds
[2023-03-21T11:13:35.355927] [info] finished preprocessing
[2023-03-21T11:13:35.356449] [info] RAM: peak bytes used: 46764032

This road network is very discontinuous. Most segments that have a 80 km/h speed aren't connected to anything, so routing should be impossible on large distances

Speeds seem indeed to be mostly null except for a few edges: image image

I would thus expect that OSRM return a NoRoute response for most route queries that I try. However, that is not the case. Notice the very large routing time; OSRM seems to be routing on edges that have a speed of 0 km/h: image

Why is that? Is this a bug? How do I block roads using traffic updates? I've tried CH and MLD routing algorithms but I get the same result.

Thanks! David

Specifications

  • osrm-backend version being used: 5.28.0
  • OSM extract that was processed: montreal area
  • Processing commands (e.g. CH vs MLD processing): CH or MLD. Same result for both.
  • Server queries
  • Library/dependency versions
  • Operating system: macOS
  • Hardware: macOS

davidmurray avatar Mar 21 '23 15:03 davidmurray