Compare commits

..

2 Commits

Author SHA1 Message Date
Daniel Patterson 9912b26b32 Final release. 2017-09-11 09:25:24 -07:00
Daniel Patterson 838b2a750e Create release branch for 5.12 2017-09-05 12:44:25 -07:00
444 changed files with 14458 additions and 28108 deletions
-2
View File
@@ -1,2 +0,0 @@
test
build
+2 -8
View File
@@ -2,18 +2,12 @@
What issue is this PR targeting? If there is no issue that addresses the problem, please open a corresponding issue and link it here. What issue is this PR targeting? If there is no issue that addresses the problem, please open a corresponding issue and link it here.
Please read our [documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/releasing.md) on release and version management.
If your PR is still work in progress please attach the relevant label.
## Tasklist ## Tasklist
- [ ] ADD OWN TASKS HERE
- [ ] CHANGELOG.md entry ([How to write a changelog entry](http://keepachangelog.com/en/1.0.0/#how))
- [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki) - [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki)
- [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md) - [ ] add regression / cucumber cases (see docs/testing.md)
- [ ] review - [ ] review
- [ ] adjust for comments - [ ] adjust for comments
- [ ] cherry pick to release branch
## Requirements / Relations ## Requirements / Relations
Link any requirements here. Other pull requests this PR is based on? Link any requirements here. Other pull requests this PR is based on?
+92 -96
View File
@@ -13,9 +13,9 @@ notifications:
branches: branches:
only: only:
- master - master
- "5.16"
# enable building tags # enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
- 5.12
cache: cache:
yarn: true yarn: true
@@ -65,47 +65,38 @@ matrix:
after_success: after_success:
- os: linux - os: linux
compiler: "gcc-7-debug-cov" compiler: "gcc-6-debug-cov"
addons: &gcc7 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'lcov'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000 env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
before_script:
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --zerocounters # clean cached da files
after_success: after_success:
# Creating report - bash <(curl -s https://codecov.io/bash)
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --capture --output-file coverage.info # capture coverage info
- lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
- lcov --list coverage.info #debug info
# Uploading report to CodeCov
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
- os: linux - os: linux
compiler: "gcc-7-debug-asan" compiler: "gcc-6-debug-asan"
addons: &gcc7 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf" env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000
- os: linux - os: linux
compiler: "clang-5.0-debug" compiler: "clang-4.0-debug"
addons: &clang50 addons: &clang40
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000 env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
- os: linux - os: linux
compiler: "mason-linux-debug-asan" compiler: "mason-linux-debug-asan"
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON
# Release Builds # Release Builds
- os: linux - os: linux
@@ -113,71 +104,81 @@ matrix:
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
- os: linux
compiler: "gcc-7-release"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
- os: linux
compiler: "gcc-7-release-i686"
env: >
TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
- os: linux
compiler: "gcc-7-stxxl"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' ENABLE_STXXL=On
- os: linux
compiler: "gcc-5-release"
addons: &gcc49
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
- os: linux - os: linux
compiler: "gcc-6-release" compiler: "gcc-6-release"
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: linux
compiler: "gcc-6-release-i686"
env: >
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
- os: linux
compiler: "gcc-6-stxxl"
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' ENABLE_STXXL=On
- os: linux
compiler: "gcc-4.9-release"
addons: &gcc49 addons: &gcc49
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache'] packages: ['g++-4.9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release'
- os: osx - os: osx
osx_image: xcode9.2 osx_image: xcode8.2
compiler: "mason-osx-release-node-8" compiler: "mason-osx-release"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8"
after_success:
- ./scripts/travis/publish.sh
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-4"
# we use the xcode provides clang and don't install our own # we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="4" env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="4"
after_success: after_success:
- ./scripts/travis/publish.sh - ./scripts/travis/publish.sh
- os: osx
osx_image: xcode8.2
compiler: "mason-osx-release"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="6"
after_success:
- ./scripts/travis/publish.sh
# Disabled because of CI slowness
#- os: linux
#- compiler: clang
#- addons: &clang40
#- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
#- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
# Shared Library # Shared Library
- os: linux - os: linux
compiler: "gcc-7-release-shared" compiler: "gcc-6-release-shared"
addons: &gcc7 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Disabled because CI slowness
#- os: linux
#- compiler: clang
#- addons: &clang40
#- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
#- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests. # Node build jobs. These skip running the tests.
- os: linux - os: linux
@@ -186,8 +187,8 @@ matrix:
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@@ -195,8 +196,7 @@ matrix:
-DENABLE_MASON=${ENABLE_MASON:-OFF} \ -DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS} - make --jobs=${JOBS}
- popd - popd
script: script:
@@ -206,12 +206,12 @@ matrix:
- os: linux - os: linux
sudo: false sudo: false
compiler: "node-4-mason-linux-debug" compiler: "node-4-mason-linux-release"
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@@ -219,8 +219,7 @@ matrix:
-DENABLE_MASON=${ENABLE_MASON:-OFF} \ -DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS} - make --jobs=${JOBS}
- popd - popd
script: script:
@@ -230,12 +229,12 @@ matrix:
- os: linux - os: linux
sudo: false sudo: false
compiler: "node-8-mason-linux-release" compiler: "node-6-mason-linux-release"
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@@ -243,8 +242,7 @@ matrix:
-DENABLE_MASON=${ENABLE_MASON:-OFF} \ -DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS} - make --jobs=${JOBS}
- popd - popd
script: script:
@@ -254,12 +252,12 @@ matrix:
- os: linux - os: linux
sudo: false sudo: false
compiler: "node-8-mason-linux-debug" compiler: "node-6-mason-linux-release"
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8" env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
install: install:
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- | - |
@@ -267,8 +265,7 @@ matrix:
-DENABLE_MASON=${ENABLE_MASON:-OFF} \ -DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS} - make --jobs=${JOBS}
- popd - popd
script: script:
@@ -342,8 +339,7 @@ install:
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \ -DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
-DBUILD_TOOLS=ON \ -DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
- echo "travis_fold:start:MAKE" - echo "travis_fold:start:MAKE"
- make --jobs=${JOBS} - make --jobs=${JOBS}
- make tests --jobs=${JOBS} - make tests --jobs=${JOBS}
@@ -365,7 +361,7 @@ install:
script: script:
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi - if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
- make -C test/data benchmark - make -C test/data benchmark
- ./example/build/osrm-example test/data/mld/monaco.osrm - ./example/build/osrm-example test/data/ch/monaco.osrm
# All tests assume to be run from the build directory # All tests assume to be run from the build directory
- pushd ${OSRM_BUILD_DIR} - pushd ${OSRM_BUILD_DIR}
- ./unit_tests/library-tests - ./unit_tests/library-tests
@@ -374,7 +370,7 @@ script:
- ./unit_tests/engine-tests - ./unit_tests/engine-tests
- ./unit_tests/util-tests - ./unit_tests/util-tests
- ./unit_tests/server-tests - ./unit_tests/server-tests
- ./unit_tests/partitioner-tests - ./unit_tests/partition-tests
- | - |
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
npm run nodejs-tests npm run nodejs-tests
+2 -142
View File
@@ -1,145 +1,5 @@
# 5.16.2
- Changes from 5.16.1:
- Bugfixes:
- FIXED #4920: Use smaller range for U-turn angles in map-matching [#4920](https://github.com/Project-OSRM/osrm-backend/pull/4920)
# 5.16.1
- Changes from 5.16.0:
- Bugfixes
- FIXED #4909: deduplication of route steps when waypoints are used [#4909](https://github.com/Project-OSRM/osrm-backend/issues/4909)
# 5.16.0
- Changes from 5.15.2:
- Guidance
- ADDED #4676: Support for maneuver override relation, allowing data-driven overrides for turn-by-turn instructions [#4676](https://github.com/Project-OSRM/osrm-backend/pull/4676)
- CHANGED #4830: Announce reference change if names are empty
- CHANGED #4835: MAXIMAL_ALLOWED_SEPARATION_WIDTH increased to 12 meters
- CHANGED #4842: Lower priority links from a motorway now are used as motorway links [#4842](https://github.com/Project-OSRM/osrm-backend/pull/4842)
- CHANGED #4895: Use ramp bifurcations as fork intersections [#4895](https://github.com/Project-OSRM/osrm-backend/issues/4895)
- CHANGED #4893: Handle motorway forks with links as normal motorway intersections[#4893](https://github.com/Project-OSRM/osrm-backend/issues/4893)
- FIXED #4905: Check required tags of `maneuver` relations [#4905](https://github.com/Project-OSRM/osrm-backend/pull/4905)
- Profile:
- FIXED: `highway=service` will now be used for restricted access, `access=private` is still disabled for snapping.
- ADDED #4775: Exposes more information to the turn function, now being able to set turn weights with highway and access information of the turn as well as other roads at the intersection [#4775](https://github.com/Project-OSRM/osrm-backend/issues/4775)
- FIXED #4763: Add support for non-numerical units in car profile for maxheight [#4763](https://github.com/Project-OSRM/osrm-backend/issues/4763)
- ADDED #4872: Handling of `barrier=height_restrictor` nodes [#4872](https://github.com/Project-OSRM/osrm-backend/pull/4872)
# 5.15.2
- Changes from 5.15.1:
- Features:
- ADDED: Exposed the waypoints parameter in the node bindings interface
- Bugfixes:
- FIXED: Segfault causing bug in leg collapsing map matching when traversing edges in reverse
# 5.15.1
- Changes from 5.15.0:
- Bugfixes:
- FIXED: Segfault in map matching when RouteLeg collapsing code is run on a match with multiple submatches
- Guidance:
- Set type of trivial intersections where classes change to Suppressed instead of NoTurn
# 5.15.0
- Changes from 5.14.3:
- Bugfixes:
- FIXED #4704: Fixed regression in bearings reordering introduced in 5.13 [#4704](https://github.com/Project-OSRM/osrm-backend/issues/4704)
- FIXED #4781: Fixed overflow exceptions in percent-encoding parsing
- FIXED #4770: Fixed exclude flags for single toll road scenario
- FIXED #4283: Fix overflow on zero duration segments
- FIXED #4804: Ignore no_*_on_red turn restrictions
- Guidance:
- CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706)
- CHANGED #3491: Refactor `isThroughStreet`/Intersection options
- Profile:
- ADDED: `tunnel` as a new class in car profile so that sections of the route with tunnel tags will be marked as such
# 5.14.3
- Changes from 5.14.2:
- Features:
- Added a `waypoints` parameter to the match service plugin that accepts indices to input coordinates and treats only those points as waypoints in the response format.
- Bugfixes:
- FIXED #4754: U-Turn penalties are applied to straight turns.
- FIXED #4756: Removed too restrictive road name check in the sliproad handler
- FIXED #4731: Use correct weights for edge-based graph duplicated via nodes.
- Profile:
- CHANGED: added Belarus speed limits
- CHANGED: set default urban speed in Ukraine to 50kmh
# 5.14.2
- Changes from 5.14.1:
- Bugfixes:
- FIXED #4727: Erroring when a old .core file is present.
- FIXED #4642: Update checks for EMPTY_NAMEID to check for empty name strings
- FIXED #4738: Fix potential segmentation fault
- Node.js Bindings:
- ADDED: Exposed new `max_radiuses_map_matching` option from `EngingConfig` options
- Tools:
- ADDED: New osrm-routed `max_radiuses_map_matching` command line flag to optionally set a maximum radius for map matching
# 5.14.1
- Changes from 5.14.0
- Bugfixes:
- FIXED: don't use removed alternative candidates in `filterPackedPathsByCellSharing`
# 5.14.0
- Changes from 5.13
- API:
- ADDED: new RouteStep property `driving_side` that has either "left" or "right" for that step
- Misc:
- ADDED: Bundles a rough (please improve!) driving-side GeoJSON file for use with `osrm-extract --location-dependent-data data/driving_side.geojson`
- CHANGED: Conditional turn parsing is disabled by default now
- ADDED: Adds a tool to analyze turn instruction generation in a dataset. Useful for tracking turn-by-turn heuristic changes over time.
- CHANGED: Internal refactoring of guidance code as a first step towards a re-runnable guidance pipeline
- ADDED: Now publishing Node 8.x LTS binary modules
- Profile:
- CHANGED: Remove dependency on turn types and turn modifier in the process_turn function in the `car.lua` profile. Guidance instruction types are not used to influence turn penalty anymore so this will break backward compatibility between profile version 3 and 4.
- Guidance:
- ADDED: New internal flag on "segregated intersections" - in the future, will should allow collapsing of instructions across complex intersection geometry where humans only perceive a single maneuver
- CHANGED: Decrease roundabout turn radius threshold from 25m to 15m - adds some "exit the roundabout" instructions for moderately sized roundabouts that were being missed previously
- Docker:
- CHANGED: switch to alpine 3.6, and use a multistage build to reduce image size
- Build:
- FIX: use LUA_LIBRARY_DIRS to propertly detect Lua on all platforms
- Docs:
- FIX: clarify description of roundabout exit instructions
- Bugfixes:
- FIXED: Fix bug where merge instructions got the wrong direction modifier ([PR #4670](https://github.com/Project-OSRM/osrm-backend/pull/4670))
- FIXED: Properly use the `profile.properties.left_hand_driving` property, there was a typo that meant it had no effect
- FIXED: undefined behaviour when alternative candidate via node is same as source node ([#4691](https://github.com/Project-OSRM/osrm-backend/issues/4691))
- FIXED: ensure libosrm.pc is pushed to the correct location for pkgconfig to find it on all platforms
- FIXED: don't consider empty names + empty refs as a valid name for u-turns
# 5.13.0
- Changes from 5.12:
- Profile:
- Append cardinal directions from route relations to ref fields to improve instructions; off by default see `profile.cardinal_directions`
- Support of `distance` weight in foot and bicycle profiles
- Support of relations processing
- Added `way:get_location_tag(key)` method to get location-dependent tags https://github.com/Project-OSRM/osrm-backend/wiki/Using-location-dependent-data-in-profiles
- Added `forward_ref` and `backward_ref` support
- Left-side driving mode is specified by a local Boolean flag `is_left_hand_driving` in `ExtractionWay` and `ExtractionTurn`
- Support literal values for maxspeeds in NO, PL and ZA
- Infrastructure:
- Lua 5.1 support is removed due to lack of support in sol2 https://github.com/ThePhD/sol2/issues/302
- Fixed pkg-config version of OSRM
- Removed `.osrm.core` file since CoreCH is deprecated now.
- Tools:
- Because of boost/program_options#32 with boost 1.65+ we needed to change the behavior of the following flags to not accept `={true|false}` anymore:
- `--use-locations-cache=false` becomes `--disable-location-cache`
- `--parse-conditional-restrictions=true` becomes `--parse-conditional-restrictions`
- The deprecated options `--use-level-cache` and `--generate-edge-lookup`
- Bugfixes:
- Fixed #4348: Some cases of sliproads pre-processing were broken
- Fixed #4331: Correctly compute left/right modifiers of forks in case the fork is curved.
- Fixed #4472: Correctly count the number of lanes using the delimter in `turn:lanes` tag.
- Fixed #4214: Multiple runs of `osrm-partition` lead to crash.
- Fixed #4348: Fix assorted problems around slip roads.
- Fixed #4420: A bug that would result in unnecessary instructions, due to problems in suffix/prefix detection
- Algorithm
- Deprecate CoreCH functionality. Usage of CoreCH specific options will fall back to using CH with core_factor of 1.0
- MLD uses a unidirectional Dijkstra for 1-to-N and N-to-1 matrices which yields speedup.
# 5.12.0 # 5.12.0
- Changes from 5.11: - Changes from 5.11.0
- Guidance - Guidance
- now announcing turning onto oneways at the end of a road (e.g. onto dual carriageways) - now announcing turning onto oneways at the end of a road (e.g. onto dual carriageways)
- Adds new instruction types at the exit of roundabouts and rotaries `exit roundabout` and `exit rotary`. - Adds new instruction types at the exit of roundabouts and rotaries `exit roundabout` and `exit rotary`.
@@ -202,7 +62,7 @@
- Bugfixes - Bugfixes
- Properly save/retrieve datasource annotations for road segments ([#4346](https://github.com/Project-OSRM/osrm-backend/issues/4346) - Properly save/retrieve datasource annotations for road segments ([#4346](https://github.com/Project-OSRM/osrm-backend/issues/4346)
- Fix conditional restriction grammer parsing so it works for single-day-of-week restrictions ([#4357](https://github.com/Project-OSRM/osrm-backend/pull/4357)) - Fix conditional restriction grammer parsing so it works for single-day-of-week restrictions ([#4357](https://github.com/Project-OSRM/osrm-backend/pull/4357))
- Algorithm - Algorithm)
- BREAKING: the file format requires re-processing due to the changes on via-ways - BREAKING: the file format requires re-processing due to the changes on via-ways
- Added support for via-way restrictions - Added support for via-way restrictions
+72 -54
View File
@@ -31,18 +31,18 @@ option(ENABLE_LTO "Use LTO if available" OFF)
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF) option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON) option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF) option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(ENABLE_MASON) if(ENABLE_MASON)
# versions in use # versions in use
set(MASON_BOOST_VERSION "1.65.1") set(MASON_BOOST_VERSION "1.63.0")
set(MASON_STXXL_VERSION "1.4.1-1") set(MASON_STXXL_VERSION "1.4.1-1")
set(MASON_EXPAT_VERSION "2.2.0") set(MASON_EXPAT_VERSION "2.2.0")
set(MASON_LUA_VERSION "5.2.4") set(MASON_LUA_VERSION "5.2.4")
set(MASON_BZIP2_VERSION "1.0.6") set(MASON_BZIP2_VERSION "1.0.6")
set(MASON_TBB_VERSION "2017_U7") set(MASON_TBB_VERSION "2017_U7")
set(MASON_LIBSHP_VERSION "1.3.0")
message(STATUS "Enabling mason") message(STATUS "Enabling mason")
@@ -60,8 +60,8 @@ if (POLICY CMP0048)
endif() endif()
project(OSRM C CXX) project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5) set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 16) set(OSRM_VERSION_MINOR 12)
set(OSRM_VERSION_PATCH 2) set(OSRM_VERSION_PATCH 0)
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}") set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
@@ -101,10 +101,10 @@ if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)") message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif() endif()
# Strictly require GCC>=5.0 and Clang>=3.4 - GCC 4.8 is already too old for C++14. # Strictly require GCC>=4.9 and Clang>=3.4 - GCC 4.8 is already too old for C++14.
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR "GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test") message(FATAL_ERROR "GCC>=4.9 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test")
endif() endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
@@ -125,8 +125,7 @@ configure_file(
) )
file(GLOB UtilGlob src/util/*.cpp src/util/*/*.cpp) file(GLOB UtilGlob src/util/*.cpp src/util/*/*.cpp)
file(GLOB ExtractorGlob src/extractor/*.cpp src/extractor/*/*.cpp) file(GLOB ExtractorGlob src/extractor/*.cpp src/extractor/*/*.cpp)
file(GLOB GuidanceGlob src/guidance/*.cpp src/extractor/intersection/*.cpp) file(GLOB PartitionerGlob src/partition/*.cpp)
file(GLOB PartitionerGlob src/partitioner/*.cpp)
file(GLOB CustomizerGlob src/customize/*.cpp) file(GLOB CustomizerGlob src/customize/*.cpp)
file(GLOB ContractorGlob src/contractor/*.cpp) file(GLOB ContractorGlob src/contractor/*.cpp)
file(GLOB UpdaterGlob src/updater/*.cpp) file(GLOB UpdaterGlob src/updater/*.cpp)
@@ -137,7 +136,6 @@ file(GLOB ErrorcodesGlob src/osrm/errorcodes.cpp)
add_library(UTIL OBJECT ${UtilGlob}) add_library(UTIL OBJECT ${UtilGlob})
add_library(EXTRACTOR OBJECT ${ExtractorGlob}) add_library(EXTRACTOR OBJECT ${ExtractorGlob})
add_library(GUIDANCE OBJECT ${GuidanceGlob})
add_library(PARTITIONER OBJECT ${PartitionerGlob}) add_library(PARTITIONER OBJECT ${PartitionerGlob})
add_library(CUSTOMIZER OBJECT ${CustomizerGlob}) add_library(CUSTOMIZER OBJECT ${CustomizerGlob})
add_library(CONTRACTOR OBJECT ${ContractorGlob}) add_library(CONTRACTOR OBJECT ${ContractorGlob})
@@ -157,9 +155,8 @@ add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>)
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:STORAGE>) add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:STORAGE>)
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>) add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_extract src/osrm/extractor.cpp $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>) add_library(osrm_extract src/osrm/extractor.cpp $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_guidance $<TARGET_OBJECTS:GUIDANCE> $<TARGET_OBJECTS:UTIL>) add_library(osrm_partition $<TARGET_OBJECTS:PARTITIONER> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_partition src/osrm/partitioner.cpp $<TARGET_OBJECTS:PARTITIONER> $<TARGET_OBJECTS:UTIL>) add_library(osrm_customize $<TARGET_OBJECTS:CUSTOMIZER> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_customize src/osrm/customizer.cpp $<TARGET_OBJECTS:CUSTOMIZER> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:UTIL>) add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:UTIL>) add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:UTIL>)
@@ -214,19 +211,19 @@ endif()
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "Configuring debug mode flags") message(STATUS "Configuring debug mode flags")
set(ENABLE_ASSERTIONS ON) set(ENABLE_ASSERTIONS ON)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-omit-frame-pointer")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
else()
# Don't override the -O parameter for RelWithDebInfo, we want an optimized build
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
endif()
endif()
endif()
endif() endif()
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fno-inline -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -fno-omit-frame-pointer")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
endif()
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "Configuring release mode optimizations") message(STATUS "Configuring release mode optimizations")
# Check if LTO is available # Check if LTO is available
@@ -258,7 +255,8 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
endif() endif()
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools # Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT MINGW) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" AND NOT MINGW)
find_program(GCC_AR gcc-ar) find_program(GCC_AR gcc-ar)
find_program(GCC_RANLIB gcc-ranlib) find_program(GCC_RANLIB gcc-ranlib)
if ("${GCC_AR}" STREQUAL "GCC_AR-NOTFOUND" OR "${GCC_RANLIB}" STREQUAL "GCC_RANLIB-NOTFOUND") if ("${GCC_AR}" STREQUAL "GCC_AR-NOTFOUND" OR "${GCC_RANLIB}" STREQUAL "GCC_RANLIB-NOTFOUND")
@@ -286,6 +284,12 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
set(CMAKE_RANLIB ${LLVM_RANLIB}) set(CMAKE_RANLIB ${LLVM_RANLIB})
endif() endif()
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0")
message(STATUS "Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038")
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
set(ENABLE_LTO Off)
endif()
endif() endif()
endif() endif()
@@ -299,11 +303,10 @@ if (ENABLE_COVERAGE)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build") message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
endif() endif()
message(STATUS "Enabling coverage") message(INFO "Enabling coverage")
set(MAYBE_COVERAGE_LIBRARIES "-lgcov") set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ftest-coverage -fprofile-arcs") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
endif() endif()
if (ENABLE_SANITIZER) if (ENABLE_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address") set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address")
@@ -312,9 +315,8 @@ if (ENABLE_SANITIZER)
endif() endif()
# Configuring compilers # Configuring compilers
set(OSRM_WARNING_FLAGS "-Werror=all -Werror=extra -Werror=uninitialized -Werror=unreachable-code -Werror=unused-variable -Werror=unreachable-code -Wno-error=cpp -Wpedantic")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=2 -Wno-error=unused-local-typedef -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024 -Wno-unused-command-line-argument") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024 -Wno-unused-command-line-argument")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(COLOR_FLAG "-fdiagnostics-color=auto") set(COLOR_FLAG "-fdiagnostics-color=auto")
check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG) check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
@@ -322,8 +324,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(COLOR_FLAG "") set(COLOR_FLAG "")
endif() endif()
# using GCC # using GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=1 -Wno-error=maybe-uninitialized -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=1 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024")
if(WIN32) # using mingw if(WIN32) # using mingw
add_dependency_defines(-DWIN32) add_dependency_defines(-DWIN32)
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32) set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
@@ -378,8 +379,8 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# Activate C++1y # Activate C++1y
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++14") set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++1y")
endif() endif()
# Configuring other platform dependencies # Configuring other platform dependencies
@@ -516,10 +517,29 @@ else()
find_package(BZip2 REQUIRED) find_package(BZip2 REQUIRED)
add_dependency_includes(${BZIP2_INCLUDE_DIR}) add_dependency_includes(${BZIP2_INCLUDE_DIR})
find_package(Lua 5.2 REQUIRED) FIND_PACKAGE(Lua 5.2 EXACT)
if (LUA_FOUND) IF (LUA_FOUND)
message(STATUS "Using Lua ${LUA_VERSION_STRING}") MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
endif() ELSE()
FIND_PACKAGE(Lua 5.1 EXACT)
IF (LUA_FOUND)
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
ELSE()
# Now fall back to a lua verison without exact
# in case this cmake version also forces patch versions
FIND_PACKAGE(Lua 5.2)
IF (LUA_FOUND)
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
ELSE()
FIND_PACKAGE(Lua 5.1)
IF (LUA_FOUND)
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
ELSE()
MESSAGE(FATAL_ERROR "Lua 5.1 or 5.2 was not found.")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES}) set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
add_dependency_includes(${LUA_INCLUDE_DIR}) add_dependency_includes(${LUA_INCLUDE_DIR})
@@ -621,12 +641,6 @@ set(EXTRACTOR_LIBRARIES
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
set(GUIDANCE_LIBRARIES
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES}
${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES})
set(PARTITIONER_LIBRARIES set(PARTITIONER_LIBRARIES
${BOOST_ENGINE_LIBRARIES} ${BOOST_ENGINE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
@@ -673,14 +687,13 @@ set(UTIL_LIBRARIES
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${MAYBE_STXXL_LIBRARY} ${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES} ${MAYBE_COVERAGE_LIBRARIES})
${ZLIB_LIBRARY})
# Libraries # Libraries
target_link_libraries(osrm ${ENGINE_LIBRARIES}) target_link_libraries(osrm ${ENGINE_LIBRARIES})
target_link_libraries(osrm_update ${UPDATER_LIBRARIES}) target_link_libraries(osrm_update ${UPDATER_LIBRARIES})
target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES} osrm_update osrm_store) target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES} osrm_update osrm_store)
target_link_libraries(osrm_extract osrm_guidance ${EXTRACTOR_LIBRARIES}) target_link_libraries(osrm_extract ${EXTRACTOR_LIBRARIES})
target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES}) target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES})
target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store) target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store)
target_link_libraries(osrm_store ${STORAGE_LIBRARIES}) target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
@@ -696,6 +709,15 @@ if(BUILD_TOOLS)
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES}) target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES})
install(TARGETS osrm-io-benchmark DESTINATION bin) install(TARGETS osrm-io-benchmark DESTINATION bin)
find_package(Shapefile)
if(SHAPEFILE_FOUND AND (Boost_VERSION VERSION_GREATER 106000 OR ENABLE_MASON))
add_executable(osrm-extract-conditionals src/tools/extract-conditionals.cpp $<TARGET_OBJECTS:UTIL>)
target_include_directories(osrm-extract-conditionals PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR})
target_link_libraries(osrm-extract-conditionals ${OSMIUM_LIBRARIES} ${BOOST_BASE_LIBRARIES} ${Boost_PROGRAM_OPTIONS_LIBRARY}
${UTIL_LIBRARIES} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARY} ${EXPAT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS osrm-extract-conditionals DESTINATION bin)
endif()
endif() endif()
if (ENABLE_ASSERTIONS) if (ENABLE_ASSERTIONS)
@@ -718,14 +740,14 @@ file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp) set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/bearing.hpp) set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/bearing.hpp)
set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp) set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
set(PartitionerHeader include/partitioner/partitioner.hpp include/partitioner/partitioner_config.hpp) set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp)
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp) set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
set(StorageHeader include/storage/storage.hpp include/storage/io_config.hpp include/storage/storage_config.hpp) set(StorageHeader include/storage/storage.hpp include/storage/io_config.hpp include/storage/storage_config.hpp)
install(FILES ${EngineHeader} DESTINATION include/osrm/engine) install(FILES ${EngineHeader} DESTINATION include/osrm/engine)
install(FILES ${UtilHeader} DESTINATION include/osrm/util) install(FILES ${UtilHeader} DESTINATION include/osrm/util)
install(FILES ${StorageHeader} DESTINATION include/osrm/storage) install(FILES ${StorageHeader} DESTINATION include/osrm/storage)
install(FILES ${ExtractorHeader} DESTINATION include/osrm/extractor) install(FILES ${ExtractorHeader} DESTINATION include/osrm/extractor)
install(FILES ${PartitionerHeader} DESTINATION include/osrm/partitioner) install(FILES ${PartitionerHeader} DESTINATION include/osrm/partition)
install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor) install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
install(FILES ${LibraryGlob} DESTINATION include/osrm) install(FILES ${LibraryGlob} DESTINATION include/osrm)
install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api) install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
@@ -791,7 +813,7 @@ JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig) install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# uninstall target # uninstall target
configure_file( configure_file(
@@ -807,10 +829,6 @@ add_custom_target(uninstall
add_subdirectory(unit_tests) add_subdirectory(unit_tests)
add_subdirectory(src/benchmarks) add_subdirectory(src/benchmarks)
if (ENABLE_GLIBC_WORKAROUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLIBC_WORKAROUND")
endif()
if (ENABLE_NODE_BINDINGS) if (ENABLE_NODE_BINDINGS)
add_subdirectory(src/nodejs) add_subdirectory(src/nodejs)
endif() endif()
-3
View File
@@ -1,3 +0,0 @@
# Code of conduct
Everyone is invited to participate in Project OSRMs open source projects and public discussions: we want to create a welcoming and friendly environment. Harassment of participants or other unethical and unprofessional behavior will not be tolerated in our spaces. The [Contributor Covenant](http://contributor-covenant.org) applies to all projects under the Project-OSRM organization and we ask that you please read [the full text](http://contributor-covenant.org/version/1/2/0/).
+1 -5
View File
@@ -1,12 +1,8 @@
# Everyone
Please take some time to review our [code of conduct](CODE-OF-CONDUCT.md) to help guide your interactions with others on this project.
# User # User
Before you open a new issue, please search for older ones that cover the same issue. Before you open a new issue, please search for older ones that cover the same issue.
In general "me too" comments/issues are frowned upon. In general "me too" comments/issues are frowned upon.
You can add a :+1: emoji reaction to the issue if you want to express interest in this. You can add a :+1: emoji to the issue if you want to express interest in this.
# Developer # Developer
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
+27 -23
View File
@@ -19,6 +19,7 @@ To quickly try OSRM use our [demo server](http://map.project-osrm.org) which com
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [this guide about mapping for navigation](https://www.mapbox.com/mapping/mapping-for-navigation/). For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [this guide about mapping for navigation](https://www.mapbox.com/mapping/mapping-for-navigation/).
Related [Project-OSRM](https://github.com/Project-OSRM) repositories: Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
- [node-osrm](https://www.npmjs.com/package/osrm) - Production-ready NodeJs bindings for the routing engine
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend - [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response - [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
- [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images - [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images
@@ -40,14 +41,6 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
The easiest and quickest way to setup your own routing engine is to use Docker images we provide. The easiest and quickest way to setup your own routing engine is to use Docker images we provide.
There are two pre-processing pipelines available:
- Contraction Hierarchies (CH)
- Multi-Level Dijkstra (MLD)
we recommend using MLD by default except for special use-cases such as very large distance matrices where CH is still a better fit for the time being.
In the following we explain the MLD pipeline.
If you want to use the CH pipeline instead replace `osrm-partition` and `osrm-customize` with a single `osrm-contract` and change the algorithm option for `osrm-routed` to `--algorithm ch`.
### Using Docker ### Using Docker
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible. We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
@@ -59,15 +52,9 @@ Download OpenStreetMap extracts for example from [Geofabrik](http://download.geo
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000 Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-contract /data/berlin-latest.osrm
The flag `-v $(pwd):/data` creates the directory `/data` inside the docker container and makes the current working directory `$(pwd)` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `$(pwd)/berlin-latest.osm.pbf` on the host. docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed /data/berlin-latest.osrm
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
Note that `berlin-latest.osrm` has a different file extension.
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
Make requests against the HTTP server Make requests against the HTTP server
@@ -103,8 +90,8 @@ Install dependencies
```bash ```bash
sudo apt install build-essential git cmake pkg-config \ sudo apt install build-essential git cmake pkg-config \
libbz2-dev libxml2-dev libzip-dev libboost-all-dev \ libbz2-dev libstxxl-dev libstxxl1v5 libxml2-dev \
lua5.2 liblua5.2-dev libtbb-dev libzip-dev libboost-all-dev lua5.2 liblua5.2-dev libtbb-dev
``` ```
Compile and install OSRM binaries Compile and install OSRM binaries
@@ -117,10 +104,29 @@ cmake --build .
sudo cmake --build . --target install sudo cmake --build . --target install
``` ```
Grab a `.osm.pbf` extract from [Geofabrik](http://download.geofabrik.de/index.html) or [Mapzen's Metro Extracts](https://mapzen.com/data/metro-extracts/)
```bash
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
```
Pre-process the extract and start the HTTP server
```
osrm-extract berlin-latest.osm.pbf -p profiles/car.lua
osrm-contract berlin-latest.osrm
osrm-routed berlin-latest.osrm
```
Running Queries
```
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
```
### Request Against the Demo Server ### Request Against the Demo Server
Read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Demo-server). Read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy).
Simple query with instructions and alternatives on Berlin: Simple query with instructions and alternatives on Berlin:
``` ```
@@ -151,9 +157,7 @@ which will check and use pre-built binaries if they're available for this releas
to always force building the Node.js bindings from source. to always force building the Node.js bindings from source.
For usage details have a look [these API docs](docs/nodejs/api.md). For usage details have a look [these API docs](docs/nodejs/api.md).
An exemplary implementation by a 3rd party with Docker and Node.js can be found [here](https://github.com/door2door-io/osrm-express-server-demo).
## References in publications ## References in publications
+28 -8
View File
@@ -7,22 +7,19 @@ ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET PROJECT_DIR=%CD% SET PROJECT_DIR=%CD%
ECHO PROJECT_DIR^: %PROJECT_DIR% ECHO PROJECT_DIR^: %PROJECT_DIR%
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS% ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
:: Check CMake version
SET CMAKE_VERSION=3.9.2
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
ECHO cmake^: && cmake --version ECHO cmake^: && cmake --version
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK cmake --version | findstr /C:"3.7.1" && GOTO CMAKE_OK
:CMAKE_NOT_OK :CMAKE_NOT_OK
SET CMAKE_VERSION=3.7.1
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION% ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
powershell Invoke-WebRequest https://cmake.org/files/v3.9/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip IF NOT EXIST cm.zip powershell Invoke-WebRequest https://cmake.org/files/v3.7/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
IF %ERRORLEVEL% NEQ 0 GOTO ERROR IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive" IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
:CMAKE_OK :CMAKE_OK
ECHO CMAKE_OK ECHO CMAKE_OK
@@ -40,7 +37,7 @@ ECHO msbuild version
msbuild /version msbuild /version
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive :: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
SET DEPSPKG=osrm-deps-win-x64-14.0-2017.09.7z SET DEPSPKG=osrm-deps-win-x64-14.0.7z
:: local development :: local development
ECHO. ECHO.
@@ -161,6 +158,29 @@ XCOPY /Y corech\*.* ..\test\data\corech\
XCOPY /Y mld\*.* ..\test\data\mld\ XCOPY /Y mld\*.* ..\test\data\mld\
unit_tests\%Configuration%\library-tests.exe unit_tests\%Configuration%\library-tests.exe
IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" GOTO DONE
ECHO ========= CREATING PACKAGES ==========
CD %PROJECT_DIR%\build\%Configuration%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET P=%PROJECT_DIR%
SET ZIP= %P%\osrm_%Configuration%.zip
IF EXIST %ZIP% ECHO deleting %ZIP% && DEL /F /Q %ZIP%
IF %ERRORLEVEL% NEQ 0 ECHO deleting %ZIP% FAILED && GOTO ERROR
7z a %ZIP% *.lib *.exe *.pdb %P%/osrm-deps/libs/bin/*.dll -tzip -mx9 | %windir%\system32\FIND "ing archive"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
CD ..\..\profiles
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO disk=c:\temp\stxxl,10000,wincall > .stxxl.txt
7z a %ZIP% * -tzip -mx9 | %windir%\system32\FIND "ing archive"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO DONE
:ERROR :ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL% ECHO ERRORLEVEL^: %ERRORLEVEL%
+17
View File
@@ -29,7 +29,24 @@ before_test:
- SET OSRM_BUILD_DIR=build\%Configuration% - SET OSRM_BUILD_DIR=build\%Configuration%
- npm test - npm test
artifacts:
- path: osrm_Release.zip
name: osrm_Release.zip
# - path: osrm_Debug.zip
# name: osrm_Debug.zip
branches: branches:
only: only:
- master - master
deploy:
provider: FTP
server:
secure: ef7oiQTTXFGt8NdNiOHm/uRFVrUttzyFbIlnaeHhQvw=
username:
secure: Bw+Se2GTJxA6+GtRkEc//tQSBHOuFIuJHBjFwR9cD+8=
password:
secure: eqwESZqxMXC/j5mOCpaXuw==
folder: /
enable_ssl: true
active_mode: false
-8
View File
@@ -36,8 +36,6 @@
# This is because, the lua location is not standardized and may exist in # This is because, the lua location is not standardized and may exist in
# locations other than lua/ # locations other than lua/
include(FindPkgConfig)
unset(_lua_include_subdirs) unset(_lua_include_subdirs)
unset(_lua_library_names) unset(_lua_library_names)
unset(_lua_append_versions) unset(_lua_append_versions)
@@ -83,16 +81,11 @@ function(_lua_set_version_vars)
lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2} lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
) )
pkg_check_modules(LUA QUIET "lua${ver}")
list(APPEND _lua_include_subdirs ${LUA_INCLUDE_DIRS})
list(APPEND _lua_library_names ${LUA_LIBRARIES})
list(APPEND _lua_library_dirs ${LUA_LIBRARY_DIRS})
endforeach () endforeach ()
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE)
set(_lua_library_dirs "${_lua_library_dirs}" PARENT_SCOPE)
endfunction(_lua_set_version_vars) endfunction(_lua_set_version_vars)
function(_lua_check_header_version _hdr_file) function(_lua_check_header_version _hdr_file)
@@ -165,7 +158,6 @@ find_library(LUA_LIBRARY
ENV LUA_DIR ENV LUA_DIR
PATH_SUFFIXES lib PATH_SUFFIXES lib
PATHS PATHS
${_lua_library_dirs}
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/sw /sw
+21
View File
@@ -0,0 +1,21 @@
# - Try to find Shapefile C Library
# http://shapelib.maptools.org/
#
# Exports:
# Shapefile_FOUND
# LIBSHAPEFILE_INCLUDE_DIR
# LIBSHAPEFILE_LIBRARY
# Hints:
# LIBSHAPEFILE_LIBRARY_DIR
find_path(LIBSHAPEFILE_INCLUDE_DIR
shapefil.h)
find_library(LIBSHAPEFILE_LIBRARY
NAMES shp
HINTS "${LIBSHAPEFILE_LIBRARY_DIR}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Shapefile DEFAULT_MSG
LIBSHAPEFILE_LIBRARY LIBSHAPEFILE_INCLUDE_DIR)
mark_as_advanced(LIBSHAPEFILE_INCLUDE_DIR LIBSHAPEFILE_LIBRARY)
+1 -1
View File
@@ -4,7 +4,7 @@ libdir=@PKGCONFIG_LIBRARY_DIR@
Name: libOSRM Name: libOSRM
Description: Project OSRM library Description: Project OSRM library
Version: @OSRM_VERSION@ Version: v@OSRM_VERSION@
Requires: Requires:
Libs: -L${libdir} -losrm @PKGCONFIG_OSRM_LDFLAGS@ Libs: -L${libdir} -losrm @PKGCONFIG_OSRM_LDFLAGS@
Libs.private: @PKGCONFIG_OSRM_DEPENDENT_LIBRARIES@ Libs.private: @PKGCONFIG_OSRM_DEPENDENT_LIBRARIES@
+3 -3
View File
@@ -1,7 +1,7 @@
module.exports = { module.exports = {
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only --require features/support --require features/step_definitions', default: '--strict --tags ~@stress --tags ~@mld --tags ~@todo --require features/support --require features/step_definitions',
verify: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only -f progress --require features/support --require features/step_definitions', verify: '--strict --tags ~@stress --tags ~@mld --tags ~@todo -f progress --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions', todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions', all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions -f progress' mld: '--strict --tags ~@stress --tags ~@todo --tags ~@alternative --tags ~@ch --require features/support --require features/step_definitions -f progress'
}; };
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+29 -21
View File
@@ -1,20 +1,34 @@
FROM alpine:3.6 as buildstage FROM alpine:3.5
ARG DOCKER_TAG RUN mkdir /opt
RUN mkdir -p /src && mkdir -p /opt WORKDIR /opt
COPY . /src
WORKDIR /src
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \ apk update && \
apk upgrade && \ apk upgrade && \
apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.2-dev libtbb@testing libtbb-dev@testing && \ apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.1-dev libtbb@testing libtbb-dev@testing && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ \
echo "Building libstxxl" && \
cd /opt && \
git clone --depth 1 --branch 1.4.1 https://github.com/stxxl/stxxl.git && \
cd stxxl && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j${NPROC} && \
make install
ARG DOCKER_TAG
RUN mkdir /src
COPY . /src
WORKDIR /src
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo "Building OSRM ${DOCKER_TAG}" && \ echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \ git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \ echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \ mkdir build && \
cd build && \ cd build && \
BUILD_TYPE="Release" && \ BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \ ENABLE_ASSERTIONS="Off" && \
@@ -27,19 +41,13 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
cd ../profiles && \ cd ../profiles && \
cp -r * /opt && \ cp -r * /opt && \
\ \
echo "Cleaning up" && \
strip /usr/local/bin/* && \ strip /usr/local/bin/* && \
rm -rf /src /usr/local/lib/libosrm* rm /usr/local/lib/libstxxl* && \
cd /opt && \
apk del boost-dev && \
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds apk del g++ cmake libc-dev expat-dev zlib-dev bzip2-dev lua5.1-dev git make gcc && \
# Only the content below ends up in the image, this helps remove /src from the image (which is large) apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.1 expat && \
FROM alpine:3.6 as runstage rm -rf /src /opt/stxxl /usr/local/bin/stxxl_tool /usr/local/lib/libosrm*
RUN mkdir -p /src && mkdir -p /opt
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.2 expat libtbb@testing
COPY --from=buildstage /usr/local /usr/local
COPY --from=buildstage /opt /opt
WORKDIR /opt
EXPOSE 5000 EXPOSE 5000
+6 -8
View File
@@ -288,7 +288,6 @@ In addition to the [general options](#general-options) the following options are
|radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.| |radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.|
|gaps |`split` (default), `ignore` |Allows the input track splitting based on huge timestamp gaps between points. | |gaps |`split` (default), `ignore` |Allows the input track splitting based on huge timestamp gaps between points. |
|tidy |`true`, `false` (default) |Allows the input track modification to obtain better matching quality for noisy tracks. | |tidy |`true`, `false` (default) |Allows the input track modification to obtain better matching quality for noisy tracks. |
|waypoints | `{index};{index};{index}...` |Treats input coordinates indicated by given indices as waypoints in returned Match object. Default is to treat all input coordinates as waypoints. |
|Parameter |Values | |Parameter |Values |
|------------|-----------------------------------| |------------|-----------------------------------|
@@ -515,10 +514,10 @@ Represents a route between two waypoints.
- `annotation`: Additional details about each coordinate along the route geometry: - `annotation`: Additional details about each coordinate along the route geometry:
| annotations | | | annotations | |
|--------------|-------------------------------------------------------------------------------| |--------------|-----------------------------------------------------------------------|
| true | An `Annotation` object containing node ids, durations, distances and weights. | | true | An `Annotation` object containing node ids, durations distances and |
| false | `undefined` | | false | weights `undefined` |
#### Example #### Example
@@ -587,7 +586,7 @@ step.
- `name`: The name of the way along which travel proceeds. - `name`: The name of the way along which travel proceeds.
- `ref`: A reference number or code for the way. Optionally included, if ref data is available for the given way. - `ref`: A reference number or code for the way. Optionally included, if ref data is available for the given way.
- `pronunciation`: A string containing an [IPA](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet) phonetic transcription indicating how to pronounce the name in the `name` property. This property is omitted if pronunciation data is unavailable for the step. - `pronunciation`: The pronunciation hint of the way name. Will be `undefined` if there is no pronunciation hit.
- `destinations`: The destinations of the way. Will be `undefined` if there are no destinations. - `destinations`: The destinations of the way. Will be `undefined` if there are no destinations.
- `exits`: The exit numbers or names of the way. Will be `undefined` if there are no exit numbers or names. - `exits`: The exit numbers or names of the way. Will be `undefined` if there are no exit numbers or names.
- `mode`: A string signifying the mode of transportation. - `mode`: A string signifying the mode of transportation.
@@ -595,7 +594,6 @@ step.
- `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver - `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver
- `rotary_name`: The name for the rotary. Optionally included, if the step is a rotary and a rotary name is available. - `rotary_name`: The name for the rotary. Optionally included, if the step is a rotary and a rotary name is available.
- `rotary_pronunciation`: The pronunciation hint of the rotary name. Optionally included, if the step is a rotary and a rotary pronunciation is available. - `rotary_pronunciation`: The pronunciation hint of the rotary name. Optionally included, if the step is a rotary and a rotary pronunciation is available.
- `driving_side`: The legal driving side at the location for this step. Either `left` or `right`.
#### Example #### Example
@@ -666,7 +664,7 @@ step.
| `end of road` | road ends in a T intersection turn in direction of `modifier`| | `end of road` | road ends in a T intersection turn in direction of `modifier`|
| `use lane` | **Deprecated** replaced by lanes on all intersection entries | | `use lane` | **Deprecated** replaced by lanes on all intersection entries |
| `continue` | Turn in direction of `modifier` to stay on the same road | | `continue` | Turn in direction of `modifier` to stay on the same road |
| `roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. | | `roundabout` | traverse roundabout, has additional property `exit` with NR if the roundabout is left. The modifier specifies the direction of entering the roundabout. |
| `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). | | `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. | | `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. |
| `notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction | | `notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
+56 -148
View File
@@ -6,7 +6,7 @@ OSRM supports "profiles". Profiles representing routing behavior for different t
## Available profiles ## Available profiles
Out-of-the-box OSRM comes with profiles for car, bicycle and foot. You can easily modify these or create new ones if you like. Out-of-the-box OSRM comes with profiles for car, bicycle and foot. You can easily modify these or create new ones if you like.
Profiles have a 'lua' extension, and are placed in 'profiles' directory. Profiles have a 'lua' extension, and are places in 'profiles' directory.
When running OSRM preprocessing commands you specify the profile with the --profile (or the shorthand -p) option, for example: When running OSRM preprocessing commands you specify the profile with the --profile (or the shorthand -p) option, for example:
@@ -17,8 +17,8 @@ It's important to understand that profiles are used when preprocessing the OSM d
This means that after modifying a profile **you will need to extract, contract and reload the data again** and to see changes in the routing results. See [Processing Flow](https://github.com/Project-OSRM/osrm-backend/wiki/Processing-Flow) for more. This means that after modifying a profile **you will need to extract, contract and reload the data again** and to see changes in the routing results. See [Processing Flow](https://github.com/Project-OSRM/osrm-backend/wiki/Processing-Flow) for more.
## Profiles are written in Lua ## Profiles are written in LUA
Profiles are not just configuration files. They are scripts written in the [Lua scripting language](http://www.lua.org). The reason for this is that OpenStreetMap data is complex, and it's not possible to simply define tag mappings. Lua scripting offers a powerful way to handle all the possible tag combinations found in OpenStreetMap nodes and ways. Profiles are not just configuration files. They are scripts written in the [LUA scripting language](http://www.lua.org). The reason for this is that OpenStreetMap data is complex, and it's not possible to simply define tag mappings. LUA scripting offers a powerful way to handle all the possible tag combinations found in OpenStreetMap nodes and ways.
## Basic structure of profiles ## Basic structure of profiles
A profile will process every node and way in the OSM input data to determine what ways are routable in which direction, at what speed, etc. A profile will process every node and way in the OSM input data to determine what ways are routable in which direction, at what speed, etc.
@@ -35,40 +35,40 @@ A profile can also define various local functions it needs.
Looking at [car.lua](../profiles/car.lua) as an example, at the top of the file the api version is defined and then required library files are included. Looking at [car.lua](../profiles/car.lua) as an example, at the top of the file the api version is defined and then required library files are included.
Then follows the `setup` function, which is called once when the profile is loaded. It returns a big hash table of configurations, specifying things like what speed to use for different way types. The configurations are used later in the various processing functions. Many adjustments can be done just by modifying this configuration table. Then follows the `setup` functions, which is called once when the profile is loaded. It returns a big hash table of configurations, specifying things like what speed to use for different way types. The configurations are used later in the various processing functions. Many adjustments can be done just be modifying this configuration table.
The setup function is also where you can do other setup, like loading an elevation data source if you want to consider that when processing ways. The setup function is also where you can do other setup, like loading elevation data source if you want to consider that when processing ways.
Then come the `process_node` and `process_way` functions, which are called for each OSM node and way when extracting OpenStreetMap data with `osrm-extract`. Then comes the `process_node` and `process_way` functions, which are called for each OSM node and way when extracting OpenStreetMap data with `osrm-extract`.
The `process_turn` function processes every possible turn in the network, and sets a penalty depending on the angle and turn of the movement. The `process_turn` function processes every possible turn in the network, and sets a penalty depending on the angle and turn of the movement.
Profiles can also define a `process_segment` function to handle differences in speed along an OSM way, for example to handle elevation. As you can see, this is not currently used in the car profile. Profiles can also define a `process_segment` function to handle differences in speed along an OSM way, for example to handle elevation. As you can see, this is not currently used in the car profile.
At the end of the file, a table is returned with references to the setup and processing functions the profile has defined. At the end of the file, a table if returned with references to the setup and processing functions the profile has defined.
## Understanding speed, weight and rate ## Understanding speed, weight and rate
When computing a route from A to B there can be different measures of what is the best route. That's why there's a need for different profiles. When computing a route from A to B there can be different measure of what is the best route. That's why there's a need for different profiles.
Because speeds vary on different types of roads, the shortest and the fastest route are typically different. But there are many other possible preferences. For example a user might prefer a bicycle route that follow parks or other green areas, even though both duration and distance are a bit longer. Because speeds very on different types of roads, the shortest and the fastest route are typically different. But there are many other possible preferences. For example a user might prefer a bicycle route that follow parks or other green areas, even though both duration and distance are a bit longer.
To handle this, OSRM doesn't simply choose the ways with the highest speed. Instead it uses the concepts of `weight` and `rate`. The rate is an abstract measure that you can assign to ways as you like to make some ways preferable to others. Routing will prefer ways with high rate. To handle this, OSRM doesn't simply choose the ways with the highest speed. Instead it uses the concept of `weight` and `rate`. The rate is an abstract measure that you can assign to ways as you like to make some ways preferable to others. Routing will prefer ways with high rate.
The weight of a way is normally computed as length / rate. The weight can be thought of as the resistance or cost when passing the way. Routing will prefer ways with low weight. The weight of a way normally computed as length / rate. The weight can be thought of as the resistance or cost when passing the way. Routing will prefer ways with low weight.
You can also set the weight of a way to a fixed value. In this case it's not calculated based on the length or rate, and the rate is ignored. You can also set the weight of a way to a fixed value, In this case it's not calculated based on the length or rate, and the rate is ignored.
You should set the speed to your best estimate of the actual speed that will be used on a particular way. This will result in the best estimated travel times. You should set the speed to you best estimate of the actual speed that will be used on a particular way. This will result in the best estimated travel times.
If you want to prefer certain ways due to other factors than the speed, adjust the rate accordingly. If you adjust the speed, the time estimation will be skewed. If you want to prefer certain ways due to other factors than the speed, adjust the rate accordingly. If you adjust the speed, the time time estimation will be skewed.
If you set the same rate on all ways, the result will be shortest path routing. If you set the same rate on all ways, the result will be shortest path routing.
If you set rate = speed on all ways, the result will be fastest path routing. If you set rate = speed on all ways, the result will be fastest path routing.
If you want to prioritize certain streets, increase the rate on these. If you want to prioritize certain street, increase the rate on these.
## Elements ## Elements
### api_version ### api_version
A profile should set `api_version` at the top of your profile. This is done to ensure that older profiles are still supported when the api changes. If `api_version` is not defined, 0 will be assumed. The current api version is 2. A profile should set api_version at the top of your profile. This is done to ensure that older profiles are still supported when the api changes. If api_version is not defined, 0 will be assumed. The current api version is 2.
### Library files ### Library files
The folder [profiles/lib/](../profiles/lib/) contains LUA library files for handling many common processing tasks. The folder [profiles/lib/](../profiles/lib/) contains LUA library files for handling many common processing tasks.
@@ -81,17 +81,17 @@ set.lua | Defines the Set helper for handling sets of values
sequence.lua | Defines the Sequence helper for handling sequences of values sequence.lua | Defines the Sequence helper for handling sequences of values
access.lua | Function for finding relevant access tags access.lua | Function for finding relevant access tags
destination.lua | Function for finding relevant destination tags destination.lua | Function for finding relevant destination tags
maxspeed.lua | Function for determining maximum speed destination.lua | Function for determining maximum speed
guidance.lua | Function for processing guidance attributes guidance.lua | Function for processing guidance attributes
They all return a table of functions when you use `require` to load them. You can either store this table and reference its functions later, or if you need only a single function you can store that directly. They all return a table of functions when you use `require` to load them. You can either store this table and reference it's functions later, of if you need only a single you can store that directly.
### setup() ### setup()
The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing. The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing.
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have its own set of globals. Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have it's own set of globals.
The following global properties can be set under `properties` in the hash you return in the `setup` function: The following global properties can be set under `properties` in the hash you return in the `setup` function:
Attribute | Type | Notes Attribute | Type | Notes
-------------------------------------|----------|---------------------------------------------------------------------------- -------------------------------------|----------|----------------------------------------------------------------------------
@@ -104,18 +104,17 @@ max_speed_for_map_matching | Float | Maximum vehicle speed to be as
max_turn_weight | Float | Maximum turn penalty weight max_turn_weight | Float | Maximum turn penalty weight
force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `process_segment` will be called for all segments (default `false`) force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `process_segment` will be called for all segments (default `false`)
The following additional global properties can be set in the hash you return in the `setup` function: The following additional global properties can be set in the hash you return in the `setup` function:
Attribute | Type | Notes Attribute | Type | Notes
-------------------------------------|------------------|---------------------------------------------------------------------------- -------------------------------------|------------------|----------------------------------------------------------------------------
excludable | Sequence of Sets | Determines which class-combinations are supported by the `exclude` option at query time. E.g. `Sequence{Set{"ferry", "motorway"}, Set{"motorway"}}` will allow you to exclude ferries and motorways, or only motorways. excludable | Sequence of Sets | Determines which class-combinations are supported by the `exclude` option at query time.
| | E.g. `Sequence{Set{"ferry", "motorway"}, Set{"motorway"}}` will allow you to exclude ferries and motorways, or only motorways.
classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function. classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function.
restrictions | Sequence | Determines which turn restrictions will be used for this profile. restrictions | Sequence | Determines which turn restrictions will be used for this profile.
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES". suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
relation_types | Sequence | Determines wich relations should be cached for processing in this profile. It contains relations types
### process_node(profile, node, result, relations) ### process_node(profile, node, result)
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay. Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
Argument | Description Argument | Description
@@ -123,7 +122,6 @@ Argument | Description
profile | The configuration table you returned in `setup`. profile | The configuration table you returned in `setup`.
node | The input node to process (read-only). node | The input node to process (read-only).
result | The output that you will modify. result | The output that you will modify.
relations| Storage of relations to access relations, where `node` is a member.
The following attributes can be set on `result`: The following attributes can be set on `result`:
@@ -132,7 +130,7 @@ Attribute | Type | Notes
barrier | Boolean | Is it an impassable barrier? barrier | Boolean | Is it an impassable barrier?
traffic_lights | Boolean | Is it a traffic light (incurs delay in `process_turn`)? traffic_lights | Boolean | Is it a traffic light (incurs delay in `process_turn`)?
### process_way(profile, way, result, relations) ## process_way(profile, way, result)
Given an OpenStreetMap way, the `process_way` function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash. Given an OpenStreetMap way, the `process_way` function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash.
Argument | Description Argument | Description
@@ -140,39 +138,36 @@ Argument | Description
profile | The configuration table you returned in `setup`. profile | The configuration table you returned in `setup`.
node | The input way to process (read-only). node | The input way to process (read-only).
result | The output that you will modify. result | The output that you will modify.
relations| Storage of relations to access relations, where `way` is a member.
Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way. Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way.
It will also set a number of other attributes on `result`. It will also set a number of other attributes on `result`.
Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the `process_way` function. Instead `process_way` will examine the tag set on the way, process this information in various ways, calling other local functions and referencing the configuration in `profile`, etc., before arriving at the result. Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the `process_way` function. Instead `process_way` will examine the tag set on the way, process this information in various ways, calling other local functions and referencing the configuration in `profile`, etc, before arriving at the result.
The following attributes can be set on the result in `process_way`: The following attributes can be set on the result in `process_way`:
Attribute | Type | Notes Attribute | Type | Notes
----------------------------------------|----------|-------------------------------------------------------------------------- ----------------------------------------|----------|--------------------------------------------------------------------------
forward_speed | Float | Speed on this way in km/h. Mandatory. forward_speed | Float | Speed on this way in km/h. Mandatory.
backward_speed | Float | "" backward_speed | Float | " "
forward_rate | Float | Routing weight, expressed as meters/*weight* (e.g. for a fastest-route weighting, you would want this to be meters/second, so set it to forward_speed/3.6) forward_rate | Float | Routing weight, expressed as meters/*weight* (e.g. for a fastest-route weighting, you would want this to be meters/second, so set it to forward_speed/3.6)
backward_rate | Float | "" backward_rate | Float | " "
forward_mode | Enum | Mode of travel (e.g. `car`, `ferry`). Mandatory. Defined in `include/extractor/travel_mode.hpp`. forward_mode | Enum | Mode of travel (e.g. `car`, `ferry`). Mandatory. Defined in `include/extractor/travel_mode.hpp`.
backward_mode | Enum | "" backward_mode | Enum | " "
forward_classes | Table | Mark this way as being of a specific class, e.g. `result.classes["toll"] = true`. This will be exposed in the API as `classes` on each `RouteStep`. forward_classes | Table | Mark this way as being of a specific class, e.g. `result.classes["toll"] = true`. This will be exposed in the API as `classes` on each `RouteStep`.
backward_classes | Table | "" backward_classes | Table | " "
duration | Float | Alternative setter for duration of the whole way in both directions duration | Float | Alternative setter for duration of the whole way in both directions
weight | Float | Alternative setter for weight of the whole way in both directions weight | Float | Alternative setter for weight of the whole way in both directions
turn_lanes_forward | String | Directions for individual lanes (normalized OSM `turn:lanes` value) turn_lanes_forward | String | Directions for individual lanes (normalized OSM `turn:lanes` value)
turn_lanes_backward | String | "" turn_lanes_backward | String | " "
forward_restricted | Boolean | Is this a restricted access road? (e.g. private, or deliveries only; used to enable high turn penalty, so that way is only chosen for start/end of route) forward_restricted | Boolean | Is this a restricted access road? (e.g. private, or deliveries only; used to enable high turn penalty, so that way is only chosen for start/end of route)
backward_restricted | Boolean | "" backward_restricted | Boolean | " "
is_startpoint | Boolean | Can a journey start on this way? (e.g. ferry; if `false`, prevents snapping the start point to this way) is_startpoint | Boolean | Can a journey start on this way? (e.g. ferry; if `false`, prevents snapping the start point to this way)
roundabout | Boolean | Is this part of a roundabout? roundabout | Boolean | Is this part of a roundabout?
circular | Boolean | Is this part of a non-roundabout circular junction? circular | Boolean | Is this part of a non-roundabout circular junction?
name | String | Name of the way name | String | Name of the way
ref | String | Road number (equal to set `forward_ref` and `backward_ref` with one value) ref | String | Road number
forward_ref | String | Road number in forward way direction
backward_ref | String | Road number in backward way direction
destinations | String | The road's destinations destinations | String | The road's destinations
exits | String | The ramp's exit numbers or names exits | String | The ramp's exit numbers or names
pronunciation | String | Name pronunciation pronunciation | String | Name pronunciation
@@ -183,22 +178,22 @@ road_classification.may_be_ignored | Boolean | Guidance: way is non-highwa
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
### process_segment(profile, segment) ### process_segment(profile, segment)
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes. The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
On OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However many ways are long. For example, many ways pass hills without any change in tags. On OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However many ways are long. For example, many ways pass hills without any change in tags.
Processing each segment of an OSM way makes it possible to have different speeds on different parts of a way based on external data like data about elevation, pollution, noise or scenic value and adjust weight and duration of the segment accordingly. Processing each segment of an OSM way makes it possible to have different speeds on different parts of a way based on external data like data about elevation, pollution, noise or scenic value and adjust weight and duration of the segment.
In the `process_segment` function you don't have access to OSM tags. Instead you use the geographical location of the start and end point of the way to look up information from another data source, like elevation data. See [rasterbot.lua](../profiles/rasterbot.lua) for an example. In the `process_segment` you don't have access to OSM tags. Instead you use the geographical location of the start and end point of the way to lookup other data source, like elevation data. See [rasterbot.lua](../profiles/rasterbot.lua) for an example.
The following attributes can be read and set on the result in `process_segment`: The following attributes can be read and set on the result in `process_segment`:
Attribute | Read/write? | Type | Notes Attribute | Read/write? | Type | Notes
-------------------|-------------|---------|---------------------------------------- -------------------|-------------|---------|----------------------------------------
source.lon | Read | Float | Co-ordinates of segment start source.lon | Read | Float | Co-ordinates of segment start
source.lat | Read | Float | "" source.lat | Read | Float | " "
target.lon | Read | Float | Co-ordinates of segment end target.lon | Read | Float | Co-ordinates of segment end
target.lat | Read | Float | "" target.lat | Read | Float | " "
target.distance | Read | Float | Length of segment target.distance | Read | Float | Length of segment
weight | Read/write | Float | Routing weight for this segment weight | Read/write | Float | Routing weight for this segment
duration | Read/write | Float | Duration for this segment duration | Read/write | Float | Duration for this segment
@@ -208,103 +203,16 @@ The `process_turn` function is called for every possible turn in the network. Ba
The following attributes can be read and set on the result in `process_turn`: The following attributes can be read and set on the result in `process_turn`:
Attribute | Read/write? | Type | Notes Attribute | Read/write? | Type | Notes
--------------------- | ------------- | --------- | ------------------------------------------------------ -------------------|-------------|---------|------------------------------------------------------
angle | Read | Float | Angle of turn in degrees (`[-179, 180]`: `0`=straight, `180`=u turn, `+x`=x degrees to the right, `-x`= x degrees to the left) direction_modifier | Read | Enum | Geometry of turn. Defined in `include/extractor/guidance/turn_instruction.hpp`
number_of_roads | Read | Integer | Number of ways at the intersection of the turn turn_type | Read | Enum | Priority of turn. Defined in `include/extractor/guidance/turn_instruction.hpp`
is_u_turn | Read | Boolean | Is the turn a u-turn? has_traffic_light | Read | Boolean | Is a traffic light present at this turn?
has_traffic_light | Read | Boolean | Is a traffic light present at this turn? source_restricted | Read | Boolean | Is it from a restricted access road? (See definition in `process_way`)
is_left_hand_driving | Read | Boolean | Is left-hand traffic? target_restricted | Read | Boolean | Is it to a restricted access road? (See definition in `process_way`)
source_restricted | Read | Boolean | Is it from a restricted access road? (See definition in `process_way`) angle | Read | Float | Angle of turn in degrees (`0-360`: `0`=u-turn, `180`=straight on)
source_mode | Read | Enum | Travel mode before the turn. Defined in `include/extractor/travel_mode.hpp` duration | Read/write | Float | Penalty to be applied for this turn (duration in deciseconds)
source_is_motorway | Read | Boolean | Is the source road a motorway? weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
source_is_link | Read | Boolean | Is the source road a link?
source_number_of_lanes | Read | Integer | How many lanes does the source road have? (default when not tagged: 0)
source_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
source_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
source_speed | Read | Integer | Speed on this source road in km/h
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/guidance/road_classification.hpp`
target_restricted | Read | Boolean | Is it from a restricted access road? (See definition in `process_way`)
target_mode | Read | Enum | Travel mode before the turn. Defined in `include/extractor/travel_mode.hpp`
target_is_motorway | Read | Boolean | Is the target road a motorway?
target_is_link | Read | Boolean | Is the target road a link?
target_number_of_lanes | Read | Integer | How many lanes does the target road have? (default when not tagged: 0)
target_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
target_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
target_speed | Read | Integer | Speed on this target road in km/h
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/guidance/road_classification.hpp`
roads_on_the_right | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the right of the turn that are also connected at the intersection
roads_on_the_left | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the left of the turn that are also connected at the intersection. If turn is a u turn, this is empty.
weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
duration | Read/write | Float | Penalty to be applied for this turn (duration in deciseconds)
#### `roads_on_the_right` and `roads_on_the_left`
The information of `roads_on_the_right` and `roads_on_the_left` that can be read are as follows:
Attribute | Read/write? | Type | Notes
--------------------- | ------------- | --------- | ------------------------------------------------------
is_restricted | Read | Boolean | Is it a restricted access road? (See definition in `process_way`)
mode | Read | Enum | Travel mode before the turn. Defined in `include/extractor/travel_mode.hpp`
is_motorway | Read | Boolean | Is the road a motorway?
is_link | Read | Boolean | Is the road a link?
number_of_lanes | Read | Integer | How many lanes does the road have? (default when not tagged: 0)
highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
speed | Read | Integer | Speed on this road in km/h
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/guidance/road_classification.hpp`
is_incoming | Read | Boolean | Is the road an incoming road of the intersection
is_outgoing | Read | Boolean | Is the road an outgoing road of the intersection
The order of the roads in `roads_on_the_right` and `roads_on_the_left` are *counter clockwise*. If the turn is a u turn, all other connected roads will be in `roads_on_the_right`.
**Example**
```
c e
| /
| /
a ---- x ---- b
/|
/ |
f d
```
When turning from `a` to `b` via `x`,
* `roads_on_the_right[1]` is the road `xf`
* `roads_on_the_right[2]` is the road `xd`
* `roads_on_the_left[1]` is the road `xe`
* `roads_on_the_left[2]` is the road `xc`
Note that indices of arrays in lua are 1-based.
#### `highway_turn_classification` and `access_turn_classification`
When setting appropriate turn weights and duration, information about the highway and access tags of roads that are involved in the turn are necessary. The lua turn function `process_turn` does not have access to the original osrm tags anymore. However, `highway_turn_classification` and `access_turn_classification` can be set during setup. The classification set during setup can be later used in `process_turn`.
**Example**
In the following example we use `highway_turn_classification` to set the turn weight to `10` if the turn is on a highway and to `5` if the turn is on a primary.
```
function setup()
return {
highway_turn_classification = {
['motorway'] = 2,
['primary'] = 1
}
}
end
function process_turn(profile, turn) {
if turn.source_highway_turn_classification == 2 and turn.target_highway_turn_classification == 2 then
turn.weight = 10
end
if turn.source_highway_turn_classification == 1 and turn.target_highway_turn_classification == 1 then
turn.weight = 5
end
}
```
## Guidance ## Guidance
The guidance parameters in profiles are currently a work in progress. They can and will change. The guidance parameters in profiles are currently a work in progress. They can and will change.
@@ -317,7 +225,7 @@ The priority-category influences the decision which road is considered the obvio
Forks can be emitted between roads of similar priority category only. Obvious choices follow a major priority road, if the priority difference is large. Forks can be emitted between roads of similar priority category only. Obvious choices follow a major priority road, if the priority difference is large.
### Using raster data ### Using raster data
OSRM has built-in support for loading an interpolating raster data in ASCII format. This can be used e.g. for factoring in elevation when computing routes. OSRM has build-in support for loading an interpolating raster data in ASCII format. This can be used e.g. for factoring in elevation when computing routes.
Use `raster:load()` in your `setup` function to load data and store the source in your configuration hash: Use `raster:load()` in your `setup` function to load data and store the source in your configuration hash:
@@ -357,7 +265,7 @@ Example:
function process_segment (profile, segment) function process_segment (profile, segment)
local sourceData = raster:query(profile.raster_source, segment.source.lon, segment.source.lat) local sourceData = raster:query(profile.raster_source, segment.source.lon, segment.source.lat)
local targetData = raster:query(profile.raster_source, segment.target.lon, segment.target.lat) local targetData = raster:query(profile.raster_source, segment.target.lon, segment.target.lat)
local invalid = sourceData.invalid_data() local invalid = sourceData.invalid_data()
if sourceData.datum ~= invalid and targetData.datum ~= invalid then if sourceData.datum ~= invalid and targetData.datum ~= invalid then
-- use values to adjust weight and duration -- use values to adjust weight and duration
@@ -370,8 +278,8 @@ See [rasterbot.lua](../profiles/rasterbot.lua) and [rasterbotinterp.lua](../prof
### Helper functions ### Helper functions
There are a few helper functions defined in the global scope that profiles can use: There are a few helper functions defined in the global scope that profiles can use:
- `durationIsValid` durationIsValid
- `parseDuration` parseDuration
- `trimLaneString` trimLaneString
- `applyAccessTokens` applyAccessTokens
- `canonicalizeStringList` canonicalizeStringList
-8
View File
@@ -30,17 +30,9 @@ int main(int argc, const char *argv[])
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore // Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
EngineConfig config; EngineConfig config;
config.storage_config = {argv[1]}; config.storage_config = {argv[1]};
config.use_shared_memory = false; config.use_shared_memory = false;
// We support two routing speed up techniques:
// - Contraction Hierarchies (CH): requires extract+contract pre-processing
// - Multi-Level Dijkstra (MLD): requires extract+partition+customize pre-processing
//
// config.algorithm = EngineConfig::Algorithm::CH;
config.algorithm = EngineConfig::Algorithm::MLD;
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match) // Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
const OSRM osrm{config}; const OSRM osrm{config};
-1
View File
@@ -10,7 +10,6 @@ Feature: Barriers
| | x | | | x |
| bollard | x | | bollard | x |
| gate | x | | gate | x |
| lift_gate | x |
| cycle_barrier | x | | cycle_barrier | x |
| cattle_grid | x | | cattle_grid | x |
| border_control | x | | border_control | x |
-35
View File
@@ -1,35 +0,0 @@
@routing @bicycle
Feature: Bike - Use distance weight
Background:
Given a grid size of 200 meters
Scenario: Bike - Check distance weight
Given the profile file
"""
local functions = require('bicycle')
functions.setup_testbot = functions.setup
functions.setup = function()
local profile = functions.setup_testbot()
profile.properties.weight_name = 'distance'
return profile
end
return functions
"""
Given the node map
"""
a-b-c
"""
And the ways
| nodes | highway |
| abc | residential |
When I route I should get
| from | to | route | weight | time | distance |
| a | b | abc,abc | 200 | 48s | 200m +-1 |
| a | c | abc,abc | 400 | 96s | 400m +-1 |
+9 -10
View File
@@ -157,16 +157,15 @@ Feature: Car - Restricted access
Scenario: Car - Access combinations Scenario: Car - Access combinations
Then routability should be Then routability should be
| highway | access | vehicle | motor_vehicle | motorcar | forw | backw | # | | highway | access | vehicle | motor_vehicle | motorcar | forw | backw | # |
| runway | private | | | permissive | x | x | | | runway | private | | | permissive | x | x | |
| primary | forestry | | yes | | x | x | | | primary | forestry | | yes | | x | x | |
| cycleway | | | designated | | x | x | | | cycleway | | | designated | | x | x | |
| unclassified | | | destination | destination | x | x | | | residential | | yes | no | | | | |
| residential | | yes | no | | | | | | motorway | yes | permissive | | private | x | | implied oneway |
| motorway | yes | permissive | | private | x | | implied oneway | | trunk | agricultural | designated | permissive | no | | | |
| trunk | agricultural | designated | permissive | no | | | | | pedestrian | | | | | | | |
| pedestrian | | | | | | | | | pedestrian | | | | destination | | | temporary disabled #3773 |
| pedestrian | | | | destination | | | temporary disabled #3773 |
Scenario: Car - Ignore access tags for other modes Scenario: Car - Ignore access tags for other modes
Then routability should be Then routability should be
-23
View File
@@ -1,23 +0,0 @@
@routing @car @way
Feature: Car - Avoid defined areas
Background:
Given the profile file "car" initialized with
"""
profile.avoid = Set { 'motorway', 'motorway_link' }
profile.speeds = Sequence {
highway = {
motorway = 90,
motorway_link = 45,
primary = 50
}
}
"""
Scenario: Car - Avoid motorways
Then routability should be
| highway | bothw |
| motorway | |
| motorway_link | |
| primary | x |
-8
View File
@@ -45,11 +45,3 @@ Feature: Car - Barriers
| bollard | | | | bollard | | |
| bollard | rising | x | | bollard | rising | x |
| bollard | removable | | | bollard | removable | |
Scenario: Car - Height restrictions
Then routability should be
| node/barrier | node/maxheight | bothw |
| height_restrictor | | x |
| height_restrictor | 1 | |
| height_restrictor | 3 | x |
| height_restrictor | default | x |
+10 -10
View File
@@ -20,9 +20,9 @@ Feature: Car - Handle driving
| efg | primary | | | | efg | primary | | |
When I route I should get When I route I should get
| from | to | route | modes | turns | | from | to | route | modes |
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | depart,new name right,new name left,arrive | | a | g | abc,cde,efg,efg | driving,driving,driving,driving |
| e | a | cde,abc,abc | driving,driving,driving | depart,new name left,arrive | | e | a | cde,abc,abc | driving,driving,driving |
Scenario: Car - Control test without durations, osrm uses movable bridge speed to calculate duration Scenario: Car - Control test without durations, osrm uses movable bridge speed to calculate duration
Given the node map Given the node map
@@ -39,9 +39,9 @@ Feature: Car - Handle driving
| efg | primary | | | efg | primary | |
When I route I should get When I route I should get
| from | to | route | modes | speed | time | turns | | from | to | route | modes | speed | time |
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 13 km/h | 332s +-1 | depart,new name right,new name left,arrive | | a | g | abc,cde,efg,efg | driving,driving,driving,driving | 13 km/h | 340s +-1 |
| e | c | cde,cde | driving,driving | 5 km/h | 288s +-1 | depart,arrive | | e | c | cde,cde | driving,driving | 5 km/h | 295s +-1 |
Scenario: Car - Properly handle durations Scenario: Car - Properly handle durations
Given the node map Given the node map
@@ -58,7 +58,7 @@ Feature: Car - Handle driving
| efg | primary | | | | efg | primary | | |
When I route I should get When I route I should get
| from | to | route | modes | speed | turns | | from | to | route | modes | speed |
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 7 km/h | depart,new name right,new name left,arrive | | a | g | abc,cde,efg,efg | driving,driving,driving,driving | 7 km/h |
| c | e | cde,cde | driving,driving | 2 km/h | depart,arrive | | c | e | cde,cde | driving,driving | 2 km/h |
| e | c | cde,cde | driving,driving | 2 km/h | depart,arrive | | e | c | cde,cde | driving,driving | 2 km/h |
+2 -40
View File
@@ -82,7 +82,7 @@ Feature: Car - Mode flag
| from | to | route | turns | classes | | from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] | | a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] |
Scenario: Car - We tag toll with a class Scenario: Car - We toll restricted with a class
Given the node map Given the node map
""" """
a b a b
@@ -99,45 +99,6 @@ Feature: Car - Mode flag
| from | to | route | turns | classes | | from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive | [(toll),(motorway,toll),()],[()] | | a | d | ab,cd | depart,arrive | [(toll),(motorway,toll),()],[()] |
Scenario: Car - We tag tunnel with a class
Background:
Given a grid size of 200 meters
Given the node map
"""
a b
c d
"""
And the ways
| nodes | tunnel |
| ab | no |
| bc | yes |
| cd | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,new name right,new name left,arrive | [()],[(tunnel)],[()],[()] |
Scenario: Car - We tag classes without intersections
Background:
Given a grid size of 200 meters
Given the node map
"""
a b c d
"""
And the ways
| nodes | name | tunnel |
| ab | road | |
| bc | road | yes |
| cd | road | |
When I route I should get
| from | to | route | turns | classes |
| a | d | road,road | depart,arrive | [(),(tunnel),()],[()] |
Scenario: Car - From roundabout on toll road Scenario: Car - From roundabout on toll road
Given the node map Given the node map
""" """
@@ -163,3 +124,4 @@ Feature: Car - Mode flag
When I route I should get When I route I should get
| from | to | route | turns | classes | | from | to | route | turns | classes |
| a | f | ab,df,df,df | depart,roundabout-exit-2,exit roundabout slight right,arrive | [()],[(),(motorway)],[(toll,motorway)],[()] | | a | f | ab,df,df,df | depart,roundabout-exit-2,exit roundabout slight right,arrive | [()],[(),(motorway)],[(toll,motorway)],[()] |
+181 -180
View File
@@ -17,27 +17,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | only_right_turn @ (has_pygmies > 10 p) | | restriction | ej | nj | j | only_right_turn @ (has_pygmies > 10 p) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Restriction would be on, but the restriction was badly tagged Scenario: Car - Restriction would be on, but the restriction was badly tagged
@@ -48,29 +48,29 @@ Feature: Car - Turn restrictions
Given the node map Given the node map
""" """
a n
p | p |
\ | \ |
j j
| \ | \
c m s m
""" """
And the ways And the ways
| nodes | | nodes |
| aj | | nj |
| jc | | js |
| pjm | | pjm |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | aj | pjm | j | no_left_turn @ (Mo-Fr 07:00-10:30) | | restriction | nj | pjm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
| restriction | jc | pjm | j | no_right_turn @ (Mo-Fr 07:00-10:30) | | restriction | js | pjm | j | no_right_turn @ (Mo-Fr 07:00-10:30) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | m | aj,pjm,pjm | | n | m | nj,pjm,pjm |
| c | m | jc,pjm,pjm | | s | m | js,pjm,pjm |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Restriction With Compressed Geometry Scenario: Car - Restriction With Compressed Geometry
@@ -149,29 +149,29 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | no | | ej | no |
| jd | no | | jp | no |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | except | | type | way:from | way:to | node:via | restriction:conditional | except |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar | | restriction | ej | nj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar |
| restriction | jd | aj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus | | restriction | jp | nj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus |
When I route I should get When I route I should get
| from | to | route | # | | from | to | route | # |
| b | c | bj,jc,jc | | | e | s | ej,js,js | |
| b | a | bj,aj,aj | restriction does not apply to cars | | e | n | ej,nj,nj | restriction does not apply to cars |
| b | d | bj,jd,jd | | | e | p | ej,jp,jp | |
| d | c | jd,aj,aj,jc,jc | restriction excepting busses still applies to cars | | p | s | jp,nj,nj,js,js | restriction excepting busses still applies to cars |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - only_right_turn Scenario: Car - only_right_turn
@@ -181,27 +181,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) | | restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,aj,aj,jc,jc | | e | s | ej,nj,nj,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,aj,aj,jd,jd | | e | p | ej,nj,nj,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - No right turn Scenario: Car - No right turn
@@ -211,27 +211,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) | | restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get When I route I should get
| from | to | route | # | | from | to | route | # |
| b | c | bj,jc,jc | normal turn | | e | s | ej,js,js | normal turn |
| b | a | bj,jc,jc,aj,aj | avoids right turn | | e | n | ej,js,js,nj,nj | avoids right turn |
| b | d | bj,jd,jd | normal maneuver | | e | p | ej,jp,jp | normal maneuver |
@only_turning @conditionals @only_turning @conditionals
Scenario: Car - only_left_turn Scenario: Car - only_left_turn
@@ -241,27 +241,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) | | restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,jc,jc,aj,aj | | e | n | ej,js,js,nj,nj |
| b | d | bj,jc,jc,jd,jd | | e | p | ej,js,js,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - No left turn Scenario: Car - No left turn
@@ -271,27 +271,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) | | restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,aj,aj,jc,jc | | e | s | ej,nj,nj,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Conditional restriction is off Scenario: Car - Conditional restriction is off
@@ -301,27 +301,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) | | restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Conditional restriction is on Scenario: Car - Conditional restriction is on
@@ -331,27 +331,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) | | restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,jc,jc,aj,aj | | e | n | ej,js,js,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows Scenario: Car - Conditional restriction with multiple time windows
@@ -362,28 +362,28 @@ Feature: Car - Turn restrictions
Given the node map Given the node map
""" """
a n
p | p |
\ | \ |
j j
| \ | \
c m s m
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| jp | yes | | jp | yes |
| mj | yes | | mj | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) | | restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | p | aj,jc,jc,jp,jp | | n | p | nj,js,js,jp,jp |
| m | p | mj,jp,jp | | m | p | mj,jp,jp |
@no_turning @conditionals @no_turning @conditionals
@@ -394,27 +394,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) | | restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,aj,aj,jc,jc | | e | s | ej,nj,nj,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,aj,aj,jd,jd | | e | p | ej,nj,nj,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - No right turn Scenario: Car - No right turn
@@ -424,27 +424,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) | | restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get When I route I should get
| from | to | route | # | | from | to | route | # |
| b | c | bj,jc,jc | normal turn | | e | s | ej,js,js | normal turn |
| b | a | bj,jc,jc,aj,aj | avoids right turn | | e | n | ej,js,js,nj,nj | avoids right turn |
| b | d | bj,jd,jd | normal maneuver | | e | p | ej,jp,jp | normal maneuver |
@only_turning @conditionals @only_turning @conditionals
Scenario: Car - only_left_turn Scenario: Car - only_left_turn
@@ -454,27 +454,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) | | restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,jc,jc,aj,aj | | e | n | ej,js,js,nj,nj |
| b | d | bj,jc,jc,jd,jd | | e | p | ej,js,js,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - No left turn Scenario: Car - No left turn
@@ -484,27 +484,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) | | restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,aj,aj,jc,jc | | e | s | ej,nj,nj,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Conditional restriction is off Scenario: Car - Conditional restriction is off
@@ -514,27 +514,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) | | restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,aj,aj | | e | n | ej,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Conditional restriction is on Scenario: Car - Conditional restriction is on
@@ -544,27 +544,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map Given the node map
""" """
a n
d j b p j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| bj | yes | | ej | yes |
| jd | yes | | jp | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) | | restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| b | c | bj,jc,jc | | e | s | ej,js,js |
| b | a | bj,jc,jc,aj,aj | | e | n | ej,js,js,nj,nj |
| b | d | bj,jd,jd | | e | p | ej,jp,jp |
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows Scenario: Car - Conditional restriction with multiple time windows
@@ -575,28 +575,28 @@ Feature: Car - Turn restrictions
Given the node map Given the node map
""" """
a n
p | p |
\ | \ |
j j
| \ | \
c m s m
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| aj | no | | nj | no |
| jc | no | | js | no |
| jp | yes | | jp | yes |
| mj | yes | | mj | yes |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:conditional | | type | way:from | way:to | node:via | restriction:conditional |
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) | | restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | p | aj,jc,jc,jp,jp | | n | p | nj,js,js,jp,jp |
| m | p | mj,jp,jp | | m | p | mj,jp,jp |
@restriction-way @restriction-way
@@ -677,7 +677,7 @@ Feature: Car - Turn restrictions
# https://www.openstreetmap.org/#map=18/38.91099/-77.00888 # https://www.openstreetmap.org/#map=18/38.91099/-77.00888
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - DC North capitol situation, two on one off Scenario: Car - DC North capitol situation, two on one off
Given the extract extra arguments "--parse-conditional-restrictions" Given the extract extra arguments "--parse-conditional-restrictions=1"
# 9pm Wed 02 May, 2017 UTC, 5pm EDT # 9pm Wed 02 May, 2017 UTC, 5pm EDT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200" Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
@@ -724,7 +724,7 @@ Feature: Car - Turn restrictions
@no_turning @conditionals @no_turning @conditionals
Scenario: Car - DC North capitol situation, one on two off Scenario: Car - DC North capitol situation, one on two off
Given the extract extra arguments "--parse-conditional-restrictions" Given the extract extra arguments "--parse-conditional-restrictions=1"
# 10:30am utc, wed, 6:30am est # 10:30am utc, wed, 6:30am est
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400" Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
@@ -848,7 +848,7 @@ Feature: Car - Turn restrictions
@only_turning @conditionals @only_turning @conditionals
Scenario: Car - Somewhere in London, the UK, GMT timezone Scenario: Car - Somewhere in London, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions" Given the extract extra arguments "--parse-conditional-restrictions=1"
# 9am UTC, 10am BST # 9am UTC, 10am BST
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000" Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
@@ -884,7 +884,7 @@ Feature: Car - Turn restrictions
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive | | a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive | | a | e | albic,dobe,dobe | depart,turn left,arrive |
@no_turning @conditionals @restriction-way @no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions" Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT # 5pm Wed 02 May, 2017 GMT
@@ -1054,3 +1054,4 @@ Feature: Car - Turn restrictions
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f | | a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d | | c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f | | c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
-54
View File
@@ -131,57 +131,3 @@ Feature: Car - Destination only, no passing through
| e | a | acbe,acbe | | e | a | acbe,acbe |
| d | a | de,acbe,acbe | | d | a | de,acbe,acbe |
| c | d | cd,cd | | c | d | cd,cd |
Scenario: Car - Routing through a parking lot tagged access=destination,service
Given the node map
"""
a----c++++b+++g----h---i
| + + + |
| + + + |
| + + + |
| d++++e+f /
z---------------y
"""
And the ways
| nodes | access | highway |
| ac | | secondary |
| ghi | | secondary |
| azyhi | | secondary |
| cd | destination | service |
| def | destination | service |
| cbg | destination | service |
| be | destination | service |
| gf | destination | service |
When I route I should get
| from | to | route |
| a | i | azyhi,azyhi |
| b | f | be,def,def |
Scenario: Car - Disallow snapping to access=private,highway=service
Given a grid size of 20 meters
Given the node map
"""
a---c---b
:
x
:
d
\__e
"""
And the ways
| nodes | access | highway |
| acb | | primary |
| cx | private | service |
| xd | private | service |
| de | | primary |
When I route I should get
| from | to | route |
| a | x | acb,xd,xd |
| a | d | acb,xd,xd |
| a | e | acb,xd,de |
| x | e | de,de |
# do not snap to access=private,highway=service roads when routing over them is not necessary
-50
View File
@@ -1,50 +0,0 @@
@routing @car
Feature: Car - Handle physical limitation
Background:
Given the profile "car"
Scenario: Car - Use a narrow way
Then routability should be
| highway | width | narrow | bothw |
| primary | | | x |
| primary | narrow | | x |
| primary | | yes | x |
| primary | 1.8 | | |
| primary | 1.9 | | |
| primary | 2.0 | | x |
| primary | 2.1 | | x |
| primary | 1m | | |
| primary | 1 m | | |
| primary | 3 m | | x |
| primary | 6' | | |
| primary | 6'0" | | |
| primary | 6'2" | | |
| primary | 6'3" | | x |
| primary | 7' | | x |
| primary | 7'0" | | x |
Scenario: Car - Limited by width
Then routability should be
| highway | maxwidth:physical | maxwidth | width | est_width | bothw |
| primary | 1 | | | | |
| primary | 3 | | | | x |
| primary | | 1 | | | |
| primary | | 3 | | | x |
| primary | | | 1 | | |
| primary | | | 3 | | x |
| primary | | | | 1 | |
| primary | | | | 3 | x |
Scenario: Car - Limited by height
Then routability should be
| highway | maxheight:physical | maxheight | bothw |
| primary | | | x |
| primary | 1 | | |
| primary | 3 | | x |
| primary | | 1 | |
| primary | | 3 | x |
| primary | | default | x |
| primary | | none | x |
| primary | | no-sign | x |
| primary | | unsigned | x |
+138 -196
View File
@@ -11,27 +11,27 @@ Feature: Car - Turn restrictions
Scenario: Car - No left turn Scenario: Car - No left turn
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | dj | j | no_left_turn | | restriction | sj | wj | j | no_left_turn |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | | | s | w | |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@no_turning @no_turning
Scenario: Car - No straight on Scenario: Car - No straight on
@@ -67,286 +67,253 @@ Feature: Car - Turn restrictions
Scenario: Car - No right turn Scenario: Car - No right turn
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | bj | j | no_right_turn | | restriction | sj | ej | j | no_right_turn |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | cj,dj,dj | | s | w | sj,wj,wj |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | | | s | e | |
@no_turning @no_turning
Scenario: Car - No u-turn Scenario: Car - No u-turn
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | dj | j | no_u_turn | | restriction | sj | wj | j | no_u_turn |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | | | s | w | |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@no_turning @no_turning
Scenario: Car - Handle any no_* relation Scenario: Car - Handle any no_* relation
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | dj | j | no_weird_zigzags | | restriction | sj | wj | j | no_weird_zigzags |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | | | s | w | |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@no_turning
Scenario: Car - Ignore no_*_on_red relations
Given the node map
"""
a
d j b
c
"""
And the ways
| nodes | oneway |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | cj | dj | j | no_turn_on_red |
| restriction | cj | bj | j | no_right_turn_on_red |
When I route I should get
| from | to | route |
| c | d | cj,dj,dj |
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@only_turning @only_turning
Scenario: Car - Only left turn Scenario: Car - Only left turn
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | dj | j | only_left_turn | | restriction | sj | wj | j | only_left_turn |
When I route I should get
| from | to | route |
| c | a | |
| c | b | |
| c | d | cj,dj,dj |
Scenario: Car - Only right turn, invalid Scenario: Car - Only right turn, invalid
Given the node map Given the node map
""" """
a n
d j b r w j e r
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
| rb | -1 | | re | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | br | j | only_right_on | | restriction | sj | er | j | only_right_on |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | r | cj,bj,rb,rb | | s | r | sj,ej,re,re |
@only_turning @only_turning
Scenario: Car - Only right turn Scenario: Car - Only right turn
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | bj | j | only_right_turn | | restriction | sj | ej | j | only_right_turn |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | | | s | w | |
| c | a | | | s | n | |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@only_turning @only_turning
Scenario: Car - Only straight on Scenario: Car - Only straight on
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | aj | j | only_straight_on | | restriction | sj | nj | j | only_straight_on |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | | | s | w | |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | | | s | e | |
@no_turning @no_turning
Scenario: Car - Handle any only_* restriction Scenario: Car - Handle any only_* restriction
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | aj | j | only_weird_zigzags | | restriction | sj | nj | j | only_weird_zigzags |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | | | s | w | |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | | | s | e | |
@specific @specific
Scenario: Car - :hgv-qualified on a standard turn restriction Scenario: Car - :hgv-qualified on a standard turn restriction
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:hgv | | type | way:from | way:to | node:via | restriction:hgv |
| restriction | cj | aj | j | no_straight_on | | restriction | sj | nj | j | no_straight_on |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | cj,dj,dj | | s | w | sj,wj,wj |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@specific @specific
Scenario: Car - :motorcar-qualified on a standard turn restriction Scenario: Car - :motorcar-qualified on a standard turn restriction
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction:motorcar | | type | way:from | way:to | node:via | restriction:motorcar |
| restriction | cj | aj | j | no_straight_on | | restriction | sj | nj | j | no_straight_on |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | cj,dj,dj | | s | w | sj,wj,wj |
| c | a | | | s | n | |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@except @except
Scenario: Car - Except tag and on no_ restrictions Scenario: Car - Except tag and on no_ restrictions
@@ -517,27 +484,27 @@ Feature: Car - Turn restrictions
Scenario: Car - Ignore unrecognized restriction Scenario: Car - Ignore unrecognized restriction
Given the node map Given the node map
""" """
a n
d j b w j e
c s
""" """
And the ways And the ways
| nodes | oneway | | nodes | oneway |
| cj | yes | | sj | yes |
| aj | -1 | | nj | -1 |
| dj | -1 | | wj | -1 |
| bj | -1 | | ej | -1 |
And the relations And the relations
| type | way:from | way:to | node:via | restriction | | type | way:from | way:to | node:via | restriction |
| restriction | cj | dj | j | yield | | restriction | sj | wj | j | yield |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| c | d | cj,dj,dj | | s | w | sj,wj,wj |
| c | a | cj,aj,aj | | s | n | sj,nj,nj |
| c | b | cj,bj,bj | | s | e | sj,ej,ej |
@restriction @compression @restriction @compression
Scenario: Restriction On Compressed Geometry Scenario: Restriction On Compressed Geometry
@@ -602,7 +569,7 @@ Feature: Car - Turn restrictions
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d | | c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f | | c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
@restriction-way @overlap @restriction @overlap
Scenario: Car - prohibit turn Scenario: Car - prohibit turn
Given the node map Given the node map
""" """
@@ -737,7 +704,7 @@ Feature: Car - Turn restrictions
| a | j | left,first,right,right | | a | j | left,first,right,right |
| f | e | right,third,left,left | | f | e | right,third,left,left |
@restriction-way @restriction
Scenario: Car - allow only turn Scenario: Car - allow only turn
Given the node map Given the node map
""" """
@@ -769,7 +736,7 @@ Feature: Car - Turn restrictions
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d | | c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f | | c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
@restriction-way @restriction
Scenario: Car - allow only turn Scenario: Car - allow only turn
Given the node map Given the node map
""" """
@@ -798,7 +765,7 @@ Feature: Car - Turn restrictions
| from | to | route | | from | to | route |
| a | d | ab,be,de,de | | a | d | ab,be,de,de |
@restriction-way @restriction
Scenario: Multi Way restriction Scenario: Multi Way restriction
Given the node map Given the node map
""" """
@@ -835,7 +802,7 @@ Feature: Car - Turn restrictions
| from | to | route | | from | to | route |
| a | h | horiz,vert,horiz,horiz | | a | h | horiz,vert,horiz,horiz |
@restriction-way @restriction
Scenario: Multi-Way overlapping single-way Scenario: Multi-Way overlapping single-way
Given the node map Given the node map
""" """
@@ -874,7 +841,7 @@ Feature: Car - Turn restrictions
| h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d | | h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d |
@restriction-way @restriction
Scenario: Car - prohibit turn, traffic lights Scenario: Car - prohibit turn, traffic lights
Given the node map Given the node map
""" """
@@ -917,7 +884,7 @@ Feature: Car - Turn restrictions
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f | | c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
@restriction-way @overlap @geometry @restriction @overlap @geometry
Scenario: Geometry Scenario: Geometry
Given the node map Given the node map
""" """
@@ -952,7 +919,7 @@ Feature: Car - Turn restrictions
| c | d | bc,bge,de,de | | c | d | bc,bge,de,de |
| c | f | bc,bge,de,de,ef,ef | | c | f | bc,bge,de,de,ef,ef |
@restriction-way @overlap @geometry @traffic-signals @restriction @overlap @geometry @traffic-signals
Scenario: Geometry Scenario: Geometry
Given the node map Given the node map
""" """
@@ -994,7 +961,7 @@ Feature: Car - Turn restrictions
| c | f | bc,bge,de,de,ef,ef | | c | f | bc,bge,de,de,ef,ef |
# don't crash hard on invalid restrictions # don't crash hard on invalid restrictions
@restriction-way @invalid @restriction @invalid
Scenario: Geometry Scenario: Geometry
Given the node map Given the node map
""" """
@@ -1026,7 +993,7 @@ Feature: Car - Turn restrictions
| a | f | ab,be,ef,ef | | a | f | ab,be,ef,ef |
@restriction @restriction-way @overlap @geometry @restriction @overlap @geometry
Scenario: Duplicated restriction Scenario: Duplicated restriction
Given the node map Given the node map
""" """
@@ -1061,28 +1028,3 @@ Feature: Car - Turn restrictions
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | d | ab,bc,bc,bge,de,de | | a | d | ab,bc,bc,bge,de,de |
Scenario: Ambiguous ways
Given the node map
"""
x---a----b-----c---z
|
d
"""
And the ways
| nodes |
| abc |
| bd |
| xa |
| cz |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bd | abc | b | no_left_turn |
When I route I should get
| from | to | route |
| d | x | bd,abc,xa,xa |
| d | z | bd,abc,cz,cz |
-329
View File
@@ -1,329 +0,0 @@
@routing @car @relations
Feature: Car - route relations
Background:
Given the profile "car"
Scenario: Assignment using relation membership roles
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
c----------------d
"""
And the ways
| nodes | name | highway | ref |
| ba | westbound | motorway | I 80 |
| cd | eastbound | motorway | I 80;CO 93 |
And the relations
| type | way:east | way:west | route | ref | network |
| route | cd | ba | road | 80 | US:I |
| route | cd | ba | road | 93 | US:CO |
When I route I should get
| waypoints | route | ref |
| b,a | westbound,westbound | I 80 $west,I 80 $west |
| c,d | eastbound,eastbound | I 80 $east; CO 93 $east,I 80 $east; CO 93 $east |
Scenario: No cardinal directions by default
Given the profile file "car" initialized with
"""
profile.cardinal_directions = false
"""
Given the node map
"""
a----------------b
c----------------d
"""
And the ways
| nodes | name | highway | ref |
| ba | westbound | motorway | I 80 |
| cd | eastbound | motorway | I 80;CO 93 |
And the relations
| type | way:east | way:west | route | ref | network |
| route | cd | ba | road | 80 | US:I |
| route | cd | ba | road | 93 | US:CO |
When I route I should get
| waypoints | route | ref |
| b,a | westbound,westbound | I 80,I 80 |
| c,d | eastbound,eastbound | I 80; CO 93,I 80; CO 93 |
Scenario: No cardinal directions by default
Given the node map
"""
a----------------b
c----------------d
"""
And the ways
| nodes | name | highway | ref |
| ba | westbound | motorway | I 80 |
| cd | eastbound | motorway | I 80;CO 93 |
And the relations
| type | way:east | way:west | route | ref | network |
| route | cd | ba | road | 80 | US:I |
| route | cd | ba | road | 93 | US:CO |
When I route I should get
| waypoints | route | ref |
| b,a | westbound,westbound | I 80,I 80 |
| c,d | eastbound,eastbound | I 80; CO 93,I 80; CO 93 |
Scenario: Assignment using relation direction property (no role on members)
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
c----------------d
"""
And the ways
| nodes | name | highway | ref |
| ba | westbound | motorway | I 80 |
| cd | eastbound | motorway | I 80;CO 93 |
And the relations
| type | direction | way | route | ref | network |
| route | west | ba | road | 80 | US:I |
| route | east | cd | road | 80 | US:I |
| route | east | cd | road | 93 | US:CO |
When I route I should get
| waypoints | route | ref |
| b,a | westbound,westbound | I 80 $west,I 80 $west |
| c,d | eastbound,eastbound | I 80 $east; CO 93 $east,I 80 $east; CO 93 $east |
Scenario: Forward assignment on one-way roads using relation direction property
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
c----------------d
"""
And the ways
| nodes | name | highway | ref |
| ba | westbound | motorway | I 80 |
| cd | eastbound | motorway | I 80;CO 93 |
And the relations
| type | direction | way:forward | route | ref | network |
| route | west | ba | road | 80 | US:I |
| route | east | cd | road | 80 | US:I |
| route | east | cd | road | 93 | US:CO |
When I route I should get
| waypoints | route | ref |
| b,a | westbound,westbound | I 80 $west,I 80 $west |
| c,d | eastbound,eastbound | I 80 $east; CO 93 $east,I 80 $east; CO 93 $east |
Scenario: Forward/backward assignment on non-divided roads with role direction tag
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
"""
And the ways
| nodes | name | highway | ref | oneway |
| ab | mainroad | motorway | I 80 | no |
And the relations
| type | direction | way:forward | route | ref | network |
| route | west | ab | road | 80 | US:I |
And the relations
| type | direction | way:backward | route | ref | network |
| route | east | ab | road | 80 | US:I |
When I route I should get
| waypoints | route | ref |
| a,b | mainroad,mainroad | I 80 $west,I 80 $west |
| b,a | mainroad,mainroad | I 80 $east,I 80 $east |
Scenario: Conflict between role and direction
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
"""
And the ways
| nodes | name | highway | ref |
| ab | eastbound | motorway | I 80 |
And the relations
| type | direction | way:east | route | ref | network |
| route | west | ab | road | 80 | US:I |
When I route I should get
| waypoints | route | ref |
| a,b | eastbound,eastbound | I 80,I 80 |
Scenario: Conflict between role and superrelation direction
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
"""
And the ways
| nodes | name | highway | ref |
| ab | eastbound | motorway | I 80 |
And the relations
| type | way:east | route | ref | network | name |
| route | ab | road | 80 | US:I | baserelation |
And the relations
| type | direction | relation | route | ref | network | name |
| route | west | baserelation | road | 80 | US:I | superrelation |
When I route I should get
| waypoints | route | ref |
| a,b | eastbound,eastbound | I 80,I 80 |
Scenario: Conflict between role and superrelation role
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
"""
And the ways
| nodes | name | highway | ref |
| ab | eastbound | motorway | I 80 |
And the relations
| type | way:east | route | ref | network | name |
| route | ab | road | 80 | US:I | baserelation |
And the relations
| type | relation:west | route | ref | network | name |
| route | baserelation | road | 80 | US:I | superrelation |
When I route I should get
| waypoints | route | ref |
| a,b | eastbound,eastbound | I 80,I 80 |
Scenario: Direction only available via superrelation role
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
"""
And the ways
| nodes | name | highway | ref |
| ab | eastbound | motorway | I 80 |
And the relations
| type | way:forward | route | ref | network | name |
| route | ab | road | 80 | US:I | baserelation |
And the relations
| type | relation:east | route | ref | network | name |
| route | baserelation | road | 80 | US:I | superrelation |
When I route I should get
| waypoints | route | ref |
| a,b | eastbound,eastbound | I 80 $east,I 80 $east |
Scenario: Direction only available via superrelation direction
Given the profile file "car" initialized with
"""
profile.cardinal_directions = true
"""
Given the node map
"""
a----------------b
"""
And the ways
| nodes | name | highway | ref |
| ab | eastbound | motorway | I 80 |
And the relations
| type | way:forward | route | ref | network | name |
| route | ab | road | 80 | US:I | baserelation |
And the relations
| type | direction | relation | route | ref | network | name |
| route | east | baserelation | road | 80 | US:I | superrelation |
When I route I should get
| waypoints | route | ref |
| a,b | eastbound,eastbound | I 80 $east,I 80 $east |
# Scenario: Three levels of indirection
# Given the node map
# """
# a----------------b
# """
#
# And the ways
# | nodes | name | highway | ref |
# | ab | eastbound | motorway | I 80 |
#
# And the relations
# | type | way:forward | route | ref | network | name |
# | route | ab | road | 80 | US:I | baserelation |
#
# And the relations
# | type | relation | route | ref | network | name |
# | route | baserelation | road | 80 | US:I | superrelation1 |
#
# And the relations
# | type | direction | relation | route | ref | network | name |
# | route | east | superrelation1 | road | 80 | US:I | superrelation2 |
#
# When I route I should get
# | waypoints | route | ref |
# | a,b | eastbound,eastbound | I 80 $east,I 80 $east |
+28 -122
View File
@@ -4,7 +4,30 @@ Feature: Testbot - side bias
Scenario: Left-hand bias Scenario: Left-hand bias
Given the profile file "car" initialized with Given the profile file "car" initialized with
""" """
profile.properties.left_hand_driving = true profile.left_hand_driving = true
profile.turn_bias = 1/1.075
"""
Given the node map
"""
a b c
d
"""
And the ways
| nodes |
| ab |
| bc |
| bd |
When I route I should get
| from | to | route | time |
| d | a | bd,ab,ab | 24s +-1 |
| d | c | bd,bc,bc | 27s +-1 |
Scenario: Right-hand bias
Given the profile file "car" initialized with
"""
profile.left_hand_driving = true
profile.turn_bias = 1.075 profile.turn_bias = 1.075
""" """
And the node map And the node map
@@ -20,124 +43,7 @@ Feature: Testbot - side bias
| bd | | bd |
When I route I should get When I route I should get
| from | to | route | time | driving_side | | from | to | route | time |
| d | a | bd,ab,ab | 24s +-1 | left,left,left | | d | a | bd,ab,ab | 27s +-1 |
| d | c | bd,bc,bc | 27s +-1 | left,left,left | # should be inverse of left hand bias
| d | c | bd,bc,bc | 24s +-1 |
Scenario: Right-hand bias
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
profile.turn_bias = 1 / 1.075
"""
And the node map
"""
a b c
d
"""
And the ways
| nodes |
| ab |
| bc |
| bd |
When I route I should get
| from | to | route | time | driving_side | # |
| d | a | bd,ab,ab | 27s +-1 | left,left,left | should be inverse of left hand bias |
| d | c | bd,bc,bc | 24s +-1 | left,left,left | |
Scenario: Roundabout exit counting for left sided driving
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
"""
And a grid size of 10 meters
And the node map
"""
a
b
h g c d
e
f
"""
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bcegb | roundabout |
When I route I should get
| waypoints | route | driving_side | turns |
| a,d | ab,cd,cd | left,left,left | depart,roundabout turn left exit-1,arrive |
| a,f | ab,ef,ef | left,left,left | depart,roundabout turn straight exit-2,arrive |
| a,h | ab,gh,gh | left,left,left | depart,roundabout turn right exit-3,arrive |
Scenario: Left-hand bias via location-dependent tags
Given the profile "car"
And the node map
"""
a b c
d
"""
And the ways with locations
| nodes |
| ab |
| bc |
| bd |
And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson"
When I route I should get
| from | to | route | driving_side | time |
| d | a | bd,ab,ab | left,left,left | 24s +-1 |
| d | c | bd,bc,bc | left,left,left | 27s +-1 |
Scenario: Left-hand bias via OSM tags
Given the profile "car"
And the node map
"""
a b c
d
"""
And the ways with locations
| nodes | driving_side |
| ab | right |
| bc | right |
| bd | right |
And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson"
When I route I should get
| from | to | route | driving_side | time |
| d | a | bd,ab,ab | right,right,right | 27s +-1 |
| d | c | bd,bc,bc | right,right,right | 24s +-1 |
Scenario: changing sides
Given the profile "car"
# Note - the boundary in null-island.geojson is at lon = 2.0,
# and we use the "last node of the way" as the heuristic to detect
# whether the way is in our out of the driving_side polygon
And the node locations
| node | lat | lon |
| a | 0 | 0.5 |
| b | 0 | 1.5 |
| c | 0 | 2.5 |
| d | 0 | 3.5 |
And the ways
| nodes |
| ab |
| bc |
| cd |
And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson"
When I route I should get
| from | to | route | driving_side |
| d | a | cd,bc,ab,ab | right,right,left,left |
| a | d | ab,bc,cd,cd | left,right,right,right |
+1 -1
View File
@@ -76,7 +76,7 @@ Feature: Basic Routing
When I route I should get When I route I should get
| waypoints | route | summary | | waypoints | route | summary |
| a,c | ,, | 100, 101 | | a,c | , | 100, 101 |
Scenario: Single Ref Scenario: Single Ref
Given the node map Given the node map
+5 -5
View File
@@ -6,9 +6,9 @@ Feature: Car - weights
And the node map And the node map
""" """
a--b--c a--b--c
| | |
d | d
| | |
e--f--g e--f--g
""" """
And the ways And the ways
@@ -19,7 +19,7 @@ Feature: Car - weights
| bdf | service | | bdf | service |
When I route I should get When I route I should get
| from | to | route | speed | weight | | from | to | route | speed | weight |
| a | e | abc,cg,efg,efg | 29 km/h | 122.4 | | a | e | abc,cg,efg,efg | 28 km/h | 126.6 |
| a | d | abc,bdf,bdf | 18 km/h | 71.7 | | a | d | abc,bdf,bdf | 18 km/h | 71.7 |
Scenario: Does not jump off the highway to go down service road Scenario: Does not jump off the highway to go down service road
@@ -59,7 +59,7 @@ Feature: Car - weights
When I route I should get When I route I should get
| from | to | route | speed | weight | | from | to | route | speed | weight |
| a | d | ab,bc,cd,cd | 65 km/h | 44.4 | | a | d | ab,bc,cd,cd | 65 km/h | 44.4 |
| a | e | ab,be,be | 14 km/h | 111.8 | | a | e | ab,be,be | 14 km/h | 112 |
Scenario: Distance weights Scenario: Distance weights
Given the profile file "car" initialized with Given the profile file "car" initialized with
-1
View File
@@ -10,7 +10,6 @@ Feature: Barriers
| | x | | | x |
| bollard | x | | bollard | x |
| gate | x | | gate | x |
| lift_gate | x |
| cycle_barrier | x | | cycle_barrier | x |
| cattle_grid | x | | cattle_grid | x |
| border_control | x | | border_control | x |
-35
View File
@@ -1,35 +0,0 @@
@routing @foot
Feature: Foot - Use distance weight
Background:
Given a grid size of 200 meters
Scenario: Foot - Check distance weight
Given the profile file
"""
local functions = require('foot')
functions.setup_testbot = functions.setup
functions.setup = function()
local profile = functions.setup_testbot()
profile.properties.weight_name = 'distance'
return profile
end
return functions
"""
Given the node map
"""
a-b-c
"""
And the ways
| nodes | highway |
| abc | residential |
When I route I should get
| from | to | route | weight | time | distance |
| a | b | abc,abc | 200 | 144s | 200m +-1 |
| a | c | abc,abc | 400 | 288s | 400m +-1 |
+1 -1
View File
@@ -47,7 +47,7 @@ Feature: Turn Lane Guidance
e e
a . . b . . . c g a . . b . . . c g
` . ` .
` . ` .
` d ` d
f f
""" """
@@ -98,11 +98,11 @@ Feature: Car - Guidance - Bridges and Tunnels
| dce | primary | | Nebenstraße | | dce | primary | | Nebenstraße |
When I route I should get When I route I should get
| from | to | route | turns | | from | to | route | turns |
| a | d | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road left,arrive | | a | d | Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,arrive |
| a | e | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road right,arrive | | a | e | Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,arrive |
| e | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn left,arrive | | e | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn left,arrive |
| d | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn right,arrive | | d | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn right,arrive |
Scenario: Tunnel with Immediate Turn Front and Back Scenario: Tunnel with Immediate Turn Front and Back
Given the node map Given the node map
@@ -129,3 +129,4 @@ Feature: Car - Guidance - Bridges and Tunnels
| e | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn left,turn left,arrive | | e | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn left,turn left,arrive |
| d | f | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,turn right,arrive | | d | f | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,turn right,arrive |
| d | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,turn left,arrive | | d | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,turn left,arrive |
-29
View File
@@ -147,32 +147,3 @@ Feature: Collapse
| waypoints | route | turns | | waypoints | route | turns |
| a,d | road,left,left | depart,turn left,arrive | | a,d | road,left,left | depart,turn left,arrive |
| a,e | road,right,right | depart,turn right,arrive | | a,e | road,right,right | depart,turn right,arrive |
# https://www.openstreetmap.org/#map=18/53.89755/27.54306
Scenario: Wide turn into invalid u-turn
Given the node map
"""
g
|
|
f - - - - e
|
|
|
h - - d
|
|
|
a - - - - b - - - - c
"""
And the ways
| nodes | highway | name |
| abc | secondary | road |
| bdfg | service | |
| hd | service | |
| fe | service | |
When I route I should get
| waypoints | route | turns |
| c,e | road,,, | depart,turn right,turn right,arrive |
-50
View File
@@ -50,32 +50,6 @@ Feature: Collapse
| i,h | second,first,first | depart,turn left,arrive | i,f,h | | i,h | second,first,first | depart,turn left,arrive | i,f,h |
| i,l | second,second,second | depart,continue uturn,arrive | i,f,l | | i,l | second,second,second | depart,continue uturn,arrive | i,f,l |
Scenario: Segregated Intersection, Cross Belonging to Single Street
Given the node map
"""
g
c b a
d e f
h i
"""
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | first | yes |
| de | primary | first | yes |
| ef | primary | first | yes |
| gb | primary | second | no |
| be | primary | second | no |
| eh | primary | second | yes |
| ei | primary | third | yes |
When I route I should get
| waypoints | route | turns | locations |
| a,i | first,second,third,third | depart,turn left,turn slight left,arrive | a,b,e,i |
Scenario: Segregated Intersection, Cross Belonging to Correct Street Scenario: Segregated Intersection, Cross Belonging to Correct Street
Given the node map Given the node map
""" """
@@ -1100,27 +1074,3 @@ Feature: Collapse
When I route I should get When I route I should get
| waypoints | bearings | route | turns | locations | | waypoints | bearings | route | turns | locations |
| 1,2 | 90 270 | ab,bd,bd,ab,ab | depart,turn left,continue uturn,turn right,arrive | _,b,d,b,_ | | 1,2 | 90 270 | ab,bd,bd,ab,ab | depart,turn left,continue uturn,turn right,arrive | _,b,d,b,_ |
# https://www.openstreetmap.org/#map=18/37.74844/-122.40275
Scenario: Don't use destinations as names
Given the node map
"""
f - - - - e - - - - d
|
|
|
|
|
a - - - - b - - - - c
"""
And the ways
| nodes | highway | name | oneway | destination:ref |
| abc | residential | road | yes | |
| def | motorway_link | | yes | US 101 |
| be | residential | cross | no | |
When I route I should get
| waypoints | route | turns |
| a,f | road,cross,, | depart,turn left,on ramp left,arrive |
-34
View File
@@ -22,40 +22,6 @@ Feature: Continue Instructions
| a,c | abc,abc,abc | depart,continue left,arrive | | a,c | abc,abc,abc | depart,continue left,arrive |
| a,d | abc,bd,bd | depart,turn straight,arrive | | a,d | abc,bd,bd | depart,turn straight,arrive |
Scenario: Road turning left, Suffix changes
Given the node map
"""
c
a - b-d
"""
And the ways
| nodes | highway | name |
| ab | primary | North Capitol Northeast |
| bc | primary | North Capitol Northwest |
| bd | primary | some random street |
When I route I should get
| waypoints | route | turns |
| a,c | North Capitol Northeast,North Capitol Northwest,North Capitol Northwest | depart,continue left,arrive |
Scenario: Road turning left, Suffix changes, no-spaces
Given the node map
"""
c
a - b-d
"""
And the ways
| nodes | highway | name |
| ab | primary | North CapitolNortheast |
| bc | primary | North CapitolNorthwest |
| bd | primary | some random street |
When I route I should get
| waypoints | route | turns |
| a,c | North CapitolNortheast,North CapitolNorthwest,North CapitolNorthwest | depart,continue left,arrive |
Scenario: Road turning left and straight Scenario: Road turning left and straight
Given the node map Given the node map
""" """
+2 -103
View File
@@ -992,108 +992,7 @@ Feature: Slipways and Dedicated Turn Lanes
| dbef | primary | dbef | | | dbef | primary | dbef | |
| ae | primary_link | ae | yes | | ae | primary_link | ae | yes |
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations |
| s,f | sabc,dbef,dbef | depart,turn right,arrive | s,a,f | | s,f | sabc,dbef,dbef | depart,turn right,arrive | s,a,f |
@sliproads
Scenario: Sliproad from link via link to primary
Given the node map
"""
d
.
s . a . b
` .
` .
'.
c
.
f
"""
And the ways
| nodes | highway | name | oneway |
| sab | primary_link | sab | |
| dbcf | primary | dbcf | |
| ac | primary_link | ae | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | sab,dbcf,dbcf | depart,turn right,arrive | s,a,f |
@sliproads
Scenario: Sliproad with a single intersection in a cross-road
Given the node map
"""
d
.
s . a . b
` .
' c . g
..
e
.
f
"""
And the ways
| nodes | highway | name | oneway |
| sab | primary | sab | |
| dbcef | primary | dbcef | |
| ae | primary_link | sab | yes |
| cg | primary | cg | |
When I route I should get
| waypoints | route | turns | locations |
| s,f | sab,dbcef,dbcef | depart,turn right,arrive | s,a,f |
@sliproads
Scenario: Sliproad converted from a fork
Given the node map
"""
d
.
b
s . a '.
`c
.
f
"""
And the ways
| nodes | highway | name | ref | oneway |
| sa | tertiary | | D 60A | yes |
| ab | tertiary | ab | D 60A | yes |
| ac | tertiary | | D 60A | yes |
| dbcf | tertiary | dbcf | D 543 | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | ,dbcf,dbcf | depart,turn right,arrive | s,a,f |
@sliproads
Scenario: Sliproad to a road with a reference only
Given the node map
"""
s . a . b . d
` .
' .
..
c
.
f
"""
And the ways
| nodes | highway | name | ref | oneway |
| sabd | primary | road | | |
| bcf | primary | | K108 | |
| ac | primary_link | | | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | road,, | depart,turn right,arrive | s,a,f |
-223
View File
@@ -1,223 +0,0 @@
# The route results with #original are what the result should be if the maneuver tag is removed
@routing @guidance @maneuver
Feature: Maneuver tag support
Background:
Given the profile "car"
Given a grid size of 5 meters
Scenario: simple override #1
Given the node map
"""
a--b---c----d---e
|
g
|
h------i--------j
"""
And the ways
| nodes | name | oneway |
| abc | A Street | no |
| cde | B Street | no |
| cgi | C Street | no |
| hij | J Street | no |
And the relations
| type | way:from | node:via | way:to | maneuver | direction |
| maneuver | abc | c | cgi | turn | sharp_right |
| maneuver | hij | i | cde | turn | sharp_left |
| maneuver | abc | c | cde | turn | slight_left |
When I route I should get
| waypoints | route | turns |
# Testing directly connected from/to
| a,j | A Street,C Street,J Street,J Street | depart,turn sharp right,turn left,arrive |
| b,g | A Street,C Street,C Street | depart,turn sharp right,arrive |
# Testing re-awakening suppressed turns
| a,e | A Street,B Street,B Street | depart,turn slight left,arrive |
Scenario: single via-way
Given the node map
""""
a--b---c----d---e
|
g
|
h------i--------j
"""
And the ways
| nodes | name | oneway |
| abc | A Street | no |
| cde | B Street | no |
| cgi | C Street | no |
| hi | J Street | no |
| ij | J Street | no |
And the relations
| type | way:from | way:via | way:to | node:via | maneuver | direction |
| maneuver | abc | cgi | ij | c | turn | sharp_right |
When I route I should get
| waypoints | route | turns |
| a,j | A Street,C Street,J Street,J Street | depart,turn sharp right,turn left,arrive |
Scenario: multiple via-way
Given the node map
""""
a--b---c----d---e
|
g-----k
|
h------i--------j
"""
And the ways
| nodes | name | oneway |
| abc | A Street | no |
| cde | B Street | no |
| cg | C Street | no |
| gi | C Street | no |
| hi | J Street | no |
| ij | J Street | no |
| gk | G Street | no |
And the relations
| type | way:from | way:via | way:via | way:to | node:via | maneuver | direction |
| maneuver | abc | cg | gi | ij | c | turn | sharp_right |
When I route I should get
| waypoints | route | turns |
| a,j | A Street,C Street,J Street,J Street | depart,turn sharp right,end of road left,arrive |
Scenario: Use maneuver tag to announce a particular turn type
Given the node map
"""
f
*
*
*
*
*
*
*
*
*
t. .. * h
.. ....m** *
/ * *
/ * * *
/
/
|
|
\
\
o
"""
And the ways
| nodes | name | oneway | highway |
| fm | CA-120 | no | secondary |
| mh | CA-120 | no | secondary |
| mt | Priest Rd | no | unclassified |
| mo | | no | service |
And the relations
| type | way:from | node:via | way:to | maneuver | direction |
| maneuver | mh | m | mt | turn | left |
When I route I should get
| waypoints | route | turns |
| h,t | CA-120,Priest Rd,Priest Rd | depart,turn left,arrive |
#original | h,t | CA-120,Priest Rd,Priest Rd | depart,turn straight,arrive |
Scenario: Use maneuver tag to announce lane guidance
Given a grid size of 10 meters
Given the node map
"""
ad
/ \
/ \
/ \
| |
| |
| |
b-----c------e
| |
| |
| |
| |
r w
"""
And the ways
| nodes | name | oneway | highway |
| ab | Marsh Rd | yes | secondary |
| br | Marsh Rd | yes | secondary |
| cd | Marsh Rd | yes | secondary |
| cw | Marsh Rd | yes | secondary |
| bc | service | no | service |
| ce | service | no | service |
And the relations
| type | way:from | node:via | way:via | way:to | maneuver |
| maneuver | ab | c | bc | cd | uturn |
| maneuver | ab | b | bc | cd | suppress |
When I route I should get
| waypoints | route | turns |
| a,d | Marsh Rd,Marsh Rd,Marsh Rd | depart,turn uturn,arrive |
#original | a,d | Marsh Rd,service,Marsh Rd,Marsh Rd | depart,turn left,turn left,arrive |
Scenario: Use maneuver tag to suppress a turn
Given the node map
"""
c
|
|
v---y----------z
|
n---p----------k
|\
| \
b t
"""
And the ways
| nodes | name | oneway | highway |
| zy | NY Ave | yes | primary |
| yv | NY Ave | yes | primary |
| np | NY Ave | yes | primary |
| pk | NY Ave | yes | primary |
| cp | 4th St | no | tertiary |
| yp | | no | motorway_link |
| pb | 4th St | no | primary |
| pt | 395 | no | primary |
And the relations
| type | way:from | node:via | way:via | way:to | maneuver | # |
| maneuver | zy | p | yp | pt | suppress | original: depart,on ramp left,fork slight left,arrive |
And the relations
| type | way:from | way:via | way:to | maneuver | # |
| maneuver | zy | yp | pb | suppress | invalid relation: missing node:via |
And the relations
| type | node:via | way:via | way:to | maneuver | # |
| maneuver | p | yp | pb | suppress | invalid relation: missing way:from |
And the relations
| type | way:from | node:via | way:via | maneuver | # |
| maneuver | zy | p | yp | suppress | invalid relation: missing way:to |
And the relations
| type | way:from | node:via | way:via | way:to | maneuver | # |
| maneuver | zy | y, p | yp | pb | suppress | invalid relation: multiple node:via |
When I route I should get
| waypoints | route | turns |
| z,t | NY Ave,395,395 | depart,on ramp left,arrive |
| z,b | NY Ave,,4th St,4th St | depart,on ramp left,fork slight right,arrive |
+16 -204
View File
@@ -354,9 +354,9 @@ Feature: Merge Segregated Roads
| hb | road | yes | | hb | road | yes |
When I route I should get When I route I should get
| waypoints | turns | route | intersections | | waypoints | turns | route | intersections |
| a,f | depart,arrive | road,road | true:180,false:0 true:180,false:0 true:180;true:0 | | a,f | depart,arrive | road,road | true:180,false:0 true:180,false:0 true:180;true:0 |
| c,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 | | c,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
| 1,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 | | 1,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
| f,a | depart,arrive | road,road | true:0,true:0 false:180,true:0 false:180;true:180 | | f,a | depart,arrive | road,road | true:0,true:0 false:180,true:0 false:180;true:180 |
| g,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 | | g,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
@@ -393,44 +393,31 @@ Feature: Merge Segregated Roads
""" """
a a
| |
b-----z b
/ \
c h c h
| | | |
| | | |
| | | |
| | | |
| |
| |
| |
| |
| |
d g d g
\ /
e e
| |
f f
""" """
And the ways And the ways
| nodes | name | oneway | | nodes | name | oneway |
| ab | road | no | | ab | road | no |
| ef | road | no | | ef | road | no |
| bcde | road | yes | | bcde | road | yes |
| eghb | road | yes | | eghb | road | yes |
| bz | cross | no |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bz | bcde | b | no_left_turn |
When I route I should get When I route I should get
| waypoints | turns | route | | waypoints | turns | route |
| a,f | depart,arrive | road,road | | a,f | depart,arrive | road,road |
| c,f | depart,arrive | road,road | | c,f | depart,arrive | road,road |
| f,a | depart,arrive | road,road | | f,a | depart,arrive | road,road |
| g,a | depart,arrive | road,road | | g,a | depart,arrive | road,road |
| z,a | depart,turn right,arrive | cross,road,road |
Scenario: Traffic Island Scenario: Traffic Island
Given the node map Given the node map
@@ -531,183 +518,8 @@ Feature: Merge Segregated Roads
# the goal here should be not to mention the intersection in the middle at all and also suppress the segregated parts # the goal here should be not to mention the intersection in the middle at all and also suppress the segregated parts
When I route I should get When I route I should get
| waypoints | route | intersections | | waypoints | route | intersections |
| a,l | horiz,vert,vert | true:90;false:0 true:60 true:90 true:180 false:270,true:60 false:120 false:240 false:300,true:0 false:90 false:180 false:240 true:270;true:180 | | a,l | horiz,vert,vert | true:90;false:0 true:60 true:90 true:180 false:270,true:60 false:120 false:240 false:300,true:0 false:90 false:180 false:240 true:270;true:180 |
| a,d | horiz,horiz | true:90,false:0 true:60 true:90 true:180 false:270,false:0 true:90 false:180 false:270 true:300;true:270 | | a,d | horiz,horiz | true:90,false:0 true:60 true:90 true:180 false:270,false:0 true:90 false:180 false:270 true:300;true:270 |
| j,h | vert,horiz,horiz | true:0;true:0 true:90 false:180 false:270 true:300,false:60 false:120 false:240 true:300,false:0 false:90 false:120 true:180 true:270;true:90 | | j,h | vert,horiz,horiz | true:0;true:0 true:90 false:180 false:270 true:300,false:60 false:120 false:240 true:300,false:0 false:90 false:120 true:180 true:270;true:90 |
| j,l | vert,vert | true:0,true:0 true:90 false:180 false:270 true:300,true:0 false:90 false:180 true:240 false:270;true:180 | | j,l | vert,vert | true:0,true:0 true:90 false:180 false:270 true:300,true:0 false:90 false:180 true:240 false:270;true:180 |
Scenario: Square Area - Don't merge almost circular roads
Given a grid size of 2 meters
Given the node map
"""
i
b `
` ` p .
a ` g` ` \ f
\ / o /
\ / \ /
h - - c n /
\ \/
k e
\ /
l /
\ /
m . d
/
j
"""
And the ways
| nodes | name | oneway |
| ac | Halenseestraße | yes |
| gb | Halenseestraße | yes |
| cklmdenopgc | Rathenauplatz | yes |
| ig | Kurfürstendamm | yes |
| ef | Kurfürstendamm | yes |
| ch | Hubertusallee | yes |
| jd | Hubertusallee | yes |
When I route I should get
| waypoints | route | turns |
| i,h | Kurfürstendamm,Rathenauplatz,Hubertusallee,Hubertusallee | depart,turn right,turn right,arrive |
# https://www.openstreetmap.org/#map=19/52.46339/13.40272
Scenario: Do not merge links between segregated roads
Given the node map
"""
f
`````````` ..............
` ` ` ` e - - - - - - - d
a 1
```````````.............. |
`````````` b - - - - - - - c
|
|
|
|
g
"""
And the ways
| nodes | name | oneway |
| ab | germ | yes |
| bc | ober | yes |
| de | ober | yes |
| ef | germ | yes |
| eb | germ | no |
| gb | germ | no |
When I route I should get
| waypoints | route | turns |
| a,c | germ,ober | depart,arrive |
| a,g | germ,germ,germ | depart,continue right,arrive |
| a,1 | germ,germ,germ | depart,continue left,arrive |
| d,g | ober,germ,germ | depart,turn left,arrive |
# https://www.openstreetmap.org/#map=19/51.32888/6.57059
Scenario: Places in presence of oneways
Given the node map
"""
i l
| |
| |
g - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - f
| |
| |
a - - - b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - - c - - - d
| |
| |
j k
"""
And the ways
| nodes | name | oneway |
| ab | schwert | yes |
| cd | schwert | yes |
| ig | luise | yes |
| bj | luise | yes |
| kc | marianne | yes |
| fl | marianne | yes |
| bc | albrecht | no |
| fg | albrecht | no |
| gb | albrecht | yes |
| cf | albrecht | yes |
When I route I should get
| waypoints | route | turns |
| a,l | schwert,albrecht,marianne,marianne | depart,new name straight,turn left,arrive |
| a,j | schwert,luise,luise | depart,turn right,arrive |
| a,1 | schwert,albrecht,albrecht,albrecht | depart,new name straight,continue uturn,arrive |
| k,l | marianne,marianne | depart,arrive |
| k,j | marianne,albrecht,luise,luise | depart,turn left,turn left,arrive |
| k,d | marianne,schwert,schwert | depart,turn right,arrive |
| i,j | luise,luise | depart,arrive |
| i,d | luise,albrecht,schwert,schwert | depart,turn left,turn straight,arrive |
| i,l | luise,albrecht,marianne,marianne | depart,turn left,turn left,arrive |
# https://www.openstreetmap.org/#map=19/52.46339/13.40272
Scenario: Do not merge links between segregated roads
Given the node map
"""
d
f............... |
`````````` .............. |
a............... ` ` ` ` e
``````````.............. 1
`````````` b
- - - - - - - c
"""
And the ways
| nodes | name | oneway |
| ab | otto | yes |
| bc | otto | no |
| de | neu | no |
| ef | otto | yes |
| eb | otto | no |
When I route I should get
| waypoints | route | turns | # |
| a,c | otto,otto | depart,arrive | |
| a,f | otto,otto,otto | depart,continue uturn,arrive | |
| a,1 | otto,otto,otto | depart,continue left,arrive | |
| a,d | otto,neu,neu | depart,turn left,arrive | |
| c,1 | otto,otto | depart,arrive | |
| c,f | otto,otto,otto | depart,continue left,arrive | Ideally, this would be depart,arrive, but the obvious discovery making the turn onto `1` from `c` obvious interferes here |
# https://www.openstreetmap.org/#map=18/50.94608/7.02030
Scenario: Do not merge oneway places
Given the node map
"""
j
|
|
g - f - - - - - - - e
| |
| |
| d
| \
| .c.
a - - - - - - b` `
| `
| ` h
|
|
i
"""
And the ways
| nodes | name | oneway |
| efabc | kobe | yes |
| edc | kobe | no |
| fg | arn | no |
| ia | kobu | yes |
| hc | wei | no |
| ej | wei | no |
When I route I should get
| waypoints | route | turns |
| j,h | wei,wei | depart,arrive |
| a,d | kobe,kobe,kobe | depart,continue left,arrive |
-21
View File
@@ -126,24 +126,3 @@ Feature: Merging
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| d,c | ,A100,A100 | depart,merge slight right,arrive | | d,c | ,A100,A100 | depart,merge slight right,arrive |
# https://www.openstreetmap.org/way/254299122
@merge
Scenario: Merge onto a motorway with junction references
Given the node map
"""
a b c d
e f
"""
And the ways
| nodes | name | junction:ref | highway | oneway |
| abc | A100 | | motorway | yes |
| cd | A100 | 1A | motorway | yes |
| eb | | | motorway_link | yes |
| cf | | 1B | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| e,d | ,A100,A100 | depart,merge slight left,arrive |
+1 -65
View File
@@ -81,7 +81,7 @@ Feature: Motorway Guidance
""" """
,g,e ,g,e
,f,d ,f,d
a-b-c a-b-c
""" """
And the ways And the ways
@@ -281,67 +281,3 @@ Feature: Motorway Guidance
| waypoints | route | turns | | waypoints | route | turns |
| a,d | , | depart,arrive | | a,d | , | depart,arrive |
| b,d | , | depart,arrive | | b,d | , | depart,arrive |
Scenario: Ramp Exit with Lower Priority
Given the node map
"""
a-b-c-d-e
`--f-g
"""
And the ways
| nodes | highway | oneway |
| abcde | trunk | |
| bfg | primary_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,off ramp slight right,arrive |
# https://www.openstreetmap.org/node/67366428#map=18/33.64613/-84.44425
Scenario: Ramp Bifurcations should not be suppressed
Given the node map
"""
/-----------c /-----------e
a---b------------------d------------f
"""
And the ways
| nodes | highway | name | destination |
| ab | motorway | | |
| bc | motorway_link | | City 17 |
| bd | motorway_link | | |
| de | motorway_link | | Domestic Terminal;Camp Creek Parkway;Riverdale Road |
| df | motorway_link | | Montgomery |
When I route I should get
| waypoints | route | turns |
| a,c | ,, | depart,fork slight left,arrive |
| a,e | ,,, | depart,fork slight right,fork slight left,arrive |
| a,f | ,,, | depart,fork slight right,fork slight right,arrive |
# https://www.openstreetmap.org/#map=19/53.46186/-2.24509
Scenario: Highway Fork with a Link
Given the node map
"""
/-----------d
a-b-c------------e
\-----------f
"""
And the ways
| nodes | highway |
| abce | motorway |
| cf | motorway |
| cd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abce,cd,cd | depart,off ramp slight left,arrive |
| a,e | abce,abce | depart,arrive |
| a,f | abce,cf,cf | depart,turn slight right,arrive |
+4 -19
View File
@@ -274,8 +274,8 @@ Feature: New-Name Instructions
| bc | Central Expressway | US 75 | motorway | | bc | Central Expressway | US 75 | motorway |
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| a,c | North Central Expressway,Central Expressway | depart,arrive | | a,c | North Central Expressway,Central Expressway,Central Expressway | depart,new name straight,arrive |
Scenario: Prefix Change Scenario: Prefix Change
Given the node map Given the node map
@@ -289,8 +289,8 @@ Feature: New-Name Instructions
| cb | Central Expressway | US 75 | motorway | | cb | Central Expressway | US 75 | motorway |
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| c,a | Central Expressway,North Central Expressway | depart,arrive | | c,a | Central Expressway,North Central Expressway,North Central Expressway | depart,new name straight,arrive |
Scenario: No Name, Same Reference Scenario: No Name, Same Reference
Given the node map Given the node map
@@ -382,21 +382,6 @@ Feature: New-Name Instructions
| waypoints | route | turns | | waypoints | route | turns |
| a,c | , | depart,arrive | | a,c | , | depart,arrive |
Scenario: No Name, Reference changed
Given the node map
"""
a ----- b ----- c
"""
And the ways
| nodes | name | ref | highway |
| ab | | US 322 | motorway |
| bc | | US 422 | motorway |
When I route I should get
| waypoints | route | turns |
| a,c | ,, | depart,new name straight,arrive |
Scenario: Spaces in refs for containment check, #3086 Scenario: Spaces in refs for containment check, #3086
Given the node map Given the node map
""" """
-30
View File
@@ -36,36 +36,6 @@ Feature: Simple Turns
| f,a | depart,arrive | road,road | true:0,true:0 false:150 false:180;true:180 | | f,a | depart,arrive | road,road | true:0,true:0 false:150 false:180;true:180 |
| e,a | depart,turn slight right,arrive | turn,road,road | true:333;true:0 false:150 false:180;true:180 | | e,a | depart,turn slight right,arrive | turn,road,road | true:333;true:0 false:150 false:180;true:180 |
Scenario: Turning into splitting road - no improvement
Given the node map
"""
a
b
/ |
c d - e
| |
| |
| |
| |
| |
| |
| |
| |
g f
"""
And the ways
| nodes | name | highway | oneway |
| ab | road | primary | no |
| bcg | road | primary | yes |
| fdb | road | primary | yes |
| ed | turn | primary | yes |
When I route I should get
| waypoints | turns | route | intersections |
| f,a | depart,arrive | road,road | true:0,true:0 false:90 false:180;true:180 |
| e,a | depart,turn right,arrive | turn,road,road | true:270;true:0 false:90 false:180;true:180 |
Scenario: Turning into splitting road Scenario: Turning into splitting road
Given the node map Given the node map
""" """
+20 -23
View File
@@ -745,15 +745,12 @@ Feature: Basic Roundabout
Scenario: Drive through roundabout Scenario: Drive through roundabout
Given a grid size of 5 meters
Given the node map Given the node map
""" """
. a . a
. . b e d f
b e --- d ---- f c
. . g h
.c.
g h
""" """
And the ways And the ways
@@ -763,12 +760,12 @@ Feature: Basic Roundabout
| gch | | yes | | gch | | yes |
When I route I should get When I route I should get
| waypoints | bearings | route | turns | | waypoints | bearings | route | turns |
| e,f | 90 90 | edf,edf | depart,arrive | | e,f | 90 90 | edf,edf | depart,arrive |
| e,h | 90 130 | edf,gch,gch,gch | depart,roundabout-exit-2,exit roundabout straight,arrive | | e,h | 90 135 | edf,gch,gch,gch | depart,roundabout-exit-2,exit roundabout straight,arrive |
| g,f | 50 90 | gch,edf,edf,edf | depart,roundabout-exit-2,exit roundabout slight right,arrive | | g,f | 45 90 | gch,edf,edf,edf | depart,roundabout-exit-2,exit roundabout right,arrive |
| g,h | 50 130 | gch,gch,gch | depart,exit roundabout right,arrive | | g,h | 45 135 | gch,gch,gch | depart,exit roundabout right,arrive |
| e,e | 90 270 | edf,edf,edf,edf | depart,roundabout-exit-3,exit roundabout sharp left,arrive | | e,e | 90 270 | edf,edf,edf,edf | depart,roundabout-exit-3,exit roundabout sharp left,arrive |
Scenario: CCW and CW roundabouts with overlaps Scenario: CCW and CW roundabouts with overlaps
Given the node map Given the node map
@@ -832,16 +829,16 @@ Feature: Basic Roundabout
""" """
And the ways And the ways
| nodes | highway | junction | oneway | # | | nodes | highway | junction | oneway | # |
| abcda | tertiary | roundabout | | circle | | abcda | tertiary | roundabout | | circle |
| ebds | tertiary | | | road | | ebds | tertiary | | | road |
| cm | tertiary | | | | | cm | tertiary | | | |
| ds | tertiary | | | road | | ds | tertiary | | | road |
| rstur | tertiary | roundabout | | circle2 | | rstur | tertiary | roundabout | | circle2 |
| ufghl | tertiary | | | road | | ufghl | tertiary | | | road |
| tv | tertiary | | | | | tv | tertiary | | | |
| gi | tertiary_link | | yes | sliproad | | gi | tertiary | | yes | sliproad |
| jhik | tertiary | | | crossroad | | jhik | tertiary | | | crossroad |
When I route I should get When I route I should get
+6 -35
View File
@@ -280,35 +280,6 @@ Feature: Simple Turns
| a,d | road,road | depart,arrive | | a,d | road,road | depart,arrive |
| e,a | road,road | depart,arrive | | e,a | road,road | depart,arrive |
Scenario: Splitting Road with many lanes; same as above makes sure len(turn:lanes) work as expected
Given the node map
"""
f - - - - - - - - - - - - - - - - - - - - e
'
'
'
'
'
a - - - - - b
'
'
'
'
'
c - - - - - - - - - - - - - - - - - - - - d
"""
And the ways
| nodes | highway | name | turn:lanes | oneway |
| ab | primary | road | left\|left\|right\|right | no |
| bcd | primary | road | through\|through | yes |
| efb | primary | road | through\|through | yes |
When I route I should get
| waypoints | route | turns |
| a,d | road,road | depart,arrive |
| e,a | road,road | depart,arrive |
@todo @todo
# currently the intersections don't match up do to the `merging` process. # currently the intersections don't match up do to the `merging` process.
# The intermediate intersection is technically no-turn at all, since the road continues. # The intermediate intersection is technically no-turn at all, since the road continues.
@@ -961,12 +932,12 @@ Feature: Simple Turns
g g
. .
. .
. .
. .
h f f
. h .
. . . .
. j . j
. . . .
c c
. . . . . .
+3 -87
View File
@@ -972,8 +972,6 @@ Feature: Simple Turns
d d
h h
q
""" """
And the nodes And the nodes
@@ -983,16 +981,16 @@ Feature: Simple Turns
And the ways And the ways
| nodes | name | highway | oneway | | nodes | name | highway | oneway |
| yf | yf | trunk_link | yes | | yf | yf | trunk_link | yes |
| gfehq | Centreville Road | primary | | | gfeh | Centreville Road | primary | |
| fi | fi | trunk_link | yes | | fi | fi | trunk_link | yes |
| ij | Bloomingdale Road | residential | | | ij | Bloomingdale Road | residential | |
| jkabx | Blue Star Memorial Hwy | trunk | yes | | jkabx | Blue Star Memorial Hwy | trunk | |
| bcde | bcde | trunk_link | yes | | bcde | bcde | trunk_link | yes |
| kh | kh | trunk_link | yes | | kh | kh | trunk_link | yes |
When I route I should get When I route I should get
| waypoints | turns | route | | waypoints | turns | route |
| a,q | depart,off ramp right,turn sharp left,arrive | Blue Star Memorial Hwy,bcde,Centreville Road,Centreville Road | | a,h | depart,off ramp right,turn sharp left,arrive | Blue Star Memorial Hwy,bcde,Centreville Road,Centreville Road |
@todo @todo
# https://www.openstreetmap.org/#map=20/52.51609/13.41080 # https://www.openstreetmap.org/#map=20/52.51609/13.41080
@@ -1351,85 +1349,3 @@ Feature: Simple Turns
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| a,d | ab,dc,dc | depart,turn left,arrive | | a,d | ab,dc,dc | depart,turn left,arrive |
# https://www.openstreetmap.org/node/1332083066
Scenario: Turns ordering must respect initial bearings
Given the node map
"""
a . be .
\ c.
d/ .f . g
"""
And the ways
| nodes | highway | oneway |
| ab | primary | yes |
| bcd | primary | yes |
| befg | primary | yes |
When I route I should get
| waypoints | route | turns |
| a,d | ab,bcd,bcd | depart,fork slight right,arrive |
| a,g | ab,befg,befg | depart,fork slight left,arrive |
# https://www.openstreetmap.org/#map=18/52.25130/10.42545
Scenario: Turn for roads with no name, ref changes
Given the node map
"""
d
.
.
e c . . f
.
.
b
.
.
a
"""
And the ways
| nodes | highway | ref | name |
| abc | tertiary | K 57 | |
| cd | tertiary | K 56 | |
| cf | tertiary | K 56 | |
| ce | residential | | Heinrichshöhe |
When I route I should get
| waypoints | route | turns |
| a,f | ,, | depart,turn right,arrive |
# https://www.openstreetmap.org/#map=18/52.24071/10.29066
Scenario: Turn for roads with no name, ref changes
Given the node map
"""
x
.
.
d
. .
. .
. .
e. . t . c . p. .f
. .
. .
. .
b
.
.
a
"""
And the ways
| nodes | highway | ref | name | oneway |
| abp | tertiary | K 23 | | yes |
| pdx | tertiary | K 23 | | yes |
| xdt | tertiary | K 23 | | yes |
| tba | tertiary | K 23 | | yes |
| etcpf | primary | B 1 | | no |
When I route I should get
| waypoints | route | turns |
| e,x | ,,, | depart,turn sharp left,turn right,arrive |
| f,a | ,, | depart,turn left,arrive |
+2 -2
View File
@@ -20,11 +20,11 @@ module.exports = {
}); });
}, },
hashOfFile: (path, additional_content, cb) => { hashOfFile: (path, cb) => {
fs.readFile(path, (err, result) => { fs.readFile(path, (err, result) => {
if (err) return cb(err); if (err) return cb(err);
let checksum = crypto.createHash('md5'); let checksum = crypto.createHash('md5');
checksum.update(result + (additional_content || "") ); checksum.update(result);
cb(null, checksum.digest('hex')); cb(null, checksum.digest('hex'));
}); });
} }
+6 -13
View File
@@ -61,13 +61,8 @@ class DB {
}); });
w.nodes.forEach((k) => { w.nodes.forEach((k) => {
way.ele('nd')
let nd = way.ele('nd')
.att('ref', k.id); .att('ref', k.id);
if (w.add_locations) {
nd.att('lon', k.lon);
nd.att('lat', k.lat);
}
}); });
for (var k in w.tags) { for (var k in w.tags) {
@@ -86,12 +81,11 @@ class DB {
}); });
r.members.forEach((m) => { r.members.forEach((m) => {
var d = { relation.ele('member', {
type: m.type, type: m.type,
ref: m.id ref: m.id,
}; role: m.role
if (m.role) d.role = m.role; });
relation.ele('member', d);
}); });
for (var k in r.tags) { for (var k in r.tags) {
@@ -126,14 +120,13 @@ class Node {
} }
class Way { class Way {
constructor (id, OSM_USER, OSM_TIMESTAMP, OSM_UID, add_locations) { constructor (id, OSM_USER, OSM_TIMESTAMP, OSM_UID) {
this.id = id; this.id = id;
this.OSM_USER = OSM_USER; this.OSM_USER = OSM_USER;
this.OSM_TIMESTAMP = OSM_TIMESTAMP; this.OSM_TIMESTAMP = OSM_TIMESTAMP;
this.OSM_UID = OSM_UID; this.OSM_UID = OSM_UID;
this.tags = {}; this.tags = {};
this.nodes = []; this.nodes = [];
this.add_locations = add_locations;
} }
addNode (node) { addNode (node) {
+3
View File
@@ -12,6 +12,7 @@ Feature: osrm-contract command line options: help
And stdout should contain "Configuration:" And stdout should contain "Configuration:"
And stdout should contain "--threads" And stdout should contain "--threads"
And stdout should contain "--core" And stdout should contain "--core"
And stdout should contain "--level-cache"
And stdout should contain "--segment-speed-file" And stdout should contain "--segment-speed-file"
And it should exit with an error And it should exit with an error
@@ -26,6 +27,7 @@ Feature: osrm-contract command line options: help
And stdout should contain "Configuration:" And stdout should contain "Configuration:"
And stdout should contain "--threads" And stdout should contain "--threads"
And stdout should contain "--core" And stdout should contain "--core"
And stdout should contain "--level-cache"
And stdout should contain "--segment-speed-file" And stdout should contain "--segment-speed-file"
And it should exit successfully And it should exit successfully
@@ -40,5 +42,6 @@ Feature: osrm-contract command line options: help
And stdout should contain "Configuration:" And stdout should contain "Configuration:"
And stdout should contain "--threads" And stdout should contain "--threads"
And stdout should contain "--core" And stdout should contain "--core"
And stdout should contain "--level-cache"
And stdout should contain "--segment-speed-file" And stdout should contain "--segment-speed-file"
And it should exit successfully And it should exit successfully
+12 -135
View File
@@ -1,12 +1,22 @@
@extract @extract
Feature: osrm-extract lua ways:get_nodes() Feature: osrm-extract lua ways:get_nodes()
Background:
Given the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been saved to disk
Scenario: osrm-extract - Passing base file Scenario: osrm-extract - Passing base file
Given the profile file Given the profile file
""" """
functions = require('testbot') functions = require('testbot')
functions.process_way = function(profile, way, result) function way_function(profile, way, result)
for _, node in ipairs(way:get_nodes()) do for _, node in ipairs(way:get_nodes()) do
print('node id ' .. node:id()) print('node id ' .. node:id())
end end
@@ -14,143 +24,10 @@ Feature: osrm-extract lua ways:get_nodes()
result.forward_speed = 1 result.forward_speed = 1
end end
functions.process_way = way_function
return functions return functions
""" """
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}" When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully Then it should exit successfully
And stdout should contain "node id 1" And stdout should contain "node id 1"
And stdout should contain "node id 2" And stdout should contain "node id 2"
Scenario: osrm-extract location-dependent data without add-locations-to-ways preprocessing and node locations cache
Given the profile file
"""
functions = require('testbot')
functions.process_way = function(profile, way, result, relations)
print(way:get_location_tag('driving_side'))
end
return functions
"""
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been saved to disk
When I try to run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson --disable-location-cache"
Then it should exit with an error
And stderr should contain "invalid location"
Scenario: osrm-extract location-dependent data
Given the profile file
"""
functions = require('testbot')
functions.process_way = function(profile, way, result, relations)
for _, key in ipairs({'answer', 'boolean', 'object', 'array'}) do
print (key .. ' ' .. tostring(way:get_location_tag(key)))
end
result.forward_mode = mode.driving
result.forward_speed = 1
end
return functions
"""
And the node map
"""
a b
"""
And the ways with locations
| nodes |
| ab |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson --disable-location-cache"
Then it should exit successfully
And stdout should contain "answer 42"
And stdout should contain "boolean true"
And stdout should contain "array nil"
And stdout should contain "object nil"
Scenario: osrm-extract location-dependent data with multi-polygons
Given the profile file
"""
functions = require('testbot')
functions.process_way = function(profile, way, result, relations)
print('ISO3166-1 ' .. (way:get_location_tag('ISO3166-1') or 'none'))
print('answer ' .. (way:get_location_tag('answer') or 'none'))
result.forward_mode = mode.driving
result.forward_speed = 1
end
return functions
"""
And the node locations
| node | lat | lon | id |
| a | 22.4903670 | 113.9455227 | 1 |
| b | 22.4901701 | 113.9455899 | 2 |
| c | 22.4901852 | 113.9458608 | 3 |
| d | 22.4904033 | 113.9456999 | 4 |
| e | 1.1 | 1 | 5 |
| f | 1.2 | 1 | 6 |
And the ways with locations
| nodes | # |
| ab | Hong Kong |
| cd | China Mainland |
| ef | Null Island |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson --location-dependent-data test/data/regions/hong-kong.geojson --disable-location-cache"
Then it should exit successfully
And stdout should not contain "1 GeoJSON polygon"
And stdout should contain "2 GeoJSON polygons"
And stdout should contain "ISO3166-1 HK"
And stdout should contain "ISO3166-1 none"
And stdout should contain "answer 42"
Scenario: osrm-extract location-dependent data via locations cache
Given the profile file
"""
functions = require('testbot')
functions.process_node = function(profile, node, result, relations)
print ('node ' .. tostring(node:get_location_tag('answer')))
end
functions.process_way = function(profile, way, result, relations)
print ('way ' .. tostring(way:get_location_tag('answer')))
result.forward_mode = mode.driving
result.forward_speed = 1
end
return functions
"""
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file} --location-dependent-data test/data/regions/null-island.geojson"
Then it should exit successfully
And stdout should contain "node 42"
And stdout should contain "way 42"
@@ -1,186 +0,0 @@
@routing @testbot @turn_function
Feature: Turn Function Information
Background:
Given the profile file
"""
functions = require('car')
function test_setup()
profile = functions.setup()
profile.highway_turn_classification = {
['motorway'] = 4,
['motorway_link'] = 4,
['trunk'] = 4,
['trunk_link'] = 4,
['primary'] = 4,
['primary_link'] = 4,
['secondary'] = 3,
['secondary_link'] = 3,
['tertiary'] = 2,
['tertiary_link'] = 2,
['residential'] = 1,
['living_street'] = 1,
}
profile.access_turn_classification = {
['discouraged'] = 1;
['permissive'] = 1;
['private'] = 1;
['customers'] = 1;
['dismount'] = 1;
}
return profile
end
function turn_leg_string (leg)
return 'speed: ' .. tostring(leg.speed)
.. ', is_incoming: ' .. tostring(leg.is_incoming)
.. ', is_outgoing: ' .. tostring(leg.is_outgoing)
.. ', highway_turn_classification: ' .. tostring(leg.highway_turn_classification)
.. ', access_turn_classification: ' .. tostring(leg.access_turn_classification)
.. ', priority_class: ' .. tostring(leg.priority_class)
end
function print_turn (profile, turn)
print ('source_restricted ' .. string.format("%s", tostring(turn.source_restricted)))
print ('source_is_motorway ' .. string.format("%s", tostring(turn.source_is_motorway)))
print ('source_is_link ' .. string.format("%s", tostring(turn.source_is_link)))
print ('source_number_of_lanes ' .. string.format("%s", tostring(turn.source_number_of_lanes)))
print ('source_highway_turn_classification ' .. string.format("%s", tostring(turn.source_highway_turn_classification)))
print ('source_access_turn_classification ' .. string.format("%s", tostring(turn.source_access_turn_classification)))
print ('source_speed ' .. string.format("%s", tostring(turn.source_speed)))
print ('source_priority_class ' .. string.format("%s", tostring(turn.source_priority_class)))
print ('source_mode ' .. string.format("%s", tostring(turn.source_mode)))
print ('target_restricted ' .. string.format("%s", tostring(turn.target_restricted)))
print ('target_is_motorway ' .. string.format("%s", tostring(turn.target_is_motorway)))
print ('target_is_link ' .. string.format("%s", tostring(turn.target_is_link)))
print ('target_number_of_lanes ' .. string.format("%s", tostring(turn.target_number_of_lanes)))
print ('target_highway_turn_classification ' .. string.format("%s", tostring(turn.target_highway_turn_classification)))
print ('target_access_turn_classification ' .. string.format("%s", tostring(turn.target_access_turn_classification)))
print ('target_speed ' .. string.format("%s", tostring(turn.target_speed)))
print ('target_priority_class ' .. string.format("%s", tostring(turn.target_priority_class)))
print ('target_mode ' .. string.format("%s", tostring(turn.target_mode)))
print ('number_of_roads ' .. string.format("%s", tostring(turn.number_of_roads)))
if not turn.is_u_turn then
for roadCount, road in ipairs(turn.roads_on_the_right) do
print('roads_on_the_right [' .. tostring(roadCount) .. '] ' .. turn_leg_string(road))
end
for roadCount, road in ipairs(turn.roads_on_the_left) do
print('roads_on_the_left [' .. tostring(roadCount) .. '] ' .. turn_leg_string(road))
end
end
end
return {
setup = test_setup,
process_way = functions.process_way,
process_node = functions.process_node,
process_turn = print_turn
}
"""
Scenario: Turns should have correct information of source and target
Given the node map
"""
a b c
"""
And the ways
| nodes | highway |
| ab | motorway |
| bc | motorway |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "source_is_motorway true"
And stdout should contain "target_is_motorway true"
And stdout should contain "source_is_link false"
And stdout should contain "source_priority_class 0"
And stdout should contain "target_is_motorway true"
And stdout should contain "target_is_link false"
And stdout should contain "target_priority_class 0"
Scenario: Turns should detect when turn is leaving highway
Given the node map
"""
a b c
"""
And the ways
| nodes | highway | lanes |
| ab | motorway | 3 |
| bc | motorway_link | |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "source_is_motorway true"
And stdout should contain "source_is_link false"
And stdout should contain "source_number_of_lanes 3"
And stdout should contain "target_is_motorway false"
And stdout should contain "target_is_link true"
And stdout should contain "target_number_of_lanes 0"
And stdout should contain "number_of_roads 2"
Scenario: Turns should have correct information of other roads at intersection I
Given the node map
"""
d
^
|
a->b->c
"""
And the ways
| nodes | highway | oneway |
| ab | primary | yes |
| bc | motorway | yes |
| bd | residential | yes |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "number_of_roads 3"
And stdout should contain "source_priority_class 4"
And stdout should contain "target_priority_class 0"
And stdout should contain "target_priority_class 11"
# turning abd, give information about bc
And stdout should contain /roads_on_the_right \[1\] speed: [0-9]+, is_incoming: false, is_outgoing: true, highway_turn_classification: 4, access_turn_classification: 0/
# turning abc, give information about bd
And stdout should contain /roads_on_the_left \[1\] speed: [0-9]+, is_incoming: false, is_outgoing: true, highway_turn_classification: 1, access_turn_classification: 0/
Scenario: Turns should have correct information of other roads at intersection II
Given the node map
"""
d
|
v
a->b->c
"""
And the ways
| nodes | highway | oneway | access |
| ab | secondary | yes | |
| bc | motorway | yes | |
| db | unclassified | yes | discouraged |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "number_of_roads 3"
# turning dbc, give information about about ab
And stdout should contain /roads_on_the_right \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: false, highway_turn_classification: 3, access_turn_classification: 0/
# turning abc, give information about about db
And stdout should contain /roads_on_the_left \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: false, highway_turn_classification: 0, access_turn_classification: 1/
@@ -1,32 +0,0 @@
@extract
Feature: osrm-extract must be silent with NONE
Background:
Given the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been saved to disk
Scenario: osrm-extract - Passing base file with verbosity NONE
Given the profile file
"""
functions = require('testbot')
function way_function(profile, way, result)
result.forward_mode = mode.driving
result.forward_speed = 1
end
functions.process_way = way_function
return functions
"""
When I run "osrm-extract --profile {profile_file} {osm_file} --verbosity NONE"
Then it should exit successfully
And stdout should not contain "[info]"
And stdout should not contain "[error]"
And stdout should not contain "10%"
And stderr should be empty
@@ -24,7 +24,7 @@ Feature: Invalid profile API versions
Scenario: Profile API version too high Scenario: Profile API version too high
Given the profile file Given the profile file
""" """
api_version = 5 api_version = 3
""" """
And the node map And the node map
""" """
-101
View File
@@ -1,101 +0,0 @@
Feature: Profile API version 3
Background:
Given a grid size of 100 meters
Scenario: Basic profile function calls and property values
Given the profile file
"""
api_version = 3
Set = require('lib/set')
Sequence = require('lib/sequence')
Handlers = require("lib/way_handlers")
find_access_tag = require("lib/access").find_access_tag
limit = require("lib/maxspeed").limit
function setup()
return {
properties = {
max_speed_for_map_matching = 180/3.6,
use_turn_restrictions = true,
continue_straight_at_waypoint = true,
weight_name = 'test_version2',
weight_precision = 2
},
relation_types = Sequence { "route" }
}
end
function process_node(profile, node, result, relations)
print ('process_node ' .. node:id())
end
function process_way(profile, way, result, relations)
result.name = way:get_value_by_key('name')
result.weight = 10
result.forward_mode = mode.driving
result.backward_mode = mode.driving
result.forward_speed = 36
result.backward_speed = 36
local rel_id_list = relations:get_relations(way)
for i, rel_id in ipairs(rel_id_list) do
local rel = relations:relation(rel_id)
local role = rel:get_role(way)
print('role_' .. role)
end
print ('process_way ' .. way:id() .. ' ' .. result.name)
end
function process_turn (profile, turn)
print('process_turn', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light)
turn.weight = turn.angle == 0 and 0 or 4.2
turn.duration = turn.weight
end
function process_segment (profile, segment)
print ('process_segment ' .. segment.source.lon .. ' ' .. segment.source.lat)
end
return {
setup = setup,
process_node = process_node,
process_way = process_way,
process_relation = process_relation,
process_segment = process_segment,
process_turn = process_turn
}
"""
And the node map
"""
a
bcd
e
"""
And the ways
| nodes |
| ac |
| cb |
| cd |
| ce |
And the relations
| type | way:north | route |
| route | ac | road |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "process_node"
And stdout should contain "process_way"
And stdout should contain "process_turn"
And stdout should contain "process_segment"
And stdout should contain "role_north"
When I route I should get
| from | to | route | time |
| a | b | ac,cb,cb | 19.2s |
| a | d | ac,cd,cd | 19.2s |
| a | e | ac,ce | 20s |
+11 -30
View File
@@ -8,7 +8,7 @@ var OSM = require('../lib/osm');
module.exports = function () { module.exports = function () {
this.Given(/^the profile "([^"]*)"$/, (profile, callback) => { this.Given(/^the profile "([^"]*)"$/, (profile, callback) => {
this.profile = this.OSRM_PROFILE || profile; this.profile = profile;
this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua'); this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua');
callback(); callback();
}); });
@@ -129,13 +129,13 @@ module.exports = function () {
q.awaitAll(callback); q.awaitAll(callback);
}); });
this.Given(/^the ways( with locations)?$/, (add_locations, table, callback) => { this.Given(/^the ways$/, (table, callback) => {
if (this.osm_str) throw new Error('*** Map data already defined - did you pass an input file in this scenario?'); if (this.osm_str) throw new Error('*** Map data already defined - did you pass an input file in this scenario?');
let q = d3.queue(); let q = d3.queue();
let addWay = (row, cb) => { let addWay = (row, cb) => {
let way = new OSM.Way(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID, !!add_locations); let way = new OSM.Way(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID);
let nodes = row.nodes; let nodes = row.nodes;
if (this.nameWayHash.nodes) throw new Error(util.format('*** duplicate way %s', nodes)); if (this.nameWayHash.nodes) throw new Error(util.format('*** duplicate way %s', nodes));
@@ -185,59 +185,40 @@ module.exports = function () {
let q = d3.queue(); let q = d3.queue();
let addRelation = (headers, row, cb) => { let addRelation = (row, cb) => {
let relation = new OSM.Relation(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID); let relation = new OSM.Relation(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, this.OSM_UID);
for (let key in row) {
var name = null; let isNode = key.match(/^node:(.*)/),
for (let index in row) { isWay = key.match(/^way:(.*)/),
var key = headers[index];
var value = row[index];
let isNode = key.match(/^node:?(.*)/),
isWay = key.match(/^way:?(.*)/),
isRelation = key.match(/^relation:?(.*)/),
isColonSeparated = key.match(/^(.*):(.*)/); isColonSeparated = key.match(/^(.*):(.*)/);
if (isNode) { if (isNode) {
value.split(',').map(function(v) { return v.trim(); }).forEach((nodeName) => { row[key].split(',').map(function(v) { return v.trim(); }).forEach((nodeName) => {
if (nodeName.length !== 1) throw new Error(util.format('*** invalid relation node member "%s"', nodeName)); if (nodeName.length !== 1) throw new Error(util.format('*** invalid relation node member "%s"', nodeName));
let node = this.findNodeByName(nodeName); let node = this.findNodeByName(nodeName);
if (!node) throw new Error(util.format('*** unknown relation node member "%s"', nodeName)); if (!node) throw new Error(util.format('*** unknown relation node member "%s"', nodeName));
relation.addMember('node', node.id, isNode[1]); relation.addMember('node', node.id, isNode[1]);
}); });
} else if (isWay) { } else if (isWay) {
value.split(',').map(function(v) { return v.trim(); }).forEach((wayName) => { row[key].split(',').map(function(v) { return v.trim(); }).forEach((wayName) => {
let way = this.findWayByName(wayName); let way = this.findWayByName(wayName);
if (!way) throw new Error(util.format('*** unknown relation way member "%s"', wayName)); if (!way) throw new Error(util.format('*** unknown relation way member "%s"', wayName));
relation.addMember('way', way.id, isWay[1]); relation.addMember('way', way.id, isWay[1]);
}); });
} else if (isRelation) {
value.split(',').map(function(v) { return v.trim(); }).forEach((relName) => {
let otherrelation = this.findRelationByName(relName);
if (!otherrelation) throw new Error(util.format('*** unknown relation relation member "%s"', relName));
relation.addMember('relation', otherrelation.id, isRelation[1]);
});
} else if (isColonSeparated && isColonSeparated[1] !== 'restriction') { } else if (isColonSeparated && isColonSeparated[1] !== 'restriction') {
throw new Error(util.format('*** unknown relation member type "%s:%s", must be either "node" or "way"', isColonSeparated[1], isColonSeparated[2])); throw new Error(util.format('*** unknown relation member type "%s:%s", must be either "node" or "way"', isColonSeparated[1], isColonSeparated[2]));
} else { } else {
relation.addTag(key, value); relation.addTag(key, row[key]);
if (key.match(/name/)) name = value;
} }
} }
relation.uid = this.OSM_UID; relation.uid = this.OSM_UID;
if (name) {
this.nameRelationHash[name] = relation;
}
this.OSMDB.addRelation(relation); this.OSMDB.addRelation(relation);
cb(); cb();
}; };
var headers = table.raw()[0]; table.hashes().forEach((row) => q.defer(addRelation, row));
table.rows().forEach((row) => q.defer(addRelation, headers, row));
q.awaitAll(callback); q.awaitAll(callback);
}); });
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = function () {
var waypoints = [], var waypoints = [],
columnHeaders = tableRows[0].slice(1), columnHeaders = tableRows[0].slice(1),
rowHeaders = tableRows.map((h) => h[0]).slice(1), rowHeaders = tableRows.map((h) => h[0]).slice(1),
symmetric = columnHeaders.length == rowHeaders.length && columnHeaders.every((ele, i) => ele === rowHeaders[i]); symmetric = columnHeaders.every((ele, i) => ele === rowHeaders[i]);
if (symmetric) { if (symmetric) {
columnHeaders.forEach((nodeName) => { columnHeaders.forEach((nodeName) => {
+2 -31
View File
@@ -74,7 +74,7 @@ module.exports = function () {
if (headers.has('turns')) { if (headers.has('turns')) {
if (json.matchings.length != 1) throw new Error('*** Checking turns only supported for matchings with one subtrace'); if (json.matchings.length != 1) throw new Error('*** Checking turns only supported for matchings with one subtrace');
turns = this.turnList(json.matchings[0]); turns = this.turnList(json.matchings[0].instructions);
} }
if (headers.has('route')) { if (headers.has('route')) {
@@ -150,8 +150,7 @@ module.exports = function () {
} }
var ok = true; var ok = true;
var encodedResult = '', var encodedResult = '',
extendedTarget = '', extendedTarget = '';
resultWaypoints = [];
var testSubMatching = (sub, si) => { var testSubMatching = (sub, si) => {
var testSubNode = (ni) => { var testSubNode = (ni) => {
@@ -187,29 +186,6 @@ module.exports = function () {
}); });
} }
if (headers.has('waypoints')) {
var got_loc = [];
for (let i = 0; i < json.tracepoints.length; i++) {
if (!json.tracepoints[i]) continue;
if (json.tracepoints[i].waypoint_index != null)
got_loc.push(json.tracepoints[i].location);
}
if (row.waypoints.length != got_loc.length)
return cb(new Error(`Expected ${row.waypoints.length} waypoints, got ${got_loc.length}`));
for (i = 0; i < row.waypoints.length; i++)
{
var want_node = this.findNodeByName(row.waypoints[i]);
if (!this.FuzzyMatch.matchLocation(got_loc[i], want_node)) {
resultWaypoints.push(util.format('? [%s,%s]', got_loc[i][0], got_loc[i][1]));
ok = false;
} else {
resultWaypoints.push(row.waypoints[i]);
}
}
}
if (ok) { if (ok) {
if (headers.has('matchings')) { if (headers.has('matchings')) {
got.matchings = row.matchings; got.matchings = row.matchings;
@@ -218,12 +194,7 @@ module.exports = function () {
if (headers.has('timestamps')) { if (headers.has('timestamps')) {
got.timestamps = row.timestamps; got.timestamps = row.timestamps;
} }
if (headers.has('waypoints')) {
got.waypoints = row.waypoints;
}
} else { } else {
got.waypoints = resultWaypoints.join(';');
got.matchings = encodedResult; got.matchings = encodedResult;
row.matchings = extendedTarget; row.matchings = extendedTarget;
} }
+2 -4
View File
@@ -54,14 +54,12 @@ module.exports = function () {
this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => { this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => {
const contains = this.stdout.indexOf(str) > -1; const contains = this.stdout.indexOf(str) > -1;
assert.ok(typeof not === 'undefined' ? contains : !contains, assert.ok(typeof not === 'undefined' ? contains : !contains);
'stdout ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
}); });
this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => { this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => {
const contains = this.stderr.indexOf(str) > -1; const contains = this.stderr.indexOf(str) > -1;
assert.ok(typeof not === 'undefined' ? contains : !contains, assert.ok(typeof not === 'undefined' ? contains : !contains);
'stderr ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
}); });
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => { this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
+1 -5
View File
@@ -28,16 +28,13 @@ module.exports = function() {
let uri = feature.getUri(); let uri = feature.getUri();
// setup cache for feature data // setup cache for feature data
// if OSRM_PROFILE is set to force a specific profile, then hash.hashOfFile(uri, (err, hash) => {
// include the profile name in the hash of the profile file
hash.hashOfFile(uri, this.OSRM_PROFILE, (err, hash) => {
if (err) return callback(err); if (err) return callback(err);
// shorten uri to be realtive to 'features/' // shorten uri to be realtive to 'features/'
let featurePath = path.relative(path.resolve('./features'), uri); let featurePath = path.relative(path.resolve('./features'), uri);
// bicycle/bollards/{HASH}/ // bicycle/bollards/{HASH}/
let featureID = path.join(featurePath, hash); let featureID = path.join(featurePath, hash);
let featureCacheDirectory = this.getFeatureCacheDirectory(featureID); let featureCacheDirectory = this.getFeatureCacheDirectory(featureID);
let featureProcessedCacheDirectory = this.getFeatureProcessedCacheDirectory(featureCacheDirectory, this.osrmHash); let featureProcessedCacheDirectory = this.getFeatureProcessedCacheDirectory(featureCacheDirectory, this.osrmHash);
this.featureIDs[uri] = featureID; this.featureIDs[uri] = featureID;
@@ -115,7 +112,6 @@ module.exports = function() {
this.OSRM_EXTRACT_PATH, this.OSRM_EXTRACT_PATH,
this.OSRM_CONTRACT_PATH, this.OSRM_CONTRACT_PATH,
this.LIB_OSRM_EXTRACT_PATH, this.LIB_OSRM_EXTRACT_PATH,
this.LIB_OSRM_GUIDANCE_PATH,
this.LIB_OSRM_CONTRACT_PATH this.LIB_OSRM_CONTRACT_PATH
]; ];
-5
View File
@@ -144,10 +144,6 @@ module.exports = function () {
return this.nameWayHash[s.toString()] || this.nameWayHash[s.toString().split('').reverse().join('')]; return this.nameWayHash[s.toString()] || this.nameWayHash[s.toString().split('').reverse().join('')];
}; };
this.findRelationByName = (s) => {
return this.nameRelationHash[s.toString()] || this.nameRelationHash[s.toString().split('').reverse().join('')];
};
this.makeOSMId = () => { this.makeOSMId = () => {
this.osmID = this.osmID + 1; this.osmID = this.osmID + 1;
return this.osmID; return this.osmID;
@@ -159,7 +155,6 @@ module.exports = function () {
this.locationHash = {}; this.locationHash = {};
this.shortcutsHash = {}; this.shortcutsHash = {};
this.nameWayHash = {}; this.nameWayHash = {};
this.nameRelationHash = {};
this.osmID = 0; this.osmID = 0;
}; };
-4
View File
@@ -12,10 +12,6 @@ module.exports = {
FuzzyMatch: class { FuzzyMatch: class {
match (got, want) { match (got, want) {
// don't fail if bearings input and extected string is empty and actual result is undefined
if (want === '' && (got === '' || got === undefined))
return true;
var matchPercent = want.match(/(.*)\s+~(.+)%$/), var matchPercent = want.match(/(.*)\s+~(.+)%$/),
matchAbs = want.match(/(.*)\s+\+\-(.+)$/), matchAbs = want.match(/(.*)\s+\+\-(.+)$/),
matchRe = want.match(/^\/(.*)\/$/), matchRe = want.match(/^\/(.*)\/$/),
-3
View File
@@ -45,8 +45,6 @@ module.exports = function () {
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000; this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT; this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
this.OSRM_PROFILE = process.env.OSRM_PROFILE;
if (this.PLATFORM_WINDOWS) { if (this.PLATFORM_WINDOWS) {
this.TERMSIGNAL = 9; this.TERMSIGNAL = 9;
this.EXE = '.exe'; this.EXE = '.exe';
@@ -72,7 +70,6 @@ module.exports = function () {
this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE)); this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE));
this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE)); this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE));
this.LIB_OSRM_EXTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_extract'), this.LIB_OSRM_EXTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_extract'),
this.LIB_OSRM_GUIDANCE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_guidance'),
this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'), this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'),
this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm'); this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm');
+1 -3
View File
@@ -22,7 +22,7 @@ module.exports = function () {
}); });
this.BeforeFeature((feature, callback) => { this.BeforeFeature((feature, callback) => {
this.profile = this.OSRM_PROFILE || this.DEFAULT_PROFILE; this.profile = this.DEFAULT_PROFILE;
this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua'); this.profileFile = path.join(this.PROFILES_PATH, this.profile + '.lua');
this.setupFeatureCache(feature); this.setupFeatureCache(feature);
callback(); callback();
@@ -50,8 +50,6 @@ module.exports = function () {
.defer(mkdirp, logDir) .defer(mkdirp, logDir)
.defer(rimraf, this.scenarioLogFile) .defer(rimraf, this.scenarioLogFile)
.awaitAll(callback); .awaitAll(callback);
// uncomment to get path to logfile
// console.log(" Writing logging output to " + this.scenarioLogFile)
}); });
this.After((scenario, callback) => { this.After((scenario, callback) => {
-4
View File
@@ -267,10 +267,6 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.mode); return this.extractInstructionList(instructions, s => s.mode);
}; };
this.drivingSideList = (instructions) => {
return this.extractInstructionList(instructions, s => s.driving_side);
};
this.classesList = (instructions) => { this.classesList = (instructions) => {
return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']'); return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']');
}; };
+1 -7
View File
@@ -35,8 +35,7 @@ module.exports = function () {
if (err) return cb(err); if (err) return cb(err);
if (body && body.length) { if (body && body.length) {
let destinations, exits, pronunciations, instructions, refs, bearings, turns, modes, times, classes, let destinations, exits, pronunciations, instructions, refs, bearings, turns, modes, times, classes,
distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches, distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches;
driving_sides;
let json = JSON.parse(body); let json = JSON.parse(body);
@@ -54,7 +53,6 @@ module.exports = function () {
turns = this.turnList(json.routes[0]); turns = this.turnList(json.routes[0]);
intersections = this.intersectionList(json.routes[0]); intersections = this.intersectionList(json.routes[0]);
modes = this.modeList(json.routes[0]); modes = this.modeList(json.routes[0]);
driving_sides = this.drivingSideList(json.routes[0]);
classes = this.classesList(json.routes[0]); classes = this.classesList(json.routes[0]);
times = this.timeList(json.routes[0]); times = this.timeList(json.routes[0]);
distances = this.distanceList(json.routes[0]); distances = this.distanceList(json.routes[0]);
@@ -188,10 +186,6 @@ module.exports = function () {
putValue('weight', weight); putValue('weight', weight);
putValue('approach', approaches); putValue('approach', approaches);
if (driving_sides) {
putValue('driving_side', driving_sides);
}
for (var key in row) { for (var key in row) {
if (this.FuzzyMatch.match(got[key], row[key])) { if (this.FuzzyMatch.match(got[key], row[key])) {
got[key] = row[key]; got[key] = row[key];
-3
View File
@@ -12,9 +12,6 @@ Feature: Alternative route
g h i j g h i j
""" """
# enforce multiple cells for filterUnpackedPathsBySharing check
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 2,4,8,16"
And the ways And the ways
| nodes | | nodes |
| ab | | ab |
+27 -19
View File
@@ -31,32 +31,40 @@ Feature: Alternative route
| 5 | 6 | dc,ca,ab,bd,dc,dc | | | 5 | 6 | dc,ca,ab,bd,dc,dc | |
| 7 | 8 | ca,ab,bd,dc,ca,ca | | | 7 | 8 | ca,ab,bd,dc,ca,ca | |
# This test case does not work in a platform independent way
@mld-only # since it depends on a specific CH structure that is only
Scenario: Alternative loop paths on a single node with an asymmetric circle # present on linux it seems.
# The test checks only MLD implementation, alternatives results are unpredictable for CH on windows (#4691, #4693) @4111 @todo
Given a grid size of 10 meters Scenario: Alternative Loop Paths with single node path
Given the node map Given the node map
""" """
a b c a1b2c3d
l d
k e
j f e f
i h g
""" """
And the nodes
| node | barrier |
| i | bollard |
| g | bollard |
And the ways And the ways
| nodes | oneway | | nodes | maxspeed |
| abcdefghijkla | no | | ab | 30 |
| bc | 3 |
| cd | 30 |
| ae | 30 |
| ef | 30 |
| fd | 30 |
And the query options And the query options
| alternatives | true | | alternatives | true |
When I route I should get When I route I should get
| from | to | route | alternative | weight | | from | to | route | alternative |
| e | k | abcdefghijkla,abcdefghijkla | abcdefghijkla,abcdefghijkla | 6.8 | | b | c | bc,bc | ab,ae,ef,fd,cd,cd |
#| c | b | bc,bc | cd,fd,ef,ae,ab,ab | # alternative path depends on phantom snapping order
| 1 | c | ab,bc,bc | ab,ae,ef,fd,cd,cd |
#| c | 1 | bc,ab | cd,fd,ef,ae,ab | # alternative path depends on phantom snapping order
| 2 | c | bc,bc | |
| c | 2 | bc,bc | |
| 1 | 3 | ab,ae,ef,fd,cd | ab,bc,cd |
#| 3 | 1 | cd,fd,ef,ae,ab | cd,bc,ab | # alternative path depends on phantom snapping order
| b | 3 | bc,cd | ab,ae,ef,fd,cd |
#| 3 | b | cd,bc,bc | cd,fd,ef,ae,ab,ab | # alternative path depends on phantom snapping order
-24
View File
@@ -59,27 +59,3 @@ Feature: Annotations
| from | to | route | a:datasources | a:speed | | from | to | route | a:datasources | a:speed |
| a | i | abcdefghi,abcdefghi | 1:0:1:0:1:0:0:0 | 50:10:50:10:50:10:10:10 | | a | i | abcdefghi,abcdefghi | 1:0:1:0:1:0:0:0 | 50:10:50:10:50:10:10:10 |
| i | a | abcdefghi,abcdefghi | 0:1:0:0:0:0:0:1 | 10:50:10:10:10:10:10:50 | | i | a | abcdefghi,abcdefghi | 0:1:0:0:0:0:0:1 | 10:50:10:10:10:10:10:50 |
Scenario: Speed annotations should handle zero segments
Given the profile "testbot"
Given the node map
"""
a -- b --- c
|
d
"""
And the ways
| nodes |
| abc |
| cd |
# This test relies on the snapping to the EBN cd to introduce a zero segment after the turn
And the query options
| annotations | speed,distance,duration,nodes |
| bearings | 90,5;180,5 |
When I route I should get
| from | to | route | a:speed | a:distance | a:duration | a:nodes |
| a | c | abc,abc | 10:10:10 | 249.998641:299.931643:0 | 25:30:0 | 1:2:3 |
+12 -48
View File
@@ -2,11 +2,11 @@
Feature: Approach parameter Feature: Approach parameter
Background: Background:
Given a grid size of 10 meters Given the profile "testbot"
And a grid size of 10 meters
Scenario: Start End same approach, option unrestricted for Start and End Scenario: Start End same approach, option unrestricted for Start and End
Given the profile "testbot" Given the node map
And the node map
""" """
s e s e
a------b------c a------b------c
@@ -22,8 +22,7 @@ Feature: Approach parameter
| s | e | unrestricted unrestricted | ab,bc | | s | e | unrestricted unrestricted | ab,bc |
Scenario: Start End same approach, option unrestricted for Start and curb for End Scenario: Start End same approach, option unrestricted for Start and curb for End
Given the profile "testbot" Given the node map
And the node map
""" """
s e s e
a------b------c a------b------c
@@ -39,8 +38,7 @@ Feature: Approach parameter
| s | e | unrestricted curb | ab,bc,bc | | s | e | unrestricted curb | ab,bc,bc |
Scenario: Start End opposite approach, option unrestricted for Start and End Scenario: Start End opposite approach, option unrestricted for Start and End
Given the profile "testbot" Given the node map
And the node map
""" """
s s
a------b------c a------b------c
@@ -57,8 +55,7 @@ Feature: Approach parameter
| s | e | unrestricted unrestricted | ab,bc | | s | e | unrestricted unrestricted | ab,bc |
Scenario: Start End opposite approach, option unrestricted for Start and curb for End Scenario: Start End opposite approach, option unrestricted for Start and curb for End
Given the profile "testbot" Given the node map
And the node map
""" """
s s
a------b------c a------b------c
@@ -80,8 +77,7 @@ Feature: Approach parameter
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and End Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and End
Given the profile "testbot" Given the node map
And the node map
""" """
s e s e
a------b------c a------b------c
@@ -97,8 +93,7 @@ Feature: Approach parameter
| s | e | unrestricted unrestricted | ab,bc | | s | e | unrestricted unrestricted | ab,bc |
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and curb for End Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and curb for End
Given the profile "testbot" Given the node map
And the node map
""" """
s e s e
a------b------c a------b------c
@@ -114,8 +109,7 @@ Feature: Approach parameter
| s | e | unrestricted curb | ab,bc | | s | e | unrestricted curb | ab,bc |
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
Given the profile "testbot" Given the node map
And the node map
""" """
s s
a------b------c a------b------c
@@ -132,8 +126,7 @@ Feature: Approach parameter
| s | e | unrestricted unrestricted | ab,bc | | s | e | unrestricted unrestricted | ab,bc |
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
Given the profile "testbot" Given the node map
And the node map
""" """
s s
a------b------c a------b------c
@@ -154,8 +147,7 @@ Feature: Approach parameter
############## ##############
Scenario: UTurn test, router can't found a route because uturn unauthorized on the segment selected Scenario: UTurn test, router can't found a route because uturn unauthorized on the segment selected
Given the profile "testbot" Given the node map
And the node map
""" """
s e s e
a------b------c a------b------c
@@ -176,8 +168,7 @@ Feature: Approach parameter
Scenario: UTurn test, router can find a route because he can use the roundabout Scenario: UTurn test, router can find a route because he can use the roundabout
Given the profile "testbot" Given the node map
And the node map
""" """
h h
s e / \ s e / \
@@ -199,30 +190,3 @@ Feature: Approach parameter
When I route I should get When I route I should get
| from | to | approaches | route | | from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc | | s | e | unrestricted curb | ab,bc,bc |
Scenario: Start End same approach, option unrestricted for Start and curb for End, left-hand driving
Given the profile file
"""
local functions = require('testbot')
local testbot_process_way = functions.process_way
functions.process_way = function(profile, way, result)
testbot_process_way(profile, way, result)
result.is_left_hand_driving = true
end
return functions
"""
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
+1 -102
View File
@@ -6,7 +6,6 @@ Feature: Basic Distance Matrix
Background: Background:
Given the profile "testbot" Given the profile "testbot"
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 2,4,8,16"
Scenario: Testbot - Travel time matrix of minimal network Scenario: Testbot - Travel time matrix of minimal network
Given the node map Given the node map
@@ -42,17 +41,6 @@ Feature: Basic Distance Matrix
| c | 30 | 20 | 0 | 30 | | c | 30 | 20 | 0 | 30 |
| d | 60 | 50 | 30 | 0 | | d | 60 | 50 | 30 | 0 |
When I request a travel time matrix I should get
| | a | b | c | d |
| a | 0 | 10 | 30 | 60 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 10 |
| c | 30 |
| d | 60 |
Scenario: Testbot - Travel time matrix with fuzzy match Scenario: Testbot - Travel time matrix with fuzzy match
Given the node map Given the node map
""" """
@@ -125,7 +113,7 @@ Feature: Basic Distance Matrix
| d | 20 | 30 | 0 | 30 | | d | 20 | 30 | 0 | 30 |
| e | 30 | 40 | 10 | 0 | | e | 30 | 40 | 10 | 0 |
Scenario: Testbot - Rectangular travel time matrix Scenario: Testbot - Travel time matrix and with only one source
Given the node map Given the node map
""" """
a b c a b c
@@ -144,46 +132,6 @@ Feature: Basic Distance Matrix
| | a | b | e | f | | | a | b | e | f |
| a | 0 | 10 | 20 | 30 | | a | 0 | 10 | 20 | 30 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 10 |
| e | 20 |
| f | 30 |
When I request a travel time matrix I should get
| | a | b | e | f |
| a | 0 | 10 | 20 | 30 |
| b | 10 | 0 | 10 | 20 |
When I request a travel time matrix I should get
| | a | b |
| a | 0 | 10 |
| b | 10 | 0 |
| e | 20 | 10 |
| f | 30 | 20 |
When I request a travel time matrix I should get
| | a | b | e | f |
| a | 0 | 10 | 20 | 30 |
| b | 10 | 0 | 10 | 20 |
| e | 20 | 10 | 0 | 10 |
When I request a travel time matrix I should get
| | a | b | e |
| a | 0 | 10 | 20 |
| b | 10 | 0 | 10 |
| e | 20 | 10 | 0 |
| f | 30 | 20 | 10 |
When I request a travel time matrix I should get
| | a | b | e | f |
| a | 0 | 10 | 20 | 30 |
| b | 10 | 0 | 10 | 20 |
| e | 20 | 10 | 0 | 10 |
| f | 30 | 20 | 10 | 0 |
Scenario: Testbot - Travel time 3x2 matrix Scenario: Testbot - Travel time 3x2 matrix
Given the node map Given the node map
""" """
@@ -360,52 +308,3 @@ Feature: Basic Distance Matrix
| 6 | 7 | 6 | 10 | 9 | 1 | 0 | 3.9 | 2.9 | | 6 | 7 | 6 | 10 | 9 | 1 | 0 | 3.9 | 2.9 |
| 7 | 3.1 | 2.1 | 6.1 | 5.1 | 9.1 | 8.1 | 0 | 11 | | 7 | 3.1 | 2.1 | 6.1 | 5.1 | 9.1 | 8.1 | 0 | 11 |
| 8 | 4.1 | 3.1 | 7.1 | 6.1 | 10.1 | 9.1 | 1 | 0 | | 8 | 4.1 | 3.1 | 7.1 | 6.1 | 10.1 | 9.1 | 1 | 0 |
Scenario: Testbot - Travel time matrix with ties
Given the profile file
"""
local functions = require('testbot')
functions.process_segment = function(profile, segment)
segment.weight = 1
segment.duration = 1
end
functions.process_turn = function(profile, turn)
if turn.angle >= 0 then
turn.duration = 16
else
turn.duration = 4
end
turn.weight = 0
end
return functions
"""
And the node map
"""
a b
c d
"""
And the ways
| nodes |
| ab |
| ac |
| bd |
| dc |
When I route I should get
| from | to | route | distance | time | weight |
| a | c | ac,ac | 200m | 5s | 5 |
When I request a travel time matrix I should get
| | a | b | c | d |
| a | 0 | 1 | 5 | 10 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 1 |
| c | 15 |
| d | 10 |
@@ -1,68 +0,0 @@
@routing @testbot @exclude
Feature: Testbot - Exclude flags regression tests
Background:
Given the profile "testbot"
Scenario: Testbot - Exclude toll regression 1
Given the node map
"""
a g
. .
b....d-$-$-e....f
. .
c h
"""
And the ways
| nodes | highway | toll | # |
| ab | primary | | always drivable |
| cb | primary | | always drivable |
| bd | primary | | always drivable |
| de | motorway | yes | not drivable for exclude=toll |
| ef | primary | | always drivable |
| fg | primary | | always drivable |
| fh | primary | | always drivable |
Given the query options
| exclude | toll |
When I route I should get
| from | to | route |
| a | h | |
| a | g | |
| g | a | |
| d | e | |
Scenario: Testbot - Exclude toll regression 2
Given the profile "testbot"
Given the node map
"""
a g
. .
b....d-$-$-e....f
. .
c h..i
"""
And the ways
| nodes | highway | toll | # |
| ab | primary | | always drivable |
| cb | primary | | always drivable |
| bd | primary | | always drivable |
| de | motorway | yes | not drivable for exclude=toll |
| ef | primary | | always drivable |
| fg | primary | | always drivable |
| fh | primary | | always drivable |
| hi | primary | | always drivable |
Given the query options
| exclude | toll |
When I route I should get
| from | to | route |
| a | h | |
| a | g | |
| g | a | |
| d | e | |
| d | i | |
-238
View File
@@ -480,241 +480,3 @@ Feature: Basic Map Matching
| trace | a:nodes | | trace | a:nodes |
| 12 | 1:2:3:4:5:6 | | 12 | 1:2:3:4:5:6 |
| 21 | 6:5:4:3:2:1 | | 21 | 6:5:4:3:2:1 |
Scenario: Matching with waypoints param for start/end
Given the node map
"""
a-----b---c
|
|
d
|
|
e
"""
And the ways
| nodes | oneway |
| abc | no |
| bde | no |
Given the query options
| waypoints | 0;3 |
When I match I should get
| trace | code | matchings | waypoints |
| abde | Ok | abde | ae |
Scenario: Matching with waypoints param that were tidied away
Given the node map
"""
a - b - c - e
|
f
|
g
"""
And the ways
| nodes | oneway |
| abce | no |
| cfg | no |
Given the query options
| tidy | true |
| waypoints | 0;2;5 |
When I match I should get
| trace | code | matchings | waypoints |
| abccfg | Ok | abcfg | acg |
Scenario: Testbot - Map matching refuses to use waypoints with trace splitting
Given the node map
"""
a b c d
e
"""
Given the query options
| waypoints | 0;3 |
And the ways
| nodes | oneway |
| abcd | no |
When I match I should get
| trace | timestamps | code |
| abcd | 0 1 62 63 | NoMatch |
Scenario: Testbot - Map matching invalid waypoints
Given the node map
"""
a b c d
e
"""
Given the query options
| waypoints | 0;4 |
And the ways
| nodes | oneway |
| abcd | no |
When I match I should get
| trace | code |
| abcd | InvalidOptions |
Scenario: Matching fail with waypoints param missing start/end
Given the node map
"""
a-----b---c
|
|
d
|
|
e
"""
And the ways
| nodes | oneway |
| abc | no |
| bde | no |
Given the query options
| waypoints | 1;3 |
When I match I should get
| trace | code |
| abde | InvalidValue |
Scenario: Testbot - Map matching with outlier that has no candidate and waypoint parameter
Given a grid size of 100 meters
Given the node map
"""
a b c d
1
"""
And the ways
| nodes | oneway |
| abcd | no |
Given the query options
| waypoints | 0;2;3 |
When I match I should get
| trace | timestamps | code |
| ab1d | 0 1 2 3 | NoMatch |
Scenario: Regression test - avoid collapsing legs of a tidied split trace
Given a grid size of 20 meters
Given the node map
"""
a--b--f
|
|
e--c---d--g
"""
Given the query options
| tidy | true |
And the ways
| nodes | oneway |
| abf | no |
| be | no |
| ecdg | no |
When I match I should get
| trace | timestamps | matchings | code |
| abbecd | 10 11 27 1516914902 1516914913 1516914952 | ab,ecd | Ok |
Scenario: Regression test - waypoints trimming too much geometry
# fixes bug in map matching collapsing that was dropping path geometries
# after segments that had 0 distance in internal route results
Given the node map
"""
ad
|
|
|
|
|e g
b--------------c
f h
"""
And the ways
| nodes |
| ab |
| bc |
Given the query options
| waypoints | 0;4 |
| overview | full |
When I match I should get
| trace | geometry | code |
| defgh | 1,1,1,0.999461,1.000674,0.999461 | Ok |
@match @testbot
Scenario: Regression test - waypoints trimming too much geometry
Given the profile "testbot"
Given a grid size of 10 meters
Given the query options
| geometries | geojson |
Given the node map
"""
bh
|
|
|
c
g\
\k
\
\
\
j f
"""
And the ways
| nodes |
| hc |
| cf |
Given the query options
| waypoints | 0;3 |
| overview | full |
When I match I should get
| trace | geometry | code |
| bgkj | 1.000135,1,1.000135,0.99964,1.000387,0.999137 | Ok |
@match @testbot
# Regression test for issue #4919
Scenario: Regression test - non-uturn maneuver preferred over uturn
Given the profile "testbot"
Given a grid size of 10 meters
Given the query options
| geometries | geojson |
Given the node map
"""
e
;
;
a----hb-----c
;
;
d
"""
And the ways
| nodes |
| abc |
| dbe |
Given the query options
| waypoints | 0;2 |
| overview | full |
| steps | true |
When I match I should get
| trace | geometry | turns | code |
| abc | 1,0.99973,1.00027,0.99973,1.000539,0.99973 | depart,arrive | Ok |
| abd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok |
| abe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok |
| ahd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok |
| ahe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok |
@@ -63,7 +63,6 @@ Feature: Multi level routing
| cm | primary | | cm | primary |
| hj | primary | | hj | primary |
| kp | primary | | kp | primary |
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 4,16"
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
@@ -83,28 +82,6 @@ Feature: Multi level routing
| l | 144.7 | 124.7 | 0 | 60 | | l | 144.7 | 124.7 | 0 | 60 |
| o | 124.7 | 144.7 | 60 | 0 | | o | 124.7 | 144.7 | 60 | 0 |
When I request a travel time matrix I should get
| | a | f | l | o |
| a | 0 | 229.4 | 144.7 | 124.7 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| f | 229.4 |
| l | 144.7 |
| o | 124.7 |
When I request a travel time matrix I should get
| | a | f | l | o |
| a | 0 | 229.4 | 144.7 | 124.7 |
| o | 124.7 | 144.7 | 60 | 0 |
When I request a travel time matrix I should get
| | a | o |
| a | 0 | 124.7 |
| f | 229.4 | 144.7 |
| l | 144.7 | 60 |
| o | 124.7 | 0 |
Scenario: Testbot - Multi level routing: horizontal road Scenario: Testbot - Multi level routing: horizontal road
Given the node map Given the node map
+1 -1
View File
@@ -309,7 +309,7 @@ Feature: Via points
| waypoints | route | | waypoints | route |
| a,b,e | | | a,b,e | |
@3359 @todo @3359
Scenario: U-Turn In Bearings Scenario: U-Turn In Bearings
Given the node map Given the node map
""" """
@@ -12,32 +12,14 @@ namespace osrm
namespace contractor namespace contractor
{ {
using GraphAndFilter = std::tuple<QueryGraph, std::vector<std::vector<bool>>>; using GraphFilterAndCore =
std::tuple<QueryGraph, std::vector<std::vector<bool>>, std::vector<std::vector<bool>>>;
inline auto contractFullGraph(ContractorGraph contractor_graph,
std::vector<EdgeWeight> node_weights)
{
auto num_nodes = contractor_graph.GetNumberOfNodes();
contractGraph(contractor_graph, node_weights);
auto edges = toEdges<QueryEdge>(std::move(contractor_graph));
std::vector<bool> edge_filter(edges.size(), true);
return GraphAndFilter{QueryGraph{num_nodes, std::move(edges)}, {std::move(edge_filter)}};
}
inline auto contractExcludableGraph(ContractorGraph contractor_graph_, inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
std::vector<EdgeWeight> node_weights, std::vector<EdgeWeight> node_weights,
const std::vector<std::vector<bool>> &filters) const std::vector<std::vector<bool>> &filters,
const float core_factor = 1.0)
{ {
if (filters.size() == 1)
{
if (std::all_of(filters.front().begin(), filters.front().end(), [](auto v) { return v; }))
{
return contractFullGraph(std::move(contractor_graph_), std::move(node_weights));
}
}
auto num_nodes = contractor_graph_.GetNumberOfNodes(); auto num_nodes = contractor_graph_.GetNumberOfNodes();
ContractedEdgeContainer edge_container; ContractedEdgeContainer edge_container;
ContractorGraph shared_core_graph; ContractorGraph shared_core_graph;
@@ -57,8 +39,10 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
// a very dense core. This increases the overall graph sizes a little bit // a very dense core. This increases the overall graph sizes a little bit
// but increases the final CH quality and contraction speed. // but increases the final CH quality and contraction speed.
constexpr float BASE_CORE = 0.9; constexpr float BASE_CORE = 0.9;
is_shared_core = is_shared_core = contractGraph(contractor_graph,
contractGraph(contractor_graph, std::move(always_allowed), node_weights, BASE_CORE); std::move(always_allowed),
node_weights,
std::min<float>(BASE_CORE, core_factor));
// Add all non-core edges to container // Add all non-core edges to container
{ {
@@ -69,11 +53,6 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
}); });
non_core_edges.resize(new_end - non_core_edges.begin()); non_core_edges.resize(new_end - non_core_edges.begin());
edge_container.Insert(std::move(non_core_edges)); edge_container.Insert(std::move(non_core_edges));
for (const auto filter_index : util::irange<std::size_t>(0, filters.size()))
{
edge_container.Filter(filters[filter_index], filter_index);
}
} }
// Extract core graph for further contraction // Extract core graph for further contraction
@@ -81,18 +60,26 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
[&is_shared_core](const NodeID node) { return is_shared_core[node]; }); [&is_shared_core](const NodeID node) { return is_shared_core[node]; });
} }
std::vector<std::vector<bool>> cores;
for (const auto &filter : filters) for (const auto &filter : filters)
{ {
auto filtered_core_graph = auto filtered_core_graph =
shared_core_graph.Filter([&filter](const NodeID node) { return filter[node]; }); shared_core_graph.Filter([&filter](const NodeID node) { return filter[node]; });
contractGraph(filtered_core_graph, is_shared_core, is_shared_core, node_weights); auto core = contractGraph(
filtered_core_graph, is_shared_core, is_shared_core, node_weights, core_factor);
if (core_factor == 1.0)
{
core.clear();
}
cores.push_back(std::move(core));
edge_container.Merge(toEdges<QueryEdge>(std::move(filtered_core_graph))); edge_container.Merge(toEdges<QueryEdge>(std::move(filtered_core_graph)));
} }
return GraphAndFilter{QueryGraph{num_nodes, std::move(edge_container.edges)}, return GraphFilterAndCore{QueryGraph{num_nodes, std::move(edge_container.edges)},
edge_container.MakeEdgeFilters()}; edge_container.MakeEdgeFilters(),
std::move(cores)};
} }
} }
} }
@@ -2,17 +2,9 @@
#define OSRM_CONTRACTOR_CONTRACTED_EDGE_CONTAINER_HPP #define OSRM_CONTRACTOR_CONTRACTED_EDGE_CONTAINER_HPP
#include "contractor/query_edge.hpp" #include "contractor/query_edge.hpp"
#include "util/deallocating_vector.hpp"
#include "util/integer_range.hpp"
#include "util/permutation.hpp"
#include <tbb/parallel_sort.h>
#include <algorithm>
#include <climits> #include <climits>
#include <cstdint>
#include <numeric>
#include <vector>
namespace osrm namespace osrm
{ {
@@ -51,7 +43,7 @@ struct ContractedEdgeContainer
} }
public: public:
void Insert(std::vector<QueryEdge> new_edges) void Insert(util::DeallocatingVector<QueryEdge> new_edges)
{ {
BOOST_ASSERT(edges.size() == 0); BOOST_ASSERT(edges.size() == 0);
BOOST_ASSERT(flags.empty()); BOOST_ASSERT(flags.empty());
@@ -60,89 +52,80 @@ struct ContractedEdgeContainer
flags.resize(edges.size(), ALL_FLAGS); flags.resize(edges.size(), ALL_FLAGS);
} }
void Filter(const std::vector<bool> &filter, std::size_t index) void Merge(util::DeallocatingVector<QueryEdge> new_edges)
{
BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT);
const MergedFlags flag = 1 << index;
for (auto edge_index : util::irange<std::size_t>(0, edges.size()))
{
auto allowed = filter[edges[edge_index].source] && filter[edges[edge_index].target];
if (allowed)
{
flags[edge_index] |= flag;
}
else
{
flags[edge_index] &= ~flag;
}
}
}
void Merge(std::vector<QueryEdge> new_edges)
{ {
BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT); BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT);
const MergedFlags flag = 1 << index++; const MergedFlags flag = 1 << index++;
auto edge_iter = edges.cbegin(); std::vector<MergedFlags> merged_flags;
auto edge_end = edges.cend(); merged_flags.reserve(flags.size() * 1.1);
util::DeallocatingVector<QueryEdge> merged_edges;
merged_edges.reserve(edges.size() * 1.1);
auto flags_iter = flags.begin(); auto flags_iter = flags.begin();
// destructive iterators, this is single-pass only
// FIXME using dbegin() dend() will result in segfaults.
auto edges_iter = edges.dbegin();
auto edges_end = edges.dend();
auto new_edges_iter = new_edges.dbegin();
auto new_edges_end = new_edges.dend();
// Remove all edges that are contained in the old set of edges and set the appropriate flag. while (edges_iter != edges_end && new_edges_iter != new_edges_end)
auto new_end = {
std::remove_if(new_edges.begin(), new_edges.end(), [&](const QueryEdge &edge) { while (edges_iter != edges_end && mergeCompare(*edges_iter, *new_edges_iter))
// check if the new edge would be sorted before the currend old edge {
// if so it is not contained yet in the set of old edges merged_edges.push_back(*edges_iter);
if (edge_iter == edge_end || mergeCompare(edge, *edge_iter)) merged_flags.push_back(*flags_iter);
{ edges_iter++;
return false; flags_iter++;
} }
// find the first old edge that is equal or greater then the new edge if (edges_iter == edges_end)
while (edge_iter != edge_end && mergeCompare(*edge_iter, edge)) {
{ break;
BOOST_ASSERT(flags_iter != flags.end()); }
edge_iter++;
flags_iter++;
}
// all new edges will be sorted after the old edges while (new_edges_iter != new_edges_end && mergeCompare(*new_edges_iter, *edges_iter))
if (edge_iter == edge_end) {
{ merged_edges.push_back(*new_edges_iter);
return false; merged_flags.push_back(flag);
} new_edges_iter++;
}
BOOST_ASSERT(edge_iter != edge_end); if (new_edges_iter == new_edges_end)
if (mergable(edge, *edge_iter)) {
{ break;
*flags_iter = *flags_iter | flag; }
return true;
}
BOOST_ASSERT(mergeCompare(edge, *edge_iter));
return false;
});
// append new edges while (edges_iter != edges_end && new_edges_iter != new_edges_end &&
edges.insert(edges.end(), new_edges.begin(), new_end); mergable(*edges_iter, *new_edges_iter))
auto edges_size = edges.size(); {
auto new_edges_size = std::distance(new_edges.begin(), new_end); merged_edges.push_back(*edges_iter);
BOOST_ASSERT(static_cast<int>(edges_size) >= new_edges_size); merged_flags.push_back(*flags_iter | flag);
flags.resize(edges_size);
std::fill(flags.begin() + edges_size - new_edges_size, flags.end(), flag);
// enforce sorting for next merge step edges_iter++;
std::vector<unsigned> ordering(edges_size); flags_iter++;
std::iota(ordering.begin(), ordering.end(), 0); new_edges_iter++;
tbb::parallel_sort( }
ordering.begin(), ordering.end(), [&](const auto lhs_idx, const auto rhs_idx) { }
return mergeCompare(edges[lhs_idx], edges[rhs_idx]);
});
auto permutation = util::orderingToPermutation(ordering);
util::inplacePermutation(edges.begin(), edges.end(), permutation); while (edges_iter != edges_end)
util::inplacePermutation(flags.begin(), flags.end(), permutation); {
BOOST_ASSERT(std::is_sorted(edges.begin(), edges.end(), mergeCompare)); BOOST_ASSERT(new_edges_iter == new_edges_end);
merged_edges.push_back(*edges_iter++);
merged_flags.push_back(*flags_iter++);
}
while (new_edges_iter != new_edges_end)
{
BOOST_ASSERT(edges_iter == edges_end);
merged_edges.push_back(*new_edges_iter++);
merged_flags.push_back(flag);
}
flags = std::move(merged_flags);
edges = std::move(merged_edges);
} }
auto MakeEdgeFilters() const auto MakeEdgeFilters() const
@@ -162,7 +145,7 @@ struct ContractedEdgeContainer
std::size_t index = 0; std::size_t index = 0;
std::vector<MergedFlags> flags; std::vector<MergedFlags> flags;
std::vector<QueryEdge> edges; util::DeallocatingVector<QueryEdge> edges;
}; };
} }
} }
+21 -1
View File
@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@@ -29,6 +29,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define CONTRACTOR_CONTRACTOR_HPP #define CONTRACTOR_CONTRACTOR_HPP
#include "contractor/contractor_config.hpp" #include "contractor/contractor_config.hpp"
#include "contractor/query_edge.hpp"
#include "extractor/edge_based_edge.hpp"
#include "extractor/edge_based_node_segment.hpp"
#include "util/deallocating_vector.hpp"
#include "util/typedefs.hpp"
#include <string>
#include <vector>
#include <cstddef>
namespace osrm namespace osrm
{ {
@@ -39,6 +49,8 @@ namespace contractor
class Contractor class Contractor
{ {
public: public:
using EdgeData = QueryEdge::EdgeData;
explicit Contractor(const ContractorConfig &config_) : config{config_} {} explicit Contractor(const ContractorConfig &config_) : config{config_} {}
Contractor(const Contractor &) = delete; Contractor(const Contractor &) = delete;
@@ -46,6 +58,14 @@ class Contractor
int Run(); int Run();
protected:
void ContractGraph(const unsigned max_edge_id,
util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
util::DeallocatingVector<QueryEdge> &contracted_edge_list,
std::vector<EdgeWeight> &&node_weights,
std::vector<bool> &is_core_node,
std::vector<float> &inout_node_levels) const;
private: private:
ContractorConfig config; ContractorConfig config;
}; };
+2 -4
View File
@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@@ -45,7 +45,7 @@ struct ContractorConfig final : storage::IOConfig
ContractorConfig() ContractorConfig()
: IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"}, : IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"},
{}, {},
{".osrm.hsgr", ".osrm.enw"}), {".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"}),
requested_num_threads(0) requested_num_threads(0)
{ {
} }
@@ -61,12 +61,10 @@ struct ContractorConfig final : storage::IOConfig
updater::UpdaterConfig updater_config; updater::UpdaterConfig updater_config;
// DEPRECATED to be removed in v6.0
bool use_cached_priority; bool use_cached_priority;
unsigned requested_num_threads; unsigned requested_num_threads;
// DEPRECATED to be removed in v6.0
// A percentage of vertices that will be contracted for the hierarchy. // A percentage of vertices that will be contracted for the hierarchy.
// Offers a trade-off between preprocessing and query time. // Offers a trade-off between preprocessing and query time.
// The remaining vertices form the core of the hierarchy // The remaining vertices form the core of the hierarchy
+51 -6
View File
@@ -14,13 +14,43 @@ namespace contractor
{ {
namespace files namespace files
{ {
// reads .osrm.core
template <typename CoreVectorT>
void readCoreMarker(const boost::filesystem::path &path, std::vector<CoreVectorT> &cores)
{
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
"cores must be a vector of boolean vectors");
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
auto num_cores = reader.ReadElementCount64();
cores.resize(num_cores);
for (const auto index : util::irange<std::size_t>(0, num_cores))
{
storage::serialization::read(reader, cores[index]);
}
}
// writes .osrm.core
template <typename CoreVectorT>
void writeCoreMarker(const boost::filesystem::path &path, const std::vector<CoreVectorT> &cores)
{
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
"cores must be a vector of boolean vectors");
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
writer.WriteElementCount64(cores.size());
for (const auto &core : cores)
{
storage::serialization::write(writer, core);
}
}
// reads .osrm.hsgr file // reads .osrm.hsgr file
template <typename QueryGraphT, typename EdgeFilterT> template <typename QueryGraphT, typename EdgeFilterT>
inline void readGraph(const boost::filesystem::path &path, inline void readGraph(const boost::filesystem::path &path,
unsigned &checksum, unsigned &checksum,
QueryGraphT &graph, QueryGraphT &graph,
std::vector<EdgeFilterT> &edge_filter, std::vector<EdgeFilterT> &edge_filter)
std::uint32_t &connectivity_checksum)
{ {
static_assert(std::is_same<QueryGraphView, QueryGraphT>::value || static_assert(std::is_same<QueryGraphView, QueryGraphT>::value ||
std::is_same<QueryGraph, QueryGraphT>::value, std::is_same<QueryGraph, QueryGraphT>::value,
@@ -40,7 +70,6 @@ inline void readGraph(const boost::filesystem::path &path,
{ {
storage::serialization::read(reader, edge_filter[index]); storage::serialization::read(reader, edge_filter[index]);
} }
reader.ReadInto(connectivity_checksum);
} }
// writes .osrm.hsgr file // writes .osrm.hsgr file
@@ -48,8 +77,7 @@ template <typename QueryGraphT, typename EdgeFilterT>
inline void writeGraph(const boost::filesystem::path &path, inline void writeGraph(const boost::filesystem::path &path,
unsigned checksum, unsigned checksum,
const QueryGraphT &graph, const QueryGraphT &graph,
const std::vector<EdgeFilterT> &edge_filter, const std::vector<EdgeFilterT> &edge_filter)
const std::uint32_t connectivity_checksum)
{ {
static_assert(std::is_same<QueryGraphView, QueryGraphT>::value || static_assert(std::is_same<QueryGraphView, QueryGraphT>::value ||
std::is_same<QueryGraph, QueryGraphT>::value, std::is_same<QueryGraph, QueryGraphT>::value,
@@ -67,7 +95,24 @@ inline void writeGraph(const boost::filesystem::path &path,
{ {
storage::serialization::write(writer, filter); storage::serialization::write(writer, filter);
} }
writer.WriteOne(connectivity_checksum); }
// reads .levels file
inline void readLevels(const boost::filesystem::path &path, std::vector<float> &node_levels)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
storage::serialization::read(reader, node_levels);
}
// writes .levels file
inline void writeLevels(const boost::filesystem::path &path, const std::vector<float> &node_levels)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};
storage::serialization::write(writer, node_levels);
} }
} }
} }
@@ -2,7 +2,6 @@
#define OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_ #define OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_
#include "contractor/contractor_graph.hpp" #include "contractor/contractor_graph.hpp"
#include "util/log.hpp" #include "util/log.hpp"
#include "util/percent.hpp" #include "util/percent.hpp"
@@ -126,10 +125,9 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
return ContractorGraph{number_of_nodes, edges}; return ContractorGraph{number_of_nodes, edges};
} }
template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT graph) template <class Edge, typename GraphT> inline util::DeallocatingVector<Edge> toEdges(GraphT graph)
{ {
std::vector<Edge> edges; util::DeallocatingVector<Edge> edges;
edges.reserve(graph.GetNumberOfEdges());
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Getting edges of minimized graph "; log << "Getting edges of minimized graph ";
@@ -165,7 +163,6 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
tbb::parallel_sort(edges.begin(), edges.end()); tbb::parallel_sort(edges.begin(), edges.end());
auto new_end = std::unique(edges.begin(), edges.end()); auto new_end = std::unique(edges.begin(), edges.end());
edges.resize(new_end - edges.begin()); edges.resize(new_end - edges.begin());
edges.shrink_to_fit();
return edges; return edges;
} }
+12 -17
View File
@@ -1,12 +1,11 @@
#ifndef OSRM_CELLS_CUSTOMIZER_HPP #ifndef OSRM_CELLS_CUSTOMIZER_HPP
#define OSRM_CELLS_CUSTOMIZER_HPP #define OSRM_CELLS_CUSTOMIZER_HPP
#include "partitioner/cell_storage.hpp" #include "partition/cell_storage.hpp"
#include "partitioner/multi_level_partition.hpp" #include "partition/multi_level_partition.hpp"
#include "util/query_heap.hpp" #include "util/query_heap.hpp"
#include <tbb/enumerable_thread_specific.h> #include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <unordered_set> #include <unordered_set>
@@ -29,12 +28,12 @@ class CellCustomizer
util::QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>; util::QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
using HeapPtr = tbb::enumerable_thread_specific<Heap>; using HeapPtr = tbb::enumerable_thread_specific<Heap>;
CellCustomizer(const partitioner::MultiLevelPartition &partition) : partition(partition) {} CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {}
template <typename GraphT> template <typename GraphT>
void Customize(const GraphT &graph, void Customize(const GraphT &graph,
Heap &heap, Heap &heap,
const partitioner::CellStorage &cells, const partition::CellStorage &cells,
const std::vector<bool> &allowed_nodes, const std::vector<bool> &allowed_nodes,
CellMetric &metric, CellMetric &metric,
LevelID level, LevelID level,
@@ -97,7 +96,7 @@ class CellCustomizer
template <typename GraphT> template <typename GraphT>
void Customize(const GraphT &graph, void Customize(const GraphT &graph,
const partitioner::CellStorage &cells, const partition::CellStorage &cells,
const std::vector<bool> &allowed_nodes, const std::vector<bool> &allowed_nodes,
CellMetric &metric) const CellMetric &metric) const
{ {
@@ -121,7 +120,7 @@ class CellCustomizer
private: private:
template <typename GraphT> template <typename GraphT>
void RelaxNode(const GraphT &graph, void RelaxNode(const GraphT &graph,
const partitioner::CellStorage &cells, const partition::CellStorage &cells,
const std::vector<bool> &allowed_nodes, const std::vector<bool> &allowed_nodes,
const CellMetric &metric, const CellMetric &metric,
Heap &heap, Heap &heap,
@@ -160,16 +159,14 @@ class CellCustomizer
} }
const EdgeWeight to_weight = weight + subcell_weight; const EdgeWeight to_weight = weight + subcell_weight;
const EdgeDuration to_duration = duration + *subcell_duration;
if (!heap.WasInserted(to)) if (!heap.WasInserted(to))
{ {
heap.Insert(to, to_weight, {true, to_duration}); heap.Insert(to, to_weight, {true, duration + *subcell_duration});
} }
else if (std::tie(to_weight, to_duration) < else if (to_weight < heap.GetKey(to))
std::tie(heap.GetKey(to), heap.GetData(to).duration))
{ {
heap.DecreaseKey(to, to_weight); heap.DecreaseKey(to, to_weight);
heap.GetData(to) = {true, to_duration}; heap.GetData(to) = {true, duration + *subcell_duration};
} }
} }
@@ -194,22 +191,20 @@ class CellCustomizer
partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to))) partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to)))
{ {
const EdgeWeight to_weight = weight + data.weight; const EdgeWeight to_weight = weight + data.weight;
const EdgeDuration to_duration = duration + data.duration;
if (!heap.WasInserted(to)) if (!heap.WasInserted(to))
{ {
heap.Insert(to, to_weight, {false, duration + data.duration}); heap.Insert(to, to_weight, {false, duration + data.duration});
} }
else if (std::tie(to_weight, to_duration) < else if (to_weight < heap.GetKey(to))
std::tie(heap.GetKey(to), heap.GetData(to).duration))
{ {
heap.DecreaseKey(to, to_weight); heap.DecreaseKey(to, to_weight);
heap.GetData(to) = {false, to_duration}; heap.GetData(to) = {false, duration + data.duration};
} }
} }
} }
} }
const partitioner::MultiLevelPartition &partition; const partition::MultiLevelPartition &partition;
}; };
} }
} }
+7 -8
View File
@@ -2,8 +2,8 @@
#define OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP #define OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP
#include "extractor/edge_based_edge.hpp" #include "extractor/edge_based_edge.hpp"
#include "partitioner/edge_based_graph.hpp" #include "partition/edge_based_graph.hpp"
#include "partitioner/multi_level_graph.hpp" #include "partition/multi_level_graph.hpp"
#include "util/static_graph.hpp" #include "util/static_graph.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
@@ -16,20 +16,19 @@ namespace osrm
namespace customizer namespace customizer
{ {
using EdgeBasedGraphEdgeData = partitioner::EdgeBasedGraphEdgeData; using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
struct MultiLevelEdgeBasedGraph struct MultiLevelEdgeBasedGraph
: public partitioner::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container> : public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>
{ {
using Base = using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
partitioner::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
using Base::Base; using Base::Base;
}; };
struct MultiLevelEdgeBasedGraphView struct MultiLevelEdgeBasedGraphView
: public partitioner::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View> : public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>
{ {
using Base = partitioner::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>; using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>;
using Base::Base; using Base::Base;
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef OSRM_CUSTOMIZER_SERIALIZATION_HPP #ifndef OSRM_CUSTOMIZER_SERIALIZATION_HPP
#define OSRM_CUSTOMIZER_SERIALIZATION_HPP #define OSRM_CUSTOMIZER_SERIALIZATION_HPP
#include "partitioner/cell_storage.hpp" #include "partition/cell_storage.hpp"
#include "storage/io.hpp" #include "storage/io.hpp"
#include "storage/serialization.hpp" #include "storage/serialization.hpp"
+26
View File
@@ -17,6 +17,13 @@ struct Algorithm final
{ {
}; };
} }
// Contraction Hiearchy with core
namespace corech
{
struct Algorithm final
{
};
}
// Multi-Level Dijkstra // Multi-Level Dijkstra
namespace mld namespace mld
{ {
@@ -28,6 +35,7 @@ struct Algorithm final
// Algorithm names // Algorithm names
template <typename AlgorithmT> const char *name(); template <typename AlgorithmT> const char *name();
template <> inline const char *name<ch::Algorithm>() { return "CH"; } template <> inline const char *name<ch::Algorithm>() { return "CH"; }
template <> inline const char *name<corech::Algorithm>() { return "CoreCH"; }
template <> inline const char *name<mld::Algorithm>() { return "MLD"; } template <> inline const char *name<mld::Algorithm>() { return "MLD"; }
template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type
@@ -75,6 +83,24 @@ template <> struct HasExcludeFlags<ch::Algorithm> final : std::true_type
{ {
}; };
// Algorithms supported by Contraction Hierarchies with core
// the rest is disabled because of performance reasons
template <> struct HasShortestPathSearch<corech::Algorithm> final : std::true_type
{
};
template <> struct HasDirectShortestPathSearch<corech::Algorithm> final : std::true_type
{
};
template <> struct HasMapMatching<corech::Algorithm> final : std::true_type
{
};
template <> struct HasGetTileTurns<corech::Algorithm> final : std::true_type
{
};
template <> struct HasExcludeFlags<corech::Algorithm> final : std::true_type
{
};
// Algorithms supported by Multi-Level Dijkstra // Algorithms supported by Multi-Level Dijkstra
template <> struct HasAlternativePathSearch<mld::Algorithm> final : std::true_type template <> struct HasAlternativePathSearch<mld::Algorithm> final : std::true_type
{ {
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
+15 -1
View File
@@ -1,8 +1,8 @@
#ifndef ENGINE_RESPONSE_OBJECTS_HPP_ #ifndef ENGINE_RESPONSE_OBJECTS_HPP_
#define ENGINE_RESPONSE_OBJECTS_HPP_ #define ENGINE_RESPONSE_OBJECTS_HPP_
#include "extractor/guidance/turn_instruction.hpp"
#include "extractor/travel_mode.hpp" #include "extractor/travel_mode.hpp"
#include "guidance/turn_instruction.hpp"
#include "engine/guidance/leg_geometry.hpp" #include "engine/guidance/leg_geometry.hpp"
#include "engine/guidance/route.hpp" #include "engine/guidance/route.hpp"
#include "engine/guidance/route_leg.hpp" #include "engine/guidance/route_leg.hpp"
@@ -33,8 +33,22 @@ namespace json
namespace detail namespace detail
{ {
std::string instructionTypeToString(extractor::guidance::TurnType::Enum type);
std::string instructionModifierToString(extractor::guidance::DirectionModifier::Enum modifier);
/**
* Returns a string representing all instruction types (including internal types that
* are normally not exposed in route responses)
*
* @param type the TurnType value to convert into a string
* @return a string representing the turn type (e.g. `turn` or `continue`)
*/
std::string internalInstructionTypeToString(extractor::guidance::TurnType::Enum type);
util::json::Array coordinateToLonLat(const util::Coordinate coordinate); util::json::Array coordinateToLonLat(const util::Coordinate coordinate);
std::string modeToString(const extractor::TravelMode mode);
/** /**
* Ensures that a bearing value is a whole number, and clamped to the range 0-359 * Ensures that a bearing value is a whole number, and clamped to the range 0-359
*/ */
-21
View File
@@ -86,10 +86,6 @@ class MatchAPI final : public RouteAPI
for (auto point_index : util::irange( for (auto point_index : util::irange(
0u, static_cast<unsigned>(sub_matchings[sub_matching_index].indices.size()))) 0u, static_cast<unsigned>(sub_matchings[sub_matching_index].indices.size())))
{ {
// tidied_to_original: index of the input coordinate that a tidied coordinate
// corresponds to.
// sub_matching indices: index of the coordinate passed to map matching plugin that
// a matched node corresponds to.
trace_idx_to_matching_idx[tidy_result trace_idx_to_matching_idx[tidy_result
.tidied_to_original[sub_matchings[sub_matching_index] .tidied_to_original[sub_matchings[sub_matching_index]
.indices[point_index]]] = .indices[point_index]]] =
@@ -97,9 +93,6 @@ class MatchAPI final : public RouteAPI
} }
} }
BOOST_ASSERT(parameters.waypoints.empty() || sub_matchings.size() == 1);
std::size_t was_waypoint_idx = 0;
for (auto trace_index : util::irange<std::size_t>(0UL, parameters.coordinates.size())) for (auto trace_index : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
{ {
if (tidy_result.can_be_removed[trace_index]) if (tidy_result.can_be_removed[trace_index])
@@ -121,20 +114,6 @@ class MatchAPI final : public RouteAPI
waypoint.values["alternatives_count"] = waypoint.values["alternatives_count"] =
sub_matchings[matching_index.sub_matching_index] sub_matchings[matching_index.sub_matching_index]
.alternatives_count[matching_index.point_index]; .alternatives_count[matching_index.point_index];
// waypoint indices need to be adjusted if route legs were collapsed
// waypoint parameter assumes there is only one match object
if (!parameters.waypoints.empty())
{
if (tidy_result.was_waypoint[trace_index])
{
waypoint.values["waypoint_index"] = was_waypoint_idx;
was_waypoint_idx++;
}
else
{
waypoint.values["waypoint_index"] = util::json::Null();
}
}
waypoints.values.push_back(std::move(waypoint)); waypoints.values.push_back(std::move(waypoint));
} }
+4 -19
View File
@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@@ -63,40 +63,25 @@ struct MatchParameters : public RouteParameters
RouteParameters::GeometriesType::Polyline, RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified, RouteParameters::OverviewType::Simplified,
{}), {}),
gaps(GapsType::Split), tidy(false), waypoints() gaps(GapsType::Split), tidy(false)
{ {
} }
template <typename... Args> template <typename... Args>
MatchParameters(std::vector<unsigned> timestamps_, GapsType gaps_, bool tidy_, Args... args_) MatchParameters(std::vector<unsigned> timestamps_, GapsType gaps_, bool tidy_, Args... args_)
: MatchParameters(std::move(timestamps_), gaps_, tidy_, {}, std::forward<Args>(args_)...)
{
}
template <typename... Args>
MatchParameters(std::vector<unsigned> timestamps_,
GapsType gaps_,
bool tidy_,
std::vector<std::size_t> waypoints_,
Args... args_)
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)}, : RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)},
gaps(gaps_), tidy(tidy_), waypoints{std::move(waypoints_)} gaps(gaps_), tidy(tidy_)
{ {
} }
std::vector<unsigned> timestamps; std::vector<unsigned> timestamps;
GapsType gaps; GapsType gaps;
bool tidy; bool tidy;
std::vector<std::size_t> waypoints;
bool IsValid() const bool IsValid() const
{ {
const auto valid_waypoints =
std::all_of(waypoints.begin(), waypoints.end(), [this](const auto &w) {
return w < coordinates.size();
});
return RouteParameters::IsValid() && return RouteParameters::IsValid() &&
(timestamps.empty() || timestamps.size() == coordinates.size()) && valid_waypoints; (timestamps.empty() || timestamps.size() == coordinates.size());
} }
}; };
} }
+2 -39
View File
@@ -37,9 +37,6 @@ struct Result
Mask can_be_removed; Mask can_be_removed;
// Maps the MatchParameter's original items to items which should not be removed. // Maps the MatchParameter's original items to items which should not be removed.
Mapping tidied_to_original; Mapping tidied_to_original;
// Masking the MatchParameter coordinates for items whose indices were present in the
// `waypoints` parameter.
Mask was_waypoint;
}; };
inline Result keep_all(const MatchParameters &params) inline Result keep_all(const MatchParameters &params)
@@ -47,17 +44,6 @@ inline Result keep_all(const MatchParameters &params)
Result result; Result result;
result.can_be_removed.resize(params.coordinates.size(), false); result.can_be_removed.resize(params.coordinates.size(), false);
result.was_waypoint.resize(params.coordinates.size(), true);
// by default all input coordinates are treated as waypoints
if (!params.waypoints.empty())
{
for (const auto p : params.waypoints)
{
result.was_waypoint.set(p, false);
}
// logic is a little funny, uses inversion to set the bitfield
result.was_waypoint.flip();
}
result.tidied_to_original.reserve(params.coordinates.size()); result.tidied_to_original.reserve(params.coordinates.size());
for (std::size_t current = 0; current < params.coordinates.size(); ++current) for (std::size_t current = 0; current < params.coordinates.size(); ++current)
{ {
@@ -75,8 +61,6 @@ inline Result keep_all(const MatchParameters &params)
{ {
result.parameters.coordinates.push_back(params.coordinates[i]); result.parameters.coordinates.push_back(params.coordinates[i]);
if (result.was_waypoint[i])
result.parameters.waypoints.push_back(result.parameters.coordinates.size() - 1);
if (!params.hints.empty()) if (!params.hints.empty())
result.parameters.hints.push_back(params.hints[i]); result.parameters.hints.push_back(params.hints[i]);
@@ -90,8 +74,6 @@ inline Result keep_all(const MatchParameters &params)
result.parameters.timestamps.push_back(params.timestamps[i]); result.parameters.timestamps.push_back(params.timestamps[i]);
} }
} }
if (params.waypoints.empty())
result.parameters.waypoints.clear();
return result; return result;
} }
@@ -103,15 +85,6 @@ inline Result tidy(const MatchParameters &params, Thresholds cfg = {15., 5})
Result result; Result result;
result.can_be_removed.resize(params.coordinates.size(), false); result.can_be_removed.resize(params.coordinates.size(), false);
result.was_waypoint.resize(params.coordinates.size(), true);
if (!params.waypoints.empty())
{
for (const auto p : params.waypoints)
{
result.was_waypoint.set(p, false);
}
result.was_waypoint.flip();
}
result.tidied_to_original.push_back(0); result.tidied_to_original.push_back(0);
@@ -165,14 +138,13 @@ inline Result tidy(const MatchParameters &params, Thresholds cfg = {15., 5})
// We have to filter parallel arrays that may be empty or the exact same size. // We have to filter parallel arrays that may be empty or the exact same size.
// result.parameters contains an empty MatchParameters at this point: conditionally fill. // result.parameters contains an empty MatchParameters at this point: conditionally fill.
for (std::size_t i = 0; i < result.can_be_removed.size(); ++i) for (std::size_t i = 0; i < result.can_be_removed.size(); ++i)
{ {
if (!result.can_be_removed[i]) if (!result.can_be_removed[i])
{ {
result.parameters.coordinates.push_back(params.coordinates[i]); result.parameters.coordinates.push_back(params.coordinates[i]);
if (result.was_waypoint[i])
result.parameters.waypoints.push_back(result.parameters.coordinates.size() - 1);
if (!params.hints.empty()) if (!params.hints.empty())
result.parameters.hints.push_back(params.hints[i]); result.parameters.hints.push_back(params.hints[i]);
@@ -185,17 +157,8 @@ inline Result tidy(const MatchParameters &params, Thresholds cfg = {15., 5})
if (!params.timestamps.empty()) if (!params.timestamps.empty())
result.parameters.timestamps.push_back(params.timestamps[i]); result.parameters.timestamps.push_back(params.timestamps[i]);
} }
else
{
// one of the coordinates meant to be used as a waypoint was marked for removal
// update the original waypoint index to the new representative coordinate
const auto last_idx = result.parameters.coordinates.size() - 1;
if (result.was_waypoint[i] && (result.parameters.waypoints.back() != last_idx))
{
result.parameters.waypoints.push_back(last_idx);
}
}
} }
BOOST_ASSERT(result.tidied_to_original.size() == result.parameters.coordinates.size());
return result; return result;
} }
+1 -43
View File
@@ -38,50 +38,8 @@ class NearestAPI final : public BaseAPI
phantom_nodes.front().end(), phantom_nodes.front().end(),
waypoints.values.begin(), waypoints.values.begin(),
[this](const PhantomNodeWithDistance &phantom_with_distance) { [this](const PhantomNodeWithDistance &phantom_with_distance) {
auto &phantom_node = phantom_with_distance.phantom_node; auto waypoint = MakeWaypoint(phantom_with_distance.phantom_node);
auto waypoint = MakeWaypoint(phantom_node);
waypoint.values["distance"] = phantom_with_distance.distance; waypoint.values["distance"] = phantom_with_distance.distance;
util::json::Array nodes;
std::uint64_t from_node = 0;
std::uint64_t to_node = 0;
std::vector<NodeID> forward_geometry;
if (phantom_node.forward_segment_id.enabled)
{
auto segment_id = phantom_node.forward_segment_id.id;
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
forward_geometry =
facade.GetUncompressedForwardGeometry(geometry_id);
auto osm_node_id = facade.GetOSMNodeIDOfNode(
forward_geometry[phantom_node.fwd_segment_position]);
to_node = static_cast<std::uint64_t>(osm_node_id);
}
if (phantom_node.reverse_segment_id.enabled)
{
auto segment_id = phantom_node.reverse_segment_id.id;
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
std::vector<NodeID> geometry =
facade.GetUncompressedForwardGeometry(geometry_id);
auto osm_node_id = facade.GetOSMNodeIDOfNode(
geometry[phantom_node.fwd_segment_position + 1]);
from_node = static_cast<std::uint64_t>(osm_node_id);
}
else if (phantom_node.forward_segment_id.enabled &&
phantom_node.fwd_segment_position > 0)
{
// In the case of one way, rely on forward segment only
auto osm_node_id = facade.GetOSMNodeIDOfNode(
forward_geometry[phantom_node.fwd_segment_position - 1]);
from_node = static_cast<std::uint64_t>(osm_node_id);
}
nodes.values.push_back(from_node);
nodes.values.push_back(to_node);
waypoint.values["nodes"] = std::move(nodes);
return waypoint; return waypoint;
}); });
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
+13 -30
View File
@@ -1,7 +1,6 @@
#ifndef ENGINE_API_ROUTE_HPP #ifndef ENGINE_API_ROUTE_HPP
#define ENGINE_API_ROUTE_HPP #define ENGINE_API_ROUTE_HPP
#include "extractor/maneuver_override.hpp"
#include "engine/api/base_api.hpp" #include "engine/api/base_api.hpp"
#include "engine/api/json_factory.hpp" #include "engine/api/json_factory.hpp"
#include "engine/api/route_parameters.hpp" #include "engine/api/route_parameters.hpp"
@@ -20,8 +19,6 @@
#include "engine/internal_route_result.hpp" #include "engine/internal_route_result.hpp"
#include "guidance/turn_instruction.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
#include "util/integer_range.hpp" #include "util/integer_range.hpp"
#include "util/json_util.hpp" #include "util/json_util.hpp"
@@ -91,12 +88,11 @@ class RouteAPI : public BaseAPI
{ {
util::json::Array annotations_store; util::json::Array annotations_store;
annotations_store.values.reserve(leg.annotations.size()); annotations_store.values.reserve(leg.annotations.size());
std::for_each(leg.annotations.begin(),
for (const auto &step : leg.annotations) leg.annotations.end(),
{ [Get, &annotations_store](const auto &step) {
annotations_store.values.push_back(Get(step)); annotations_store.values.push_back(Get(step));
} });
return annotations_store; return annotations_store;
} }
@@ -133,7 +129,6 @@ class RouteAPI : public BaseAPI
reversed_target, reversed_target,
parameters.steps); parameters.steps);
util::Log(logDEBUG) << "Assembling steps " << std::endl;
if (parameters.steps) if (parameters.steps)
{ {
auto steps = guidance::assembleSteps(BaseAPI::facade, auto steps = guidance::assembleSteps(BaseAPI::facade,
@@ -144,10 +139,6 @@ class RouteAPI : public BaseAPI
reversed_source, reversed_source,
reversed_target); reversed_target);
// Apply maneuver overrides before any other post
// processing is performed
guidance::applyOverrides(BaseAPI::facade, steps, leg_geometry);
/* Perform step-based post-processing. /* Perform step-based post-processing.
* *
* Using post-processing on basis of route-steps for a single leg at a time * Using post-processing on basis of route-steps for a single leg at a time
@@ -264,19 +255,10 @@ class RouteAPI : public BaseAPI
// AnnotationsType uses bit flags, & operator checks if a property is set // AnnotationsType uses bit flags, & operator checks if a property is set
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed) if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
{ {
double prev_speed = 0;
annotation.values["speed"] = GetAnnotations( annotation.values["speed"] = GetAnnotations(
leg_geometry, [&prev_speed](const guidance::LegGeometry::Annotation &anno) { leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
if (anno.duration < std::numeric_limits<double>::min()) auto val = std::round(anno.distance / anno.duration * 10.) / 10.;
{ return util::json::clamp_float(val);
return prev_speed;
}
else
{
auto speed = std::round(anno.distance / anno.duration * 10.) / 10.;
prev_speed = speed;
return util::json::clamp_float(speed);
}
}); });
} }
@@ -311,10 +293,11 @@ class RouteAPI : public BaseAPI
{ {
util::json::Array nodes; util::json::Array nodes;
nodes.values.reserve(leg_geometry.osm_node_ids.size()); nodes.values.reserve(leg_geometry.osm_node_ids.size());
for (const auto node_id : leg_geometry.osm_node_ids) std::for_each(leg_geometry.osm_node_ids.begin(),
{ leg_geometry.osm_node_ids.end(),
nodes.values.push_back(static_cast<std::uint64_t>(node_id)); [this, &nodes](const OSMNodeID &node_id) {
} nodes.values.push_back(static_cast<std::uint64_t>(node_id));
});
annotation.values["nodes"] = std::move(nodes); annotation.values["nodes"] = std::move(nodes);
} }
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2017, Project OSRM contributors Copyright (c) 2016, Project OSRM contributors
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,

Some files were not shown because too many files have changed in this diff Show More