-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Check conditional restrictions
osrm-extract-conditionals deprecated since begin of 2018. Now proper commands are:
osrm-extract --parse-conditional-restrictions
osrm-contract --parse-conditionals-from-now 1517908115 --time-zone-file tz.json
For more information see: https://github.com/Project-OSRM/osrm-backend/issues/4852
The tool osrm-extract-conditionals
requires Boost library version 1.61, Shapefile library that can be installed as
sudo apt install libshp-dev
and OSRM configured with BUILD_TOOLS
cmake -DBUILD_TOOLS=ON ..
make osrm-extract-conditionals
The boundaries of the TZ timezones can be downloaded at http://efele.net/maps/tz
wget http://efele.net/maps/tz/world/tz_world.zip
unzip tz_world.zip
cond-dump
command parses OSM files and prints for all entries that match ^restriction.*:conditional$
key filter information about a conditional restriction in CSV format
from node ID, via node ID, to node ID, restriction key, restriction value, restriction condition, via node longitude, via node latitude
For example
./osrm-extract-conditionals cond-dump germany-latest.osm.pbf germany-latest-conditional-restrictions.csv
cat germany-latest-conditional-restrictions.csv
430861962,248107503,430861962,restriction:conditional,only_right_turn,"Mo-Fr 07:00-14:00",11.8998,48.2981
430861962,248107503,259559644,restriction:conditional,only_right_turn,"Mo-Fr 07:00-14:00",11.8998,48.2981
1993750940,295240874,1887880751,restriction:conditional,no_left_turn,"length > 10 m",9.28557,54.1491
190825610,270366027,1887880762,restriction:conditional,no_left_turn,"length > 10 m",9.28605,54.1493
1599058982,2579268944,3279128675,restriction:conditional,no_left_turn,"length>6.5",8.40348,49.0039
456899478,33479072,2703996623,restriction:motorcar:conditional,no_right_turn,"Mo-Fr 7:00-13:30",8.6939,50.012
344868349,33479072,2703996623,restriction:motorcar:conditional,no_left_turn,"Mo-Fr 7:00-13:30",8.6939,50.012
3618341256,54829170,3618341256,restriction:conditional,no_u_turn,"weight > 3.5",9.16044,48.8143
4179676321,1299507474,4179676321,restriction:motor_vehicle:conditional,only_right_turn,"Th-Su 20:00-06:00",9.17847,48.7814
4179676321,1299507474,4176177877,restriction:motor_vehicle:conditional,only_right_turn,"Th-Su 20:00-06:00",9.17847,48.7814
290117155,76652395,290117155,restriction:motor_vehicle:conditional,only_straight_on,"Th-Su 20:00-06:00",9.17475,48.7779
290117155,76652395,3771705272,restriction:motor_vehicle:conditional,only_straight_on,"Th-Su 20:00-06:00",9.17475,48.7779
1054703312,1299507474,1054703312,restriction:motor_vehicle:conditional,only_left_turn,"Th-Su 20:00-06:00",9.17847,48.7814
1054703312,1299507474,4176177877,restriction:motor_vehicle:conditional,only_left_turn,"Th-Su 20:00-06:00",9.17847,48.7814
1437395523,1667590756,1667590753,restriction:motor_vehicle:conditional,no_straight_on,"2016 May 16-2016 Jun 16",10.2086,53.4903
The CSV file created with the cond-dump
command contains conditions in opening hours format. These values can be resolved with the cond-check
command for the given UTC time point:
./osrm-extract-conditionals cond-check germany-latest-conditional-restrictions.csv germany-latest-conditional-restrictions-resolved.csv --tz-shapes world/tz_world --utc 1488194000 --value 16000
[warn] Condition parsing failed for "length > 10 m" at the turn 1993750940 -> 295240874 -> 1887880751
[warn] Condition parsing failed for "length > 10 m" at the turn 190825610 -> 270366027 -> 1887880762
[warn] Condition parsing failed for "length>6.5" at the turn 1599058982 -> 2579268944 -> 3279128675
[warn] Condition parsing failed for "Mo-Fr 7:00-13:30" at the turn 456899478 -> 33479072 -> 2703996623
[warn] Condition parsing failed for "Mo-Fr 7:00-13:30" at the turn 344868349 -> 33479072 -> 2703996623
[warn] Condition parsing failed for "weight > 3.5" at the turn 3618341256 -> 54829170 -> 3618341256
cat germany-latest-conditional-restrictions-resolved.csv
430861962,248107503,430861962,16000
430861962,248107503,259559644,16000