-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Check conditional restrictions
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
I think this page is obsolete. I add few commet since I tried to compile OSMR recently using Codeblocks 20.03 on Windows 10. What I found was that
Several extra libraries ave to be installed like BZip2, lua. I was using MSYS2 so I did, pacman -S mingw-w64-x86_64-bzip2 pacman -S mingw-w64-x86_64-lua pacman -S mingw-w64-x86_64-zlib
instal Intell tbb https://github.com/oneapi-src/oneTBB/releases Extract it to a folder (e.g., C:\tbb).
Ensure to add TBB Path to CMake Command and that the bin folder of MinGW or MSYS2 (e.g., C:\msys64\mingw64\bin) is added to your system PATH environment variable.
Then in osrm-backend\build run
cmake -G "CodeBlocks - MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DTBB_INCLUDE_DIR="C:/tbb/include" -DTBB_LIBRARY="C:/tbb/lib/intel64/gcc4.8/libtbb.so"
cmake -G "CodeBlocks - MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fno-lto -mconsole" -DCMAKE_EXE_LINKER_FLAGS="-Wl,-e,mainCRTStartup"
It may be enough to compile.
However for some compilation problems I add to do
- remove "-Werror # Treat all warnings like error" in a CMakeLists.txt file
- add in shared_memory.hcp in line 208: (void)lock_file; // This explicitly marks lock_file as used to avoid warning of unused variable
- to avoid an Link Time Optimization (LTO) error run cmake -G "CodeBlocks - MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DIPO=OFF
- put OFF in option(ENABLE_LTO "Use Link Time Optimisation" OFF) and I add set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) in Cmake
I finally gave up because of Windows console incompatibility (Winmain not found) without knowing the reason even after having, In codebleocks Project properties, Built target, type put Console application