Compare commits

..

12 Commits

Author SHA1 Message Date
Patrick Niklaus 1869840f0e [publish binary] Test building node binaries with MLD 2017-03-22 00:51:07 +00:00
Patrick Niklaus 8532b5460b Disable doc builds because they are broken 2017-03-22 00:30:42 +00:00
Patrick Niklaus 1fdbaf4a39 Upgrade docbox 2017-03-22 00:04:46 +00:00
Patrick Niklaus 08527175b5 Fresh lock file 2017-03-21 23:44:08 +00:00
Patrick Niklaus d792572ece Install yarn on OSX by hand and update lock file 2017-03-21 23:26:32 +00:00
Patrick Niklaus 2a691ac5be Integrate documentation JS and make travis file slightly more readable 2017-03-21 22:50:08 +00:00
Patrick Niklaus 2221a34529 Switch to yarn 2017-03-21 22:37:16 +00:00
Patrick Niklaus a8fd4050a2 Integrate node-osrm docs 2017-03-21 22:29:00 +00:00
Patrick Niklaus 85ee03dfde Also copy osrm-partition and osrm-customize 2017-03-21 20:15:08 +00:00
Patrick Niklaus 694e3854d7 Test routing on CH, MLD, CoreCH via node bindings 2017-03-21 20:15:08 +00:00
Patrick Niklaus 90ed027711 Integrate MLD into node-bindings 2017-03-21 20:15:06 +00:00
Patrick Niklaus ac0c5c27e7 First steps towards integrating MLD in node bindings 2017-03-21 20:12:56 +00:00
714 changed files with 11861 additions and 82231 deletions
-15
View File
@@ -1,15 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text
*.hpp text
# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
-7
View File
@@ -7,8 +7,6 @@
############################# #############################
osrm-deps osrm-deps
.ycm_extra_conf.py
# Compiled source # # Compiled source #
################### ###################
*.com *.com
@@ -61,11 +59,6 @@ Thumbs.db
.cproject .cproject
.project .project
# Visual Studio (Code) related files #
######################################
/.vs*
/*.local.bat
# stxxl related files # # stxxl related files #
####################### #######################
.stxxl .stxxl
+10
View File
@@ -0,0 +1,10 @@
*
!README.md
!CHANGELOG.md
!CONTRIBUTING.MD
!LICENCE.TXT
!package.json
!example
!lib/*.js
!profiles/*
!profiles/lib/*
+46 -188
View File
@@ -7,9 +7,8 @@ git:
sudo: required sudo: required
dist: trusty dist: trusty
node_js: nodejs:
- "4" - "4"
- "6"
notifications: notifications:
email: false email: false
@@ -17,9 +16,6 @@ notifications:
branches: branches:
only: only:
- master - master
# enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
- "5.9"
cache: cache:
yarn: true yarn: true
@@ -30,16 +26,12 @@ cache:
env: env:
global: global:
- secure: "hk+32aXXF5t1ApaM2Wjqooz3dx1si907L87WRMkO47WlpJmUUU/Ye+MJk9sViH8MdhOcceocVAmdYl5/WFWOIbDWNlBya9QvXDZyIu2KIre/0QyOCTZbrsif8paBXKIO5O/R4OTvIZ8rvWZsadBdmAT9GSbDhih6FzqXAEgeIYQ="
- secure: "VE+cFkseFwW4jK6XwkP0yW3h4DixPJ8+Eb3yKcchGZ5iIJxlZ/8i1vKHYxadgPRwSYwPSB14tF70xj2OmiT2keGzZUfphmPXinBaLEhYk+Bde+GZZkoSl5ND109I/LcyNr0nG9dDgtV6pkvFchgchpyP9JnVOOS0+crEZlAz0RE="
- CCACHE_TEMPDIR=/tmp/.ccache-temp - CCACHE_TEMPDIR=/tmp/.ccache-temp
- CCACHE_COMPRESS=1 - CCACHE_COMPRESS=1
- CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742 - CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
- CCACHE_VERSION=3.3.1 - CCACHE_VERSION=3.3.1
- CMAKE_VERSION=3.7.2 - CMAKE_VERSION=3.7.2
- MASON="$(pwd)/scripts/mason.sh" - MASON="$(pwd)/scripts/mason.sh"
- ENABLE_NODE_BINDINGS=On
- NODE="4"
matrix: matrix:
fast_finish: true fast_finish: true
@@ -49,58 +41,28 @@ matrix:
# Debug Builds # Debug Builds
- os: linux - os: linux
compiler: "format-taginfo-docs" compiler: "gcc-6-debug"
env: NODE=6
sudo: false
before_install:
install:
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- npm --version
- npm install --ignore-scripts
- npm link --ignore-scripts
script:
- ./scripts/check_taginfo.py taginfo.json profiles/car.lua
- ${MASON} install clang-format 3.8.1
- PATH=$(${MASON} prefix clang-format 3.8.1)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh
# See issue 4043
#- npm run docs && ./scripts/error_on_dirty.sh
after_success:
- os: linux
compiler: "gcc-6-debug-cov"
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] 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'] packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000 env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON
after_success:
- bash <(curl -s https://codecov.io/bash)
- os: linux
compiler: "gcc-6-debug-asan"
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='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000
- os: linux - os: linux
compiler: "clang-4.0-debug" compiler: "clang-4.0-debug"
addons: &clang40 addons: &clang40
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev'] packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CLANG_VERSION='4.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-santize"
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON ENABLE_NODE_BINDINGS=ON
# Release Builds # Release Builds
- os: linux - os: linux
@@ -109,14 +71,14 @@ matrix:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev'] packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.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 ENABLE_NODE_BINDINGS=ON
- os: linux - os: linux
compiler: "gcc-6-release" compiler: "gcc-6-release"
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] 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'] packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: linux - os: linux
@@ -125,20 +87,12 @@ matrix:
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' 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 - os: linux
compiler: "gcc-4.9-release" compiler: "gcc-4.9-release"
addons: &gcc49 addons: &gcc49
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: ['ubuntu-toolchain-r-test']
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'] packages: ['g++-4.9', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release' env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release'
- os: osx - os: osx
@@ -146,8 +100,6 @@ matrix:
compiler: "mason-osx-release" compiler: "mason-osx-release"
# 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 env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON
after_success:
- ./scripts/travis/publish.sh
# Disabled because of CI slowness # Disabled because of CI slowness
#- os: linux #- os: linux
@@ -155,7 +107,7 @@ matrix:
#- addons: &clang40 #- addons: &clang40
#- apt: #- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test'] #- 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'] #- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' #- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
# Shared Library # Shared Library
@@ -164,7 +116,7 @@ matrix:
addons: &gcc6 addons: &gcc6
apt: apt:
sources: ['ubuntu-toolchain-r-test'] 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'] packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' 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 # Disabled because CI slowness
@@ -173,134 +125,32 @@ matrix:
#- addons: &clang40 #- addons: &clang40
#- apt: #- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test'] #- 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'] #- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON #- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests.
- os: linux
sudo: false
compiler: "node-4-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-4-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-6-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-6-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="6"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
before_install: before_install:
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- node --version
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi - if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
- | - |
if [[ -z $JOBS ]]; then if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export JOBS=$((`nproc` + 1))
export JOBS=$((`nproc` + 1)) fi
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - |
export JOBS=$((`sysctl -n hw.ncpu` + 1)) if [ -n "${RUN_CLANG_FORMAT}" ]; then
fi ${MASON} install clang-format 3.8.1 && PATH=$(${MASON} prefix clang-format 3.8.1)/bin:${PATH} ./scripts/format.sh
fi fi
- | - |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
export JOBS=$((`sysctl -n hw.ncpu` + 1))
sudo mdutil -i off / sudo mdutil -i off /
fi
- |
if [[ ! -f $(which yarn) ]]; then
npm install -g yarn npm install -g yarn
fi fi
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off")
- echo "Using ${JOBS} jobs" - echo "Using ${JOBS} jobs"
- yarn install --ignore-scripts - yarn install --ignore-scripts
- yarn check --ignore-scripts --integrity
# Bootstrap cmake to be able to run mason # Bootstrap cmake to be able to run mason
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" - CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz"
- CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}" - CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}"
- mkdir -p ${CMAKE_DIR} - mkdir -p ${CMAKE_DIR}
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1 - travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || exit 1
- export PATH=${CMAKE_DIR}/bin:${PATH} - export PATH=${CMAKE_DIR}/bin:${PATH}
- ${MASON} install tbb 2017_20161128 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_20161128)/lib/:${LD_LIBRARY_PATH} - ${MASON} install tbb 2017_20161128 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_20161128)/lib/:${LD_LIBRARY_PATH}
- ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH} - ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH}
@@ -308,22 +158,24 @@ before_install:
if [[ ! -z ${CLANG_VERSION} ]]; then if [[ ! -z ${CLANG_VERSION} ]]; then
export CCOMPILER='clang' export CCOMPILER='clang'
export CXXCOMPILER='clang++' export CXXCOMPILER='clang++'
${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH} || travis_terminate 1 ${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH}
# we only enable lto for release builds # we only enable lto for release builds
# and therefore don't need to us ld.gold or llvm tools for linking # and therefore don't need to us ld.gold or llvm tools for linking
# for debug builds # for debug builds
if [[ ${BUILD_TYPE} == 'Release' ]]; then if [[ ${BUILD_TYPE} == 'Release' ]]; then
${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH} || travis_terminate 1 ${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH}
fi fi
fi fi
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes - ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
- export OSRM_INSTALL_DIR="$(pwd)/install-osrm"
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- mkdir ${OSRM_BUILD_DIR}
install: install:
- pushd ${OSRM_BUILD_DIR} - |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
./scripts/check_taginfo.py taginfo.json profiles/car.lua
fi
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
- mkdir ${OSRM_BUILD_DIR} && pushd ${OSRM_BUILD_DIR}
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- | - |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \ -DENABLE_MASON=${ENABLE_MASON:-OFF} \
@@ -332,10 +184,8 @@ install:
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \ -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \ -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
-DBUILD_TOOLS=ON \ -DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
- echo "travis_fold:start:MAKE" - echo "travis_fold:start:MAKE"
- make --jobs=${JOBS} - make --jobs=${JOBS}
- make tests --jobs=${JOBS} - make tests --jobs=${JOBS}
@@ -345,14 +195,15 @@ install:
- sudo make install - sudo make install
- | - |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib sudo ldconfig
fi fi
- popd - popd
- mkdir example/build && pushd example/build - mkdir example/build && pushd example/build
- export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- make --jobs=${JOBS} - make --jobs=${JOBS}
- popd - popd
# building docs only works with npm3+ not with yarn or npm2
#- yarn run docs
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
@@ -366,10 +217,17 @@ script:
- ./unit_tests/util-tests - ./unit_tests/util-tests
- ./unit_tests/server-tests - ./unit_tests/server-tests
- ./unit_tests/partition-tests - ./unit_tests/partition-tests
- |
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
npm run nodejs-tests
fi
- |
- popd - popd
- yarn test - yarn test
after_success:
- |
if [ -n "${ENABLE_COVERAGE}" ]; then
bash <(curl -s https://codecov.io/bash)
fi
- |
if [ -n "${ENABLE_NODE_BINDINGS}" ]; then
source ./scripts/travis/build.sh
./scripts/travis/publish.sh
fi
-85
View File
@@ -1,98 +1,13 @@
# 5.9.2
- API:
- `annotations=durations,weights,speeds` values no longer include turn penalty values ([#4330](https://github.com/Project-OSRM/osrm-backend/issues/4330))
# 5.9.1
- Changes from 5.9.0:
- #4322: Deprecated `UseLane`. Use the intersections array if you require lanes between steps
- #4321: Fixes a potential crash in the MLD alternative code path when not even a shortest path can be found
- #4324: STXXL is not required by default
# 5.9.0
- Changes from 5.8:
- Algorithm:
- Multi-Level Dijkstra:
- Plugins supported: `table`
- Adds alternative routes support (see [#4047](https://github.com/Project-OSRM/osrm-backend/pull/4047) and [3905](https://github.com/Project-OSRM/osrm-backend/issues/3905)): provides reasonably looking alternative routes (many, if possible) with reasonable query times.
- API:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag.
- Support for exits numbers and names. New member `exits` in `RouteStep`, based on `junction:ref` on ways
- `Intersection` now has new parameter `classes` that can be set in the profile on each way.
- Profiles:
- `result.exits` allows you to set a way's exit numbers and names, see [`junction:ref`](http://wiki.openstreetmap.org/wiki/Proposed_features/junction_details)
- `ExtractionWay` now as new property `forward_classes` and `backward_classes` that can set in the `way_function`.
The maximum number of classes is 8.
- We now respect the `construction` tag. If the `construction` tag value is not on our whitelist (`minor`, `widening`, `no`) we will exclude the road.
- Node.js Bindings:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag
- Expose `EngineConfig` options in the node bindings
- Tools:
- Exposes engine limit on number of alternatives to generate `--max-alternatives` in `osrm-routed` (3 by default)
- Infrastructure
- STXXL is not required to build OSRM and is an optional dependency for back-compatibility (ENABLE_STXXL=On)
- OpenMP is only required when the optional STXXL dependency is used
- Bug fixes:
- #4278: Remove superflous continious instruction on a motorway.
# 5.8.0
- Changes from 5.7
- API:
- polyline6 support in request string
- new parameter `approaches` for `route`, `table`, `trip` and `nearest` requests. This parameter keep waypoints on the curb side.
'approaches' accepts both 'curb' and 'unrestricted' values.
Note : the curb side depend on the `ProfileProperties::left_hand_driving`, it's a global property set once by the profile. If you are working with a planet dataset, the api will be wrong in some countries, and right in others.
- NodeJs Bindings
- new parameter `approaches` for `route`, `table`, `trip` and `nearest` requests.
- Tools
- `osrm-partition` now ensures it is called before `osrm-contract` and removes inconsitent .hsgr files automatically.
- Features
- Added conditional restriction support with `parse-conditional-restrictions=true|false` to osrm-extract. This option saves conditional turn restrictions to the .restrictions file for parsing by contract later. Added `parse-conditionals-from-now=utc time stamp` and `--time-zone-file=/path/to/file` to osrm-contract
- Command-line tools (osrm-extract, osrm-contract, osrm-routed, etc) now return error codes and legible error messages for common problem scenarios, rather than ugly C++ crashes
- Speed up pre-processing by only running the Lua `node_function` for nodes that have tags. Cuts OSM file parsing time in half.
- osrm-extract now performs generation of edge-expanded-edges using all available CPUs, which should make osrm-extract significantly faster on multi-CPU machines
- Files
- .osrm.nodes file was renamed to .nbg_nodes and .ebg_nodes was added
- Guidance
- #4075 Changed counting of exits on service roundabouts
- Debug Tiles
- added support for visualising turn penalties to the MLD plugin
- added support for showing the rate (reciprocal of weight) on each edge when used
- added support for turn weights in addition to turn durations in debug tiles
- Bugfixes
- Fixed a copy/paste issue assigning wrong directions in similar turns (left over right)
- #4074: fixed a bug that would announce entering highway ramps as u-turns
- #4122: osrm-routed/libosrm should throw exception when a dataset incompatible with the requested algorithm is loaded
- Avoid collapsing u-turns into combined turn instructions
# 5.7.1
- Bugfixes
- #4030 Roundabout edge-case crashes post-processing
# 5.7.0 # 5.7.0
- Changes from 5.6 - Changes from 5.6
- Algorithm:
- OSRM object has new option `algorithm` that allows the selection of a routing algorithm.
- New experimental algorithm: Multi-Level Dijkstra with new toolchain:
- Allows for fast metric updates in below a minute on continental sized networks (osrm-customize)
- Plugins supported: `match` and `route`
- Quickstart: `osrm-extract data.osm.pbf`, `osrm-partition data.osrm`, `osrm-customize data.osrm`, `osrm-routed --algorithm=MLD data.osrm`
- NodeJs Bindings - NodeJs Bindings
- Merged https://github.com/Project-OSRM/node-osrm into repository. Build via `cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On`. - Merged https://github.com/Project-OSRM/node-osrm into repository. Build via `cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On`.
- `OSRM` object has new option `algorihtm="CH","CoreCH","MLD"`
- Internals - Internals
- Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances - Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances
- Files - Files
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries. - .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
- .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now. - .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore - `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
- `osrm-extract` creates new file `.osrm.cnbg` and `.cnbg_to_ebg`
- `osrm-partition` creates new file `.osrm.partition` and `.osrm.cells`
- `osrm-customize` creates new file `.osrm.mldgr`
- Profiles
- Added `force_split_edges` flag to global properties. True value guarantees that segment_function will be called for all segments, but also could double memory consumption
- Map Matching:
- new option `gaps=split|ignore` to enable/disbale track splitting
- new option `tidy=true|false` to simplify traces automatically
# 5.6.3 # 5.6.3
- Changes from 5.6.0 - Changes from 5.6.0
+25 -47
View File
@@ -21,7 +21,6 @@ option(BUILD_PACKAGE "Build OSRM package" OFF)
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF) option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF) option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF) option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
option(ENABLE_STXXL "Use STXXL library" OFF)
option(ENABLE_LTO "Use LTO if available" OFF) 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)
@@ -55,8 +54,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 9) set(OSRM_VERSION_MINOR 7)
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}")
@@ -127,7 +126,6 @@ file(GLOB UpdaterGlob src/updater/*.cpp)
file(GLOB StorageGlob src/storage/*.cpp) file(GLOB StorageGlob src/storage/*.cpp)
file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp) file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp)
file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp) file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp)
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})
@@ -305,8 +303,6 @@ 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")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
endif() endif()
# Configuring compilers # Configuring compilers
@@ -429,12 +425,9 @@ if(ENABLE_MASON)
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION}) mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS}) set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
if (ENABLE_STXXL) mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
mason_use(stxxl VERSION ${MASON_STXXL_VERSION}) add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS}) set(STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
add_definitions(-DUSE_STXXL_LIBRARY)
endif()
mason_use(expat VERSION ${MASON_EXPAT_VERSION}) mason_use(expat VERSION ${MASON_EXPAT_VERSION})
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS}) add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
@@ -452,6 +445,10 @@ if(ENABLE_MASON)
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS}) add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS}) set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
mason_use(libshp2 VERSION ${MASON_LIBSHP_VERSION})
set(LIBSHAPEFILE_INCLUDE_DIR ${MASON_PACKAGE_libshp2_INCLUDE_DIRS})
set(LIBSHAPEFILE_LIBRARY ${MASON_PACKAGE_libshp2_LDFLAGS})
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS) if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work") message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
endif() endif()
@@ -478,8 +475,6 @@ if(ENABLE_MASON)
# expat and bzip2 are used from mason rather than the system # expat and bzip2 are used from mason rather than the system
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include) include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include)
else() else()
find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
@@ -497,16 +492,8 @@ else()
find_package(EXPAT REQUIRED) find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS}) add_dependency_includes(${EXPAT_INCLUDE_DIRS})
if (ENABLE_STXXL) find_package(STXXL REQUIRED)
find_package(STXXL) add_dependency_includes(${STXXL_INCLUDE_DIR})
if (STXXL_FOUND)
add_dependency_includes(${STXXL_INCLUDE_DIR})
set(MAYBE_STXXL_LIBRARY ${STXXL_LIBRARY})
add_definitions(-DUSE_STXXL_LIBRARY)
else()
MESSAGE(STATUS "STXXL was requested but not found, default STL will be used")
endif()
endif()
find_package(BZip2 REQUIRED) find_package(BZip2 REQUIRED)
add_dependency_includes(${BZIP2_INCLUDE_DIR}) add_dependency_includes(${BZIP2_INCLUDE_DIR})
@@ -557,9 +544,6 @@ else()
find_package(Osmium REQUIRED COMPONENTS io) find_package(Osmium REQUIRED COMPONENTS io)
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR}) include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
set(RAPIDJSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
endif() endif()
# prefix compilation with ccache by default if available and on clang or gcc # prefix compilation with ccache by default if available and on clang or gcc
@@ -590,13 +574,11 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE) add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED) add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
if (ENABLE_STXXL) set(OpenMP_FIND_QUIETLY ON)
set(OpenMP_FIND_QUIETLY ON) find_package(OpenMP)
find_package(OpenMP) if(OPENMP_FOUND)
if(OPENMP_FOUND) message(STATUS "OpenMP support found. Linking just in case for stxxl")
message(STATUS "OpenMP support found. Linking just in case for stxxl") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif() endif()
add_definitions(${OSRM_DEFINES}) add_definitions(${OSRM_DEFINES})
@@ -631,7 +613,7 @@ set(EXTRACTOR_LIBRARIES
${EXPAT_LIBRARIES} ${EXPAT_LIBRARIES}
${USED_LUA_LIBRARIES} ${USED_LUA_LIBRARIES}
${OSMIUM_LIBRARIES} ${OSMIUM_LIBRARIES}
${MAYBE_STXXL_LIBRARY} ${STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@@ -653,13 +635,12 @@ set(UPDATER_LIBRARIES
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY} ${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES} ${MAYBE_COVERAGE_LIBRARIES})
${ZLIB_LIBRARY})
set(CONTRACTOR_LIBRARIES set(CONTRACTOR_LIBRARIES
${BOOST_BASE_LIBRARIES} ${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES} ${USED_LUA_LIBRARIES}
${MAYBE_STXXL_LIBRARY} ${STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY} ${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
@@ -679,10 +660,9 @@ set(STORAGE_LIBRARIES
set(UTIL_LIBRARIES set(UTIL_LIBRARIES
${BOOST_BASE_LIBRARIES} ${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${MAYBE_STXXL_LIBRARY} ${STXXL_LIBRARY}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES})
# 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})
@@ -694,7 +674,7 @@ target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
# BUILD_COMPONENTS # BUILD_COMPONENTS
add_executable(osrm-components src/tools/components.cpp $<TARGET_OBJECTS:UTIL>) add_executable(osrm-components src/tools/components.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-components ${TBB_LIBRARIES} ${BOOST_BASE_LIBRARIES} ${UTIL_LIBRARIES}) target_link_libraries(osrm-components ${TBB_LIBRARIES} ${BOOST_BASE_LIBRARIES})
install(TARGETS osrm-components DESTINATION bin) install(TARGETS osrm-components DESTINATION bin)
if(BUILD_TOOLS) if(BUILD_TOOLS)
@@ -704,12 +684,12 @@ if(BUILD_TOOLS)
install(TARGETS osrm-io-benchmark DESTINATION bin) install(TARGETS osrm-io-benchmark DESTINATION bin)
find_package(Shapefile) find_package(Shapefile) # package libshp-dev
if(SHAPEFILE_FOUND AND (Boost_VERSION VERSION_GREATER 106000 OR ENABLE_MASON)) 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>) add_executable(osrm-extract-conditionals src/tools/extract-conditionals.cpp $<TARGET_OBJECTS:UTIL>)
target_include_directories(osrm-extract-conditionals PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR}) 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} 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}) ${LIBSHAPEFILE_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARY} ${EXPAT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS osrm-extract-conditionals DESTINATION bin) install(TARGETS osrm-extract-conditionals DESTINATION bin)
endif() endif()
endif() endif()
@@ -731,8 +711,8 @@ set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp) file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
file(GLOB LibraryGlob include/osrm/*.hpp) file(GLOB LibraryGlob include/osrm/*.hpp)
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp) 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/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) set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/strong_typedef.hpp include/util/exception.hpp)
set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp) set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_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)
@@ -748,14 +728,12 @@ install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
install(FILES ${VariantGlob} DESTINATION include/mapbox) install(FILES ${VariantGlob} DESTINATION include/mapbox)
install(TARGETS osrm-extract DESTINATION bin) install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-partition DESTINATION bin) install(TARGETS osrm-partition DESTINATION bin)
install(TARGETS osrm-customize DESTINATION bin)
install(TARGETS osrm-contract DESTINATION bin) install(TARGETS osrm-contract DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin) install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin) install(TARGETS osrm-routed DESTINATION bin)
install(TARGETS osrm DESTINATION lib) install(TARGETS osrm DESTINATION lib)
install(TARGETS osrm_extract DESTINATION lib) install(TARGETS osrm_extract DESTINATION lib)
install(TARGETS osrm_partition DESTINATION lib) install(TARGETS osrm_partition DESTINATION lib)
install(TARGETS osrm_customize DESTINATION lib)
install(TARGETS osrm_update DESTINATION lib) install(TARGETS osrm_update DESTINATION lib)
install(TARGETS osrm_contract DESTINATION lib) install(TARGETS osrm_contract DESTINATION lib)
install(TARGETS osrm_store DESTINATION lib) install(TARGETS osrm_store DESTINATION lib)
+13 -67
View File
@@ -16,10 +16,8 @@ The following services are available via HTTP API, C++ library interface and Nod
To quickly try OSRM use our [demo server](http://map.project-osrm.org) which comes with both the backend and a frontend on top. To quickly try OSRM use our [demo server](http://map.project-osrm.org) which comes with both the backend and a frontend on top.
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 - [node-osrm](https://github.com/Project-OSRM/node-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
@@ -39,47 +37,22 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
## Quick Start ## Quick Start
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 backend is to use Docker images we provide.
### 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 the Docker images on Alpine Linux and make sure they are as lightweight as possible (around 10-15 MB).
In the following, replace `X.Y.Z` with the current stable release version.
Download OpenStreetMap extracts for example from [Geofabrik](http://download.geofabrik.de/) ```
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf docker run -t -v $(pwd):/data osrm/osrm-backend:vX.Y.Z osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run -t -v $(pwd):/data osrm/osrm-backend:vX.Y.Z osrm-contract /data/berlin-latest.osrm
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend:vX.Y.Z osrm-routed /data/berlin-latest.osrm
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000 curl http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true
```
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
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed /data/berlin-latest.osrm
Make requests against the HTTP server
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
Optionally start a user-friendly frontend on port 9966, and open it up in your browser
docker run -p 9966:9966 osrm/osrm-frontend
xdg-open 'http://127.0.0.1:9966'
In case Docker complains about not being able to connect to the Docker daemon make sure you are in the `docker` group.
sudo usermod -aG docker $USER
After adding yourself to the `docker` group make sure to log out and back in again with your terminal.
We support the following images on Docker Cloud:
Name | Description
-----|------
`latest` | `master` compiled with release flag
`latest-assertions` | `master` compiled with with release flag, assertions enabled and debug symbols
`latest-debug` | `master` compiled with debug flag
`<tag>` | specific tag compiled with release flag
`<tag>-debug` | specific tag compiled with debug flag
### Building from Source ### Building from Source
@@ -121,7 +94,7 @@ osrm-routed berlin-latest.osrm
Running Queries Running Queries
``` ```
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true" 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
@@ -130,36 +103,9 @@ Read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Ap
Simple query with instructions and alternatives on Berlin: Simple query with instructions and alternatives on Berlin:
``` ```
curl "https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true" curl https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
``` ```
### Using the Node.js Bindings
The Node.js bindings provide read-only access to the routing engine.
We provide API documentation and examples [here](docs/nodejs/api.md).
You will need a modern `libstdc++` toolchain (`>= GLIBCXX_3.4.20`) for binary compatibility if you want to use the pre-built binaries.
For older Ubuntu systems you can upgrade your standard library for example with:
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update -y
sudo apt-get install -y libstdc++-5-dev
```
You can install the Node.js bindings via `npm install osrm` or from this repository either via
npm install
which will check and use pre-built binaries if they're available for this release and your Node version, or via
npm install --build-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).
## References in publications ## References in publications
When using the code in a (scientific) publication, please cite When using the code in a (scientific) publication, please cite
+3 -9
View File
@@ -141,21 +141,15 @@ SET test_osm=%test_region%.osm.pbf
IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf -OutFile %test_osm% IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf -OutFile %test_osm%
%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm% %Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
MKDIR ch MKDIR ch
XCOPY %test_region%.osrm.* ch\ XCOPY %test_region%.osrm %test_region%.osrm.* ch\
XCOPY %test_region%.osrm ch\
MKDIR corech MKDIR corech
XCOPY %test_region%.osrm.* corech\ XCOPY %test_region%.osrm %test_region%.osrm.* corech\
XCOPY %test_region%.osrm corech\
MKDIR mld MKDIR mld
XCOPY %test_region%.osrm.* mld\ XCOPY %test_region%.osrm %test_region%.osrm.* mld\
XCOPY %test_region%.osrm mld\
%Configuration%\osrm-contract.exe %test_region_ch%.osrm %Configuration%\osrm-contract.exe %test_region_ch%.osrm
%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm %Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
%Configuration%\osrm-partition.exe %test_region_mld%.osrm %Configuration%\osrm-partition.exe %test_region_mld%.osrm
%Configuration%\osrm-customize.exe %test_region_mld%.osrm %Configuration%\osrm-customize.exe %test_region_mld%.osrm
XCOPY /Y ch\*.* ..\test\data\ch\
XCOPY /Y corech\*.* ..\test\data\corech\
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 IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" GOTO DONE
-75
View File
@@ -1,75 +0,0 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "user for publishing to s3://mapbox-node-binary/osrm",
"Resources": {
"User": {
"Type": "AWS::IAM::User",
"Properties": {
"Policies": [
{
"PolicyName": "list",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mapbox-node-binary",
"Condition": {
"StringLike": {
"s3:prefix": [
"osrm/*"
]
}
}
}
]
}
},
{
"PolicyName": "publish",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mapbox-node-binary/osrm/*"
}
]
}
}
]
}
},
"AccessKey": {
"Type": "AWS::IAM::AccessKey",
"Properties": {
"UserName": {
"Ref": "User"
}
}
}
},
"Outputs": {
"AccessKeyId": {
"Value": {
"Ref": "AccessKey"
}
},
"SecretAccessKey": {
"Value": {
"Fn::GetAtt": [
"AccessKey",
"SecretAccessKey"
]
}
}
}
}
-59
View File
@@ -1,59 +0,0 @@
var cf = require('@mapbox/cloudfriend');
var package_json = require('../package.json')
module.exports = {
AWSTemplateFormatVersion: '2010-09-09',
Description: 'user for publishing to s3://mapbox-node-binary/' + package_json.name,
Resources: {
User: {
Type: 'AWS::IAM::User',
Properties: {
Policies: [
{
PolicyName: 'list',
PolicyDocument: {
Statement: [
{
Action: ['s3:ListBucket'],
Effect: 'Allow',
Resource: 'arn:aws:s3:::mapbox-node-binary',
Condition : {
StringLike : {
"s3:prefix": [ package_json.name + "/*"]
}
}
}
]
}
},
{
PolicyName: 'publish',
PolicyDocument: {
Statement: [
{
Action: ['s3:DeleteObject', 's3:GetObject', 's3:GetObjectAcl', 's3:PutObject', 's3:PutObjectAcl'],
Effect: 'Allow',
Resource: 'arn:aws:s3:::mapbox-node-binary/' + package_json.name + '/*'
}
]
}
}
]
}
},
AccessKey: {
Type: 'AWS::IAM::AccessKey',
Properties: {
UserName: cf.ref('User')
}
}
},
Outputs: {
AccessKeyId: {
Value: cf.ref('AccessKey')
},
SecretAccessKey: {
Value: cf.getAtt('AccessKey', 'SecretAccessKey')
}
}
};
+587
View File
@@ -0,0 +1,587 @@
# Copyright (c) 2015, Colin Taylor
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# FindNodeJS.cmake CMake module vendored from the node-cmake project (v1.2).
# This script uses CMake 3.1+ features
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1.0)
message(FATAL_ERROR "FindNodeJS.cmake uses CMake 3.1+ features")
endif()
# Force a build type to be set (ignored on config based generators)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
endif()
# Capture module information
set(NodeJS_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
get_filename_component(NodeJS_MODULE_NAME ${NodeJS_MODULE_PATH} NAME)
# Allow users to specify the installed location of the Node.js package
set(NodeJS_ROOT_DIR "" CACHE PATH
"The root directory of the node.js installed package")
# Allow users to specify that downloaded sources should be used
option(NodeJS_DOWNLOAD "Download the required source files" Off)
# Allow users to force downloading of node packages
option(NodeJS_FORCE_DOWNLOAD "Download the source files every time" Off)
# Allow users to force archive extraction
option(NodeJS_FORCE_EXTRACT "Extract the archive every time" Off)
# Make libc++ the default when compiling with clang
option(NodeJS_USE_CLANG_STDLIB "Use libc++ when compiling with clang" On)
if(APPLE)
set(NodeJS_USE_CLANG_STDLIB On CACHE BOOL "" FORCE)
endif()
if(WIN32)
# Allow users to specify that the executable should be downloaded
option(NodeJS_DOWNLOAD_EXECUTABLE
"Download matching executable if available" Off
)
endif()
# Try to find the node.js executable
# The node executable under linux may not be the correct program
find_program(NodeJS_EXECUTABLE
NAMES node
PATHS ${NodeJS_ROOT_DIR}
PATH_SUFFIXES nodejs node
)
set(NodeJS_VALIDATE_EXECUTABLE 1)
if(NodeJS_EXECUTABLE)
execute_process(
COMMAND ${NodeJS_EXECUTABLE} --version
RESULT_VARIABLE NodeJS_VALIDATE_EXECUTABLE
OUTPUT_VARIABLE NodeJS_INSTALLED_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${NodeJS_EXECUTABLE} -p "process.platform"
OUTPUT_VARIABLE NodeJS_INSTALLED_PLATFORM
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${NodeJS_EXECUTABLE} -p "process.arch"
OUTPUT_VARIABLE NodeJS_INSTALLED_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
# If node isn't the node.js binary, try the nodejs binary
if(NOT NodeJS_VALIDATE_EXECUTABLE EQUAL 0)
find_program(NodeJS_EXECUTABLE
NAMES nodejs
PATHS ${NodeJS_ROOT_DIR}
PATH_SUFFIXES nodejs node
)
set(NodeJS_VALIDATE_EXECUTABLE 1)
if(NodeJS_EXECUTABLE)
execute_process(
COMMAND ${NodeJS_EXECUTABLE} --version
RESULT_VARIABLE NodeJS_VALIDATE_EXECUTABLE
OUTPUT_VARIABLE NodeJS_INSTALLED_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if(NOT NodeJS_VALIDATE_EXECUTABLE EQUAL 0)
message(WARNING "Node.js executable could not be found. \
Set NodeJS_ROOT_DIR to the installed location of the executable or \
install Node.js to its default location.")
endif()
endif()
# Determine if a variant is set in the components
list(APPEND NodeJS_OTHER_COMPONENTS
X64 IA32 ARM WIN32 LINUX DARWIN
)
set(NodeJS_COMPONENTS_CONTAINS_VARIANT False)
foreach(NodeJS_COMPONENT ${NodeJS_FIND_COMPONENTS})
list(FIND NodeJS_OTHER_COMPONENTS ${NodeJS_COMPONENT} NodeJS_OTHER_INDEX)
if(NodeJS_OTHER_INDEX EQUAL -1)
set(NodeJS_COMPONENTS_CONTAINS_VARIANT True)
break()
endif()
endforeach()
# Get the targeted version of Node.js (or one of its derivatives)
if(NOT NodeJS_VERSION)
if(NodeJS_FIND_VERSION)
set(NodeJS_VERSION ${NodeJS_FIND_VERSION})
elseif(NodeJS_INSTALLED_VERSION AND NOT NodeJS_COMPONENTS_CONTAINS_VARIANT)
string(SUBSTRING ${NodeJS_INSTALLED_VERSION} 1 -1 NodeJS_VERSION)
else()
message(FATAL_ERROR "Node.js version is not set. Set the VERSION \
property of the find_package command to the required version of the \
Node.js sources")
endif()
endif()
# Determine the target platform for the compiled module
# Uses several mechanisms in order:
#
# 1. CMake cache (allows overriding on the command line)
# 2. Node architecture when binary is available
# 3. CMake architecture
#
set(NodeJS_PLATFORM "" CACHE STRING "Target node.js platform for module")
if(NOT NodeJS_PLATFORM)
if(NodeJS_EXECUTABLE)
set(NodeJS_PLATFORM ${NodeJS_INSTALLED_PLATFORM})
elseif(WIN32)
set(NodeJS_PLATFORM "win32")
elseif(UNIX)
if(APPLE)
set(NodeJS_PLATFORM "darwin")
else()
set(NodeJS_PLATFORM "linux")
endif()
else()
message(FATAL_ERROR "Node.js platform is not set. Add the platform \
to the find_package components section or set NodeJS_PLATFORM in the \
cache.")
endif()
endif()
# Convenience variables for the platform type
if(NodeJS_PLATFORM STREQUAL "win32")
set(NodeJS_PLATFORM_WIN32 True)
set(NodeJS_PLATFORM_LINUX False)
set(NodeJS_PLATFORM_DARWIN False)
elseif(NodeJS_PLATFORM STREQUAL "linux")
set(NodeJS_PLATFORM_WIN32 False)
set(NodeJS_PLATFORM_LINUX True)
set(NodeJS_PLATFORM_DARWIN False)
elseif(NodeJS_PLATFORM STREQUAL "darwin")
set(NodeJS_PLATFORM_WIN32 False)
set(NodeJS_PLATFORM_LINUX False)
set(NodeJS_PLATFORM_DARWIN True)
endif()
# Determine the target architecture for the compiled module
# Uses several mechanisms in order:
#
# 1. CMake cache (allows overriding on the command line)
# 2. Node architecture when binary is available
# 3. Compiler architecture under MSVC
#
set(NodeJS_ARCH "" CACHE STRING "Target node.js architecture for module")
if(NOT NodeJS_ARCH)
if(NodeJS_EXECUTABLE)
set(NodeJS_ARCH ${NodeJS_INSTALLED_ARCH})
elseif(MSVC)
if(CMAKE_CL_64)
set(NodeJS_ARCH "x64")
else()
set(NodeJS_ARCH "ia32")
endif()
else()
message(FATAL_ERROR "Node.js architecture is not set. Add the \
architecture to the find_package components section or set NodeJS_ARCH \
in the cache.")
endif()
endif()
# Convenience variables for the architecture
if(NodeJS_ARCH STREQUAL "x64")
set(NodeJS_ARCH_X64 True)
set(NodeJS_ARCH_IA32 False)
set(NodeJS_ARCH_ARM False)
elseif(NodeJS_ARCH STREQUAL "ia32")
set(NodeJS_ARCH_X64 False)
set(NodeJS_ARCH_IA32 True)
set(NodeJS_ARCH_ARM False)
elseif(NodeJS_ARCH STREQUAL "arm")
set(NodeJS_ARCH_X64 False)
set(NodeJS_ARCH_IA32 False)
set(NodeJS_ARCH_ARM True)
endif()
# Include helper functions
include(util/NodeJSUtil)
# Default variant name
# Used by the installed header comparison below
set(NodeJS_DEFAULT_VARIANT_NAME "node.js")
# Variables for Node.js artifacts across variants
# Specify all of these variables for each new variant
set(NodeJS_VARIANT_NAME "") # The printable name of the variant
set(NodeJS_VARIANT_BASE "") # A file name safe version of the variant
set(NodeJS_URL "") # The URL for the artifacts
set(NodeJS_SOURCE_PATH "") # The URL path of the source archive
set(NodeJS_CHECKSUM_PATH "") # The URL path of the checksum file
set(NodeJS_CHECKSUM_TYPE "") # The checksum type (algorithm)
set(NodeJS_WIN32_LIBRARY_PATH "") # The URL path of the windows library
set(NodeJS_WIN32_BINARY_PATH "") # The URL path of the windows executable
set(NodeJS_WIN32_LIBRARY_NAME "") # The name of the windows library
set(NodeJS_WIN32_BINARY_NAME "") # The name of the windows executable
set(NodeJS_DEFAULT_INCLUDE True) # Enable default include behavior
set(NodeJS_DEFAULT_LIBS True) # Include the default libraries
set(NodeJS_HAS_WIN32_PREFIX True) # Does the variant use library prefixes
set(NodeJS_HAS_WIN32_BINARY True) # Does the variant have win32 executables
set(NodeJS_HAS_OPENSSL True) # Does the variant include openssl headers
set(NodeJS_HEADER_VERSION 0.12.7) # Version after header-only archives start
set(NodeJS_SHA256_VERSION 0.7.0) # Version after sha256 checksums start
set(NodeJS_PREFIX_VERSION 0.12.7) # Version after windows prefixing starts
set(NodeJS_CXX11R_VERSION 0.12.7) # Version after c++11 is required
set(NodeJS_SOURCE_INCLUDE True) # Use the include paths from a source archive
set(NodeJS_HEADER_INCLUDE False) # Use the include paths from a header archive
set(NodeJS_INCLUDE_PATHS "") # Set of header dirs inside the source archive
set(NodeJS_LIBRARIES "") # The set of libraries to link with addon
set(NodeJS_WIN32_DELAYLOAD "") # Set of executables to delayload on windows
# NodeJS variants
# Selects download target based on configured component
# Include NodeJS last to provide default configurations when omitted
file(
GLOB NodeJS_SUPPORTED_VARIANTS
RELATIVE ${CMAKE_CURRENT_LIST_DIR}/variants
${CMAKE_CURRENT_LIST_DIR}/variants/*
)
foreach(NodeJS_SUPPORTED_VARIANT ${NodeJS_SUPPORTED_VARIANTS})
get_filename_component(NodeJS_SUPPORTED_VARIANT_NAME
${NodeJS_SUPPORTED_VARIANT} NAME_WE
)
if(NOT NodeJS_SUPPORTED_VARIANT_NAME STREQUAL "NodeJS")
include(variants/${NodeJS_SUPPORTED_VARIANT_NAME})
endif()
endforeach()
include(variants/NodeJS)
# Populate version variables, including version components
set(NodeJS_VERSION_STRING "v${NodeJS_VERSION}")
# Populate the remaining version variables
string(REPLACE "." ";" NodeJS_VERSION_PARTS ${NodeJS_VERSION})
list(GET NodeJS_VERSION_PARTS 0 NodeJS_VERSION_MAJOR)
list(GET NodeJS_VERSION_PARTS 1 NodeJS_VERSION_MINOR)
list(GET NodeJS_VERSION_PARTS 2 NodeJS_VERSION_PATCH)
# If the version we're looking for is the version that is installed,
# try finding the required headers. Don't do this under windows (where
# headers are not part of the installed content), when the user has
# specified that headers should be downloaded or when using a variant other
# than the default
if((NOT NodeJS_PLATFORM_WIN32) AND (NOT NodeJS_DOWNLOAD) AND
NodeJS_VARIANT_NAME STREQUAL NodeJS_DEFAULT_VARIANT_NAME AND
NodeJS_INSTALLED_VERSION STREQUAL NodeJS_VERSION_STRING AND
NodeJS_INSTALLED_PLATFORM STREQUAL NodeJS_PLATFORM AND
NodeJS_INSTALLED_ARCH STREQUAL NodeJS_ARCH)
# node.h is really generic and too easy for cmake to find the wrong
# file, so use the directory as a guard, and then just tack it on to
# the actual path
#
# Specifically ran into this under OSX, where python contains a node.h
# that gets found instead
find_path(NodeJS_INCLUDE_PARENT node/node.h)
set(NodeJS_INCLUDE_DIRS ${NodeJS_INCLUDE_PARENT}/node)
# Under all systems that support this, there are no libraries required
# for linking (symbols are resolved via the main executable at runtime)
set(NodeJS_LIBRARIES "")
# Otherwise, headers and required libraries must be downloaded to the project
# to supplement what is installed
else()
# Create a folder for downloaded artifacts
set(NodeJS_DOWNLOAD_PATH
${CMAKE_CURRENT_BINARY_DIR}/${NodeJS_VARIANT_BASE}
)
set(NodeJS_DOWNLOAD_PATH ${NodeJS_DOWNLOAD_PATH}-${NodeJS_VERSION_STRING})
file(MAKE_DIRECTORY ${NodeJS_DOWNLOAD_PATH})
# Download the checksum file for validating all other downloads
# Conveniently, if this doesn't download correctly, the setup fails
# due to checksum failures
set(NodeJS_CHECKSUM_FILE ${NodeJS_DOWNLOAD_PATH}/CHECKSUM)
nodejs_download(
${NodeJS_URL}/${NodeJS_CHECKSUM_PATH}
${NodeJS_CHECKSUM_FILE}
${NodeJS_FORCE_DOWNLOAD}
)
file(READ ${NodeJS_CHECKSUM_FILE} NodeJS_CHECKSUM_DATA)
# Download and extract the main source archive
set(NodeJS_SOURCE_FILE ${NodeJS_DOWNLOAD_PATH}/headers.tar.gz)
nodejs_checksum(
${NodeJS_CHECKSUM_DATA} ${NodeJS_SOURCE_PATH} NodeJS_SOURCE_CHECKSUM
)
nodejs_download(
${NodeJS_URL}/${NodeJS_SOURCE_PATH}
${NodeJS_SOURCE_FILE}
${NodeJS_SOURCE_CHECKSUM}
${NodeJS_CHECKSUM_TYPE}
${NodeJS_FORCE_DOWNLOAD}
)
set(NodeJS_HEADER_PATH ${NodeJS_DOWNLOAD_PATH}/src)
nodejs_extract(
${NodeJS_SOURCE_FILE}
${NodeJS_HEADER_PATH}
${NodeJS_FORCE_EXTRACT}
)
# Populate include directories from the extracted source archive
foreach(NodeJS_HEADER_BASE ${NodeJS_INCLUDE_PATHS})
set(NodeJS_INCLUDE_DIR ${NodeJS_HEADER_PATH}/${NodeJS_HEADER_BASE})
if(NOT EXISTS ${NodeJS_INCLUDE_DIR})
message(FATAL_ERROR "Include does not exist: ${NodeJS_INCLUDE_DIR}")
endif()
list(APPEND NodeJS_INCLUDE_DIRS ${NodeJS_INCLUDE_DIR})
endforeach()
# Download required library files when targeting windows
if(NodeJS_PLATFORM_WIN32)
# Download the windows library
set(NodeJS_WIN32_LIBRARY_FILE
${NodeJS_DOWNLOAD_PATH}/lib/${NodeJS_ARCH}
)
set(NodeJS_WIN32_LIBRARY_FILE
${NodeJS_WIN32_LIBRARY_FILE}/${NodeJS_WIN32_LIBRARY_NAME}
)
nodejs_checksum(
${NodeJS_CHECKSUM_DATA} ${NodeJS_WIN32_LIBRARY_PATH}
NodeJS_WIN32_LIBRARY_CHECKSUM
)
nodejs_download(
${NodeJS_URL}/${NodeJS_WIN32_LIBRARY_PATH}
${NodeJS_WIN32_LIBRARY_FILE}
${NodeJS_WIN32_LIBRARY_CHECKSUM}
${NodeJS_CHECKSUM_TYPE}
${NodeJS_FORCE_DOWNLOAD}
)
list(APPEND NodeJS_LIBRARIES ${NodeJS_WIN32_LIBRARY_FILE})
# If provided, download the windows executable
if(NodeJS_WIN32_BINARY_PATH AND
NodeJS_DOWNLOAD_EXECUTABLE)
set(NodeJS_WIN32_BINARY_FILE
${NodeJS_DOWNLOAD_PATH}/lib/${NodeJS_ARCH}
)
set(NodeJS_WIN32_BINARY_FILE
${NodeJS_WIN32_BINARY_FILE}/${NodeJS_WIN32_BINARY_NAME}
)
nodejs_checksum(
${NodeJS_CHECKSUM_DATA} ${NodeJS_WIN32_BINARY_PATH}
NodeJS_WIN32_BINARY_CHECKSUM
)
nodejs_download(
${NodeJS_URL}/${NodeJS_WIN32_BINARY_PATH}
${NodeJS_WIN32_BINARY_FILE}
${NodeJS_WIN32_BINARY_CHECKSUM}
${NodeJS_CHECKSUM_TYPE}
${NodeJS_FORCE_DOWNLOAD}
)
endif()
endif()
endif()
# Support windows delay loading
if(NodeJS_PLATFORM_WIN32)
list(APPEND NodeJS_LINK_FLAGS /IGNORE:4199)
set(NodeJS_WIN32_DELAYLOAD_CONDITION "")
foreach(NodeJS_WIN32_DELAYLOAD_BINARY ${NodeJS_WIN32_DELAYLOAD})
list(APPEND NodeJS_LINK_FLAGS
/DELAYLOAD:${NodeJS_WIN32_DELAYLOAD_BINARY}
)
list(APPEND NodeJS_WIN32_DELAYLOAD_CONDITION
"_stricmp(info->szDll, \"${NodeJS_WIN32_DELAYLOAD_BINARY}\") != 0"
)
endforeach()
string(REPLACE ";" " &&\n "
NodeJS_WIN32_DELAYLOAD_CONDITION
"${NodeJS_WIN32_DELAYLOAD_CONDITION}"
)
configure_file(
${NodeJS_MODULE_PATH}/src/win_delay_load_hook.c
${CMAKE_CURRENT_BINARY_DIR}/win_delay_load_hook.c @ONLY
)
list(APPEND NodeJS_ADDITIONAL_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/win_delay_load_hook.c
)
endif()
# Allow undefined symbols on OSX
if(NodeJS_PLATFORM_DARWIN)
list(APPEND NodeJS_LINK_FLAGS "-undefined dynamic_lookup")
endif()
# Use libc++ when clang is the compiler by default
if(NodeJS_USE_CLANG_STDLIB AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
list(APPEND NodeJS_COMPILE_OPTIONS -stdlib=libc++)
endif()
# Require c++11 support after a specific point, but only if the user hasn't
# specified an override
if(NOT NodeJS_CXX_STANDARD)
if(NodeJS_VERSION VERSION_GREATER NodeJS_CXX11R_VERSION)
set(NodeJS_CXX_STANDARD 11)
else()
set(NodeJS_CXX_STANDARD 98)
endif()
endif()
# Set required definitions
list(APPEND NodeJS_DEFINITIONS BUILDING_NODE_EXTENSION)
if(NodeJS_PLATFORM_DARWIN)
list(APPEND NodeJS_DEFINITIONS _DARWIN_USE_64_BIT_INODE=1)
endif()
if(NOT NodeJS_PLATFORM_WIN32)
list(APPEND NodeJS_DEFINITIONS
_LARGEFILE_SOURCE
_FILE_OFFSET_BITS=64
)
endif()
function(add_nodejs_module NAME)
# Build a shared library for the module
add_library(${NAME} SHARED ${ARGN} ${NodeJS_ADDITIONAL_SOURCES})
# Include required headers
# Find and include Nan as well (always available as its a
# dependency of this module)
nodejs_find_module_fallback(nan ${CMAKE_CURRENT_SOURCE_DIR} NAN_PATH)
target_include_directories(${NAME}
PUBLIC ${NodeJS_INCLUDE_DIRS}
PUBLIC ${NAN_PATH}
)
# Set module properties
# This ensures proper naming of the module library across all platforms
get_target_property(COMPILE_OPTIONS ${NAME} COMPILE_OPTIONS)
if(NOT COMPILE_OPTIONS)
set(COMPILE_OPTIONS "")
endif()
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} ${NodeJS_COMPILE_OPTIONS})
get_target_property(LINK_FLAGS ${NAME} LINK_FLAGS)
if(NOT LINK_FLAGS)
set(LINK_FLAGS "")
endif()
foreach(NodeJS_LINK_FLAG ${NodeJS_LINK_FLAGS})
set(LINK_FLAGS "${LINK_FLAGS} ${NodeJS_LINK_FLAG}")
endforeach()
set_target_properties(${NAME} PROPERTIES
PREFIX ""
SUFFIX ".node"
MACOSX_RPATH ON
POSITION_INDEPENDENT_CODE TRUE
COMPILE_OPTIONS "${COMPILE_OPTIONS}"
LINK_FLAGS "${LINK_FLAGS}"
CXX_STANDARD_REQUIRED TRUE
CXX_STANDARD ${NodeJS_CXX_STANDARD}
)
# Output the module in a per build type directory
# This makes builds consistent with visual studio and other generators
# that build by configuration
if(NOT CMAKE_CONFIGURATION_TYPES)
set_property(TARGET ${NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY
${CMAKE_BUILD_TYPE}
)
endif()
# Set any required complier flags
# Mostly used under windows
target_compile_definitions(${NAME} PRIVATE ${NodeJS_DEFINITIONS})
# Link against required NodeJS libraries
target_link_libraries(${NAME} ${NodeJS_LIBRARIES})
endfunction()
# Write out the configuration for node scripts
configure_file(
${NodeJS_MODULE_PATH}/build.json.in
${CMAKE_CURRENT_BINARY_DIR}/build.json @ONLY
)
# Make sure we haven't violated the version-to-standard mapping
if(NodeJS_VERSION VERSION_GREATER NodeJS_CXX11R_VERSION AND
NodeJS_CXX_STANDARD EQUAL 98)
message(FATAL_ERROR "${NodeJS_VARIANT_NAME} ${NodeJS_VERSION} \
requires C++11 or newer to build")
endif()
# This is a find_package file, handle the standard invocation
include(FindPackageHandleStandardArgs)
set(NodeJS_TARGET "${NodeJS_VARIANT_NAME} ${NodeJS_PLATFORM}/${NodeJS_ARCH}")
find_package_handle_standard_args(NodeJS
FOUND_VAR NodeJS_FOUND
REQUIRED_VARS NodeJS_TARGET NodeJS_INCLUDE_DIRS
VERSION_VAR NodeJS_VERSION
)
# Mark variables that users shouldn't modify
mark_as_advanced(
NodeJS_VALIDATE_EXECUTABLE
NodeJS_OTHER_COMPONENTS
NodeJS_COMPONENTS_CONTAINS_VARIANT
NodeJS_COMPONENT
NodeJS_OTHER_INDEX
NodeJS_VERSION_STRING
NodeJS_VERSION_MAJOR
NodeJS_VERSION_MINOR
NodeJS_VERSION_PATCH
NodeJS_VERSION_TWEAK
NodeJS_PLATFORM
NodeJS_PLATFORM_WIN32
NodeJS_PLATFORM_LINUX
NodeJS_PLATFORM_DARWIN
NodeJS_ARCH
NodeJS_ARCH_X64
NodeJS_ARCH_IA32
NodeJS_ARCH_ARM
NodeJS_DEFAULT_VARIANT_NAME
NodeJS_VARIANT_BASE
NodeJS_VARIANT_NAME
NodeJS_URL
NodeJS_SOURCE_PATH
NodeJS_CHECKSUM_PATH
NodeJS_CHECKSUM_TYPE
NodeJS_WIN32_LIBRARY_PATH
NodeJS_WIN32_BINARY_PATH
NodeJS_WIN32_LIBRARY_NAME
NodeJS_WIN32_BINARY_NAME
NodeJS_DEFAULT_INCLUDE
NodeJS_DEFAULT_LIBS
NodeJS_HAS_WIN32_BINARY
NodeJS_HEADER_VERSION
NodeJS_SHA256_VERISON
NodeJS_PREFIX_VERSION
NodeJS_SOURCE_INCLUDE
NodeJS_HEADER_INCLUDE
NodeJS_INCLUDE_PATHS
NodeJS_WIN32_DELAYLOAD
NodeJS_DOWNLOAD_PATH
NodeJS_CHECKSUM_FILE
NodeJS_CHECKSUM_DATA
NodeJS_SOURCE_FILE
NodeJS_SOURCE_CHECKSUM
NodeJS_HEADER_PATH
NodeJS_HEADER_BASE
NodeJS_INCLUDE_DIR
NodeJS_WIN32_LIBRARY_FILE
NodeJS_WIN32_LIBRARY_CHECKSUM
NodeJS_WIN32_BINARY_FILE
NodeJS_WIN32_BINARY_CHECKSUM
NodeJS_NAN_PATH
NodeJS_LINK_FLAGS
NodeJS_COMPILE_OPTIONS
NodeJS_ADDITIONAL_SOURCES
NodeJS_WIN32_DELAYLOAD_CONDITION
NodeJS_WIN32_DELAYLOAD_BINARY
NodeJS_TARGET
)
+10
View File
@@ -0,0 +1,10 @@
{
"build_type": "@CMAKE_BUILD_TYPE@",
"generator": "@CMAKE_GENERATOR@",
"toolset": "@CMAKE_GENERATOR_TOOLSET@",
"platform": "@CMAKE_GENERATOR_PLATFORM@",
"variant": "@NodeJS_VARIANT_BASE@",
"version": "@NodeJS_VERSION@",
"download": "@NodeJS_DOWNLOAD@",
"standard": "@NodeJS_CXX_STANDARD@"
}
+28
View File
@@ -0,0 +1,28 @@
set(GITHUB_API_TOKEN $ENV{GITHUB_API_TOKEN})
set(GITHUB_AUTH "")
if(GITHUB_API_TOKEN)
set(GITHUB_AUTH "?access_token=${GITHUB_API_TOKEN}")
endif()
set(GITHUB_API_URL "https://api.github.com")
function(github_get_rate_limit VAR)
set(RATE_LIMIT_FILE ${CMAKE_CURRENT_BINARY_DIR}/GITHUBRATE)
set(RATE_LIMIT_URL ${GITHUB_API_URL}/rate_limit${GITHUB_AUTH})
nodejs_download(
${RATE_LIMIT_URL}
${RATE_LIMIT_FILE}
ON
)
file(READ ${RATE_LIMIT_FILE} RATE_LIMIT_DATA)
string(REGEX MATCH "\"remaining\": ([0-9]+),"
RATE_LIMIT_MATCH ${RATE_LIMIT_DATA})
set(${VAR} ${CMAKE_MATCH_1} PARENT_SCOPE)
endfunction()
mark_as_advanced(
GITHUB_AUTH
GITHUB_API_TOKEN
GITHUB_API_URL
)
+166
View File
@@ -0,0 +1,166 @@
function(nodejs_check_file FILE)
set(MESSAGE "File ${FILE} does not exist or is empty")
if(ARGC GREATER 1)
set(MESSAGE ${ARGV1})
endif()
# Make sure the file has contents
file(READ ${FILE} FILE_CONTENT LIMIT 1 HEX)
if(NOT FILE_CONTENT)
file(REMOVE ${FILE})
message(FATAL_ERROR ${MESSAGE})
endif()
endfunction()
function(nodejs_download URL FILE)
# Function optionally takes a checksum and a checksum type, and
# a force value
# Either can be specified without the other, but checksum must come first
if(ARGC GREATER 2)
set(CHECKSUM ${ARGV2})
if(CHECKSUM STREQUAL "On" OR CHECKSUM STREQUAL "ON" OR
CHECKSUM STREQUAL "True" OR CHECKSUM STREQUAL "TRUE" OR
CHECKSUM STREQUAL "Off" OR CHECKSUM STREQUAL "OFF" OR
CHECKSUM STREQUAL "False" OR CHECKSUM STREQUAL "FALSE")
set(FORCE ${CHECKSUM})
unset(CHECKSUM)
elseif(ARGC GREATER 3)
set(TYPE ${ARGV3})
else()
message(FATAL_ERROR "Checksum type must be specified")
endif()
elseif(ARGC GREATER 4)
set(CHECKSUM ${ARGV2})
set(TYPE ${ARGV3})
set(FORCE ${ARGV4})
endif()
# If the file exists, no need to download it again unless its being forced
if(NOT FORCE AND EXISTS ${FILE})
return()
endif()
# Download the file
message(STATUS "Downloading: ${URL}")
file(DOWNLOAD
${URL}
${FILE}
SHOW_PROGRESS
)
# Make sure the file has contents
nodejs_check_file(${FILE} "Unable to download ${URL}")
# If a checksum is provided, validate the downloaded file
if(CHECKSUM)
message(STATUS "Validating: ${FILE}")
file(${TYPE} ${FILE} DOWNLOAD_CHECKSUM)
message(STATUS "Checksum: ${CHECKSUM}")
message(STATUS "Download: ${DOWNLOAD_CHECKSUM}")
if(NOT CHECKSUM STREQUAL DOWNLOAD_CHECKSUM)
file(REMOVE ${FILE})
message(FATAL_ERROR "Validation failure: ${FILE}")
endif()
endif()
endfunction()
function(nodejs_checksum DATA FILE VAR)
string(REGEX MATCH "([A-Fa-f0-9]+)[\t ]+${FILE}" CHECKSUM_MATCH ${DATA})
if(CMAKE_MATCH_1)
set(${VAR} ${CMAKE_MATCH_1} PARENT_SCOPE)
else()
message(FATAL_ERROR "Unable to extract file checksum")
endif()
endfunction()
function(nodejs_extract FILE DIR)
# Function optionally takes a force value
if(ARGC GREATER 2)
set(FORCE ${ARGV2})
endif()
# If the archvie has been extracted, no need to extract again unless it
# is being forced
if(NOT FORCE AND EXISTS ${DIR})
return()
endif()
# Make a temporary directory for extracting the output
set(EXTRACT_DIR ${CMAKE_CURRENT_BINARY_DIR}/extract)
if(EXISTS ${EXTRACT_DIR})
file(REMOVE_RECURSE ${EXTRACT_DIR})
endif()
file(MAKE_DIRECTORY ${EXTRACT_DIR})
# Extract the archive
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xfz ${FILE}
WORKING_DIRECTORY ${EXTRACT_DIR}
)
# If only one element is extracted, the archive contained a nested
# folder; use the inner folder as the extracted folder
file(GLOB EXTRACT_CHILDREN ${EXTRACT_DIR}/*)
list(LENGTH EXTRACT_CHILDREN NUM_CHILDREN)
set(TARGET_DIR ${EXTRACT_DIR})
if(NUM_CHILDREN EQUAL 1)
list(GET EXTRACT_CHILDREN 0 TARGET_DIR)
endif()
# Move the folder to the target path
if(EXISTS ${DIR})
file(REMOVE_RECURSE ${DIR})
endif()
file(RENAME ${TARGET_DIR} ${DIR})
# Make sure to clean up the extraction folder when the inner folder
# is used
file(REMOVE_RECURSE ${EXTRACT_DIR})
endfunction()
function(nodejs_find_module NAME BASE PATH)
# Find a node module using the same search path that require uses
# without needing a node binary
set(ROOT ${BASE})
set(DRIVE "^[A-Za-z]?:?/$")
# Walk up the directory tree until at the root
while(NOT ROOT MATCHES ${DRIVE} AND NOT
EXISTS ${ROOT}/node_modules/${NAME})
get_filename_component(ROOT ${ROOT} DIRECTORY)
endwhile()
# Operate like the CMake find_* functions, returning NOTFOUND if the
# module can't be found
if(ROOT MATCHES ${DRIVE})
set(${PATH} ${NAME}-NOTFOUND PARENT_SCOPE)
else()
set(${PATH} ${ROOT}/node_modules/${NAME} PARENT_SCOPE)
endif()
endfunction()
macro(nodejs_find_module_fallback NAME BASE PATH)
# Look in the provided path first
# If the module isn't found, try searching from the module
nodejs_find_module(${NAME} ${BASE} ${PATH})
if(NOT ${PATH})
nodejs_find_module(${NAME} ${NodeJS_MODULE_PATH} ${PATH})
endif()
endmacro()
function(nodejs_get_version URL VAR)
set(NWJS_LATEST_RELEASE_URL
"${NWJS_URL_BASE}/latest/${NodeJS_CHECKSUM_PATH}")
set(VERSION_FILE ${CMAKE_CURRENT_BINARY_DIR}/VERSION)
nodejs_download(
${URL}
${VERSION_FILE}
ON
)
nodejs_check_file(${VERSION_FILE})
file(READ ${VERSION_FILE} VERSION_DATA)
string(REGEX MATCH "v([0-9]+\.[0-9]+\.[0-9]+)"
VERSION_MATCH ${VERSION_DATA}
)
set(${VAR} ${CMAKE_MATCH_1} PARENT_SCOPE)
endfunction()
+81
View File
@@ -0,0 +1,81 @@
set(ELECTRON_VARIANT_BASE "electron")
set(ELECTRON_WIN32_BINARY_NAME "${ELECTRON_VARIANT_BASE}.exe")
list(APPEND NodeJS_WIN32_DELAYLOAD ${ELECTRON_WIN32_BINARY_NAME})
if(NodeJS_FIND_REQUIRED_ELECTRON OR
NodeJS_VARIANT STREQUAL ${ELECTRON_VARIANT_BASE})
if(NodeJS_VERSION STREQUAL "latest")
include(util/Github)
github_get_rate_limit(GITHUB_RATE_LIMIT)
# Handle determining the latest release
# Very complicated, due to electron not following the "latest"
# convention of other variants
set(ELECTRON_LATEST_RELEASE_FILE ${CMAKE_CURRENT_BINARY_DIR}/ELECTRON)
set(ELECTRON_LATEST_RELEASE_URL
${GITHUB_API_URL}/repos/atom/electron/releases/latest${GITHUB_AUTH}
)
if(GITHUB_RATE_LIMIT GREATER 0)
nodejs_download(
${ELECTRON_LATEST_RELEASE_URL}
${ELECTRON_LATEST_RELEASE_FILE}
ON
)
endif()
nodejs_check_file(
${ELECTRON_LATEST_RELEASE_FILE}
"Releases file could not be downloaded, likely \
because github rate limit was exceeded. Wait until the limit \
passes or set GITHUB_API_TOKEN in your environment to a valid \
github developer token."
)
file(READ ${ELECTRON_LATEST_RELEASE_FILE} ELECTRON_LATEST_RELEASE_DATA)
string(REGEX MATCH "\"tag_name\"\: \"v([0-9]+\.[0-9]+\.[0-9]+)\""
ELECTRON_LATEST_RELEASE_MATCH ${ELECTRON_LATEST_RELEASE_DATA})
set(NodeJS_VERSION ${CMAKE_MATCH_1})
endif()
set(NodeJS_VARIANT_NAME "Electron.js")
# SHASUMS of any kind is inaccessible prior to 0.16.0
if(NodeJS_VERSION VERSION_LESS 0.16.0)
message(FATAL_ERROR "Electron is only supported for versions >= 0.16.0")
endif()
# Electron switched to IOJS after 0.25.0
# Probably needs to be bounded on the upper side if/when they switch
# back to node mainline due to iojs-node merge
set(NodeJS_VARIANT_BASE "node")
if(NodeJS_VERSION VERSION_GREATER 0.25.0)
set(NodeJS_VARIANT_BASE "iojs")
endif()
# Url is hard to get, because it will immediately resolve to a CDN
# Extracted from the electron website
set(NodeJS_URL
"https://atom.io/download/atom-shell/v${NodeJS_VERSION}"
)
# Headers become available for IOJS base ONLY!
# Variant base switch above handles this
set(NodeJS_HEADER_VERSION 0.30.1)
# Header only archive uses source style paths
set(NodeJS_DEFAULT_INCLUDE False)
# Hard to determine, but versions seem to start at 16, and SHA256 is
# available
set(NodeJS_SHA256_VERSION 0.15.9)
# C++11 and Prefixing start after the IOJS switch
# Will carry forward after node mainline so no need for upper bound (whew)
set(NodeJS_PREFIX_VERSION 0.25.0)
set(NodeJS_CXX11R_VERSION 0.25.0)
# The executable is not provided on the CDN
# In theory, I could support a BINARY_URL to get this from github
set(NodeJS_HAS_WIN32_BINARY False)
# OpenSSL isn't included in the headers
set(NodeJS_HAS_OPENSSL False)
endif()
+25
View File
@@ -0,0 +1,25 @@
set(IOJS_URL_BASE "https://iojs.org/dist")
set(IOJS_VARIANT_BASE "iojs")
set(IOJS_WIN32_BINARY_NAME "${IOJS_VARIANT_BASE}.exe")
list(APPEND NodeJS_WIN32_DELAYLOAD ${IOJS_WIN32_BINARY_NAME})
if(NodeJS_FIND_REQUIRED_IOJS OR NodeJS_VARIANT STREQUAL ${IOJS_VARIANT_BASE})
if(NodeJS_VERSION STREQUAL "latest")
set(IOJS_LATEST_RELEASE_URL
"${IOJS_URL_BASE}/latest/SHASUMS256.txt")
nodejs_get_version(${IOJS_LATEST_RELEASE_URL} NodeJS_VERSION)
endif()
set(NodeJS_VARIANT_NAME "io.js")
set(NodeJS_VARIANT_BASE ${IOJS_VARIANT_BASE})
set(NodeJS_URL "${IOJS_URL_BASE}/v${NodeJS_VERSION}")
set(NodeJS_HEADER_VERSION 2.3.1)
set(NodeJS_WIN32_BINARY_NAME "${IOJS_WIN32_BINARY_NAME}")
endif()
mark_as_advanced(
IOJS_URL_BASE
IOJS_VARIANT_BASE
IOJS_WIN32_BINARY_NAME
IOJS_LATEST_RELEASE_URL
)
+30
View File
@@ -0,0 +1,30 @@
set(NWJS_URL_BASE "http://dl.nwjs.io")
set(NWJS_VARIANT_BASE "nw")
set(NWJS_WIN32_BINARY_NAME "${NWJS_VARIANT_BASE}.exe")
list(APPEND NodeJS_WIN32_DELAYLOAD ${NWJS_WIN32_BINARY_NAME})
if(NodeJS_FIND_REQUIRED_NWJS OR NodeJS_VARIANT STREQUAL ${NWJS_VARIANT_BASE})
set(NodeJS_CHECKSUM_PATH "MD5SUMS")
set(NodeJS_CHECKSUM_TYPE "MD5")
if(NodeJS_VERSION STREQUAL "latest")
set(NWJS_LATEST_RELEASE_URL
"${NWJS_URL_BASE}/latest/${NodeJS_CHECKSUM_PATH}")
nodejs_get_version(${NWJS_LATEST_RELEASE_URL} NodeJS_VERSION)
endif()
set(NodeJS_VARIANT_NAME "nw.js")
set(NodeJS_VARIANT_BASE ${NWJS_VARIANT_BASE})
set(NodeJS_URL "${NWJS_URL_BASE}/v${NodeJS_VERSION}")
set(NodeJS_SOURCE_PATH "nw-headers-v${NodeJS_VERSION}.tar.gz")
set(NodeJS_DEFAULT_INCLUDE False)
set(NodeJS_HAS_WIN32_PREFIX False)
set(NodeJS_HAS_WIN32_BINARY False)
endif()
mark_as_advanced(
NWJS_URL_BASE
NWJS_VARIANT_BASE
NWJS_WIN32_BINARY_NAME
NWJS_LATEST_RELEASE_URL
)
+131
View File
@@ -0,0 +1,131 @@
set(NodeJS_URL_BASE http://nodejs.org/dist)
set(NodeJS_DEFAULT_VARIANT_BASE "node")
set(NodeJS_DEFAULT_WIN32_BINARY_NAME "${NodeJS_DEFAULT_VARIANT_BASE}.exe")
list(APPEND NodeJS_WIN32_DELAYLOAD ${NodeJS_DEFAULT_WIN32_BINARY_NAME})
if(NodeJS_VERSION STREQUAL "latest")
set(NodeJS_LATEST_RELEASE_URL
"${NodeJS_URL_BASE}/latest/SHASUMS256.txt")
nodejs_get_version(${NodeJS_LATEST_RELEASE_URL} NodeJS_VERSION)
endif()
if(NOT NodeJS_VARIANT_NAME)
set(NodeJS_VARIANT_NAME ${NodeJS_DEFAULT_VARIANT_NAME})
endif()
if(NOT NodeJS_VARIANT_BASE)
set(NodeJS_VARIANT_BASE ${NodeJS_DEFAULT_VARIANT_BASE})
endif()
if(NOT NodeJS_URL)
set(NodeJS_URL "${NodeJS_URL_BASE}/v${NodeJS_VERSION}")
endif()
if(NOT NodeJS_SOURCE_PATH)
set(NodeJS_SOURCE_PATH "${NodeJS_VARIANT_BASE}-v${NodeJS_VERSION}")
# Use the headers archive when its available
if(NodeJS_VERSION VERSION_GREATER ${NodeJS_HEADER_VERSION})
set(NodeJS_SOURCE_PATH "${NodeJS_SOURCE_PATH}-headers")
endif()
set(NodeJS_SOURCE_PATH "${NodeJS_SOURCE_PATH}.tar.gz")
endif()
if(NodeJS_DEFAULT_INCLUDE AND
NodeJS_VERSION VERSION_GREATER ${NodeJS_HEADER_VERSION})
set(NodeJS_SOURCE_INCLUDE False)
set(NodeJS_HEADER_INCLUDE True)
endif()
if(NodeJS_SOURCE_INCLUDE)
list(APPEND NodeJS_INCLUDE_PATHS
src
deps/uv/include
deps/v8/include
deps/zlib
)
# OpenSSL is an optional header
if(NodeJS_HAS_OPENSSL)
list(APPEND NodeJS_INCLUDE_PATHS
deps/openssl/openssl/include
)
endif()
endif()
if(NodeJS_HEADER_INCLUDE)
set(NodeJS_INCLUDE_PATHS include/node)
endif()
if(NOT NodeJS_CHECKSUM_TYPE)
# Use SHA256 when available
if(NodeJS_VERSION VERSION_GREATER ${NodeJS_SHA256_VERSION})
set(NodeJS_CHECKSUM_TYPE "SHA256")
else()
set(NodeJS_CHECKSUM_TYPE "SHA1")
endif()
endif()
if(NOT NodeJS_CHECKSUM_PATH)
set(NodeJS_CHECKSUM_PATH "SHASUMS")
if(NodeJS_CHECKSUM_TYPE STREQUAL "SHA256")
set(NodeJS_CHECKSUM_PATH "${NodeJS_CHECKSUM_PATH}256")
endif()
set(NodeJS_CHECKSUM_PATH "${NodeJS_CHECKSUM_PATH}.txt")
endif()
# Library and binary are based on variant base
if(NOT NodeJS_WIN32_LIBRARY_NAME)
set(NodeJS_WIN32_LIBRARY_NAME ${NodeJS_VARIANT_BASE}.lib)
endif()
if(NOT NodeJS_WIN32_BINARY_NAME)
set(NodeJS_WIN32_BINARY_NAME ${NodeJS_VARIANT_BASE}.exe)
endif()
if(NOT NodeJS_WIN32_LIBRARY_PATH)
# The library location is prefixed after a specific version
if(NodeJS_HAS_WIN32_PREFIX AND
NodeJS_VERSION VERSION_GREATER ${NodeJS_PREFIX_VERSION})
set(NodeJS_WIN32_LIBRARY_PATH "win-")
if(NodeJS_ARCH_IA32)
set(NodeJS_WIN32_LIBRARY_PATH "${NodeJS_WIN32_LIBRARY_PATH}x86/")
endif()
endif()
# 64-bit versions are prefixed
if(NodeJS_ARCH_X64)
set(NodeJS_WIN32_LIBRARY_PATH "${NodeJS_WIN32_LIBRARY_PATH}x64/")
endif()
set(NodeJS_WIN32_LIBRARY_PATH
"${NodeJS_WIN32_LIBRARY_PATH}${NodeJS_WIN32_LIBRARY_NAME}"
)
endif()
if(NodeJS_HAS_WIN32_BINARY AND NOT NodeJS_WIN32_BINARY_PATH)
# The executable location is prefixed after a specific version
if(NodeJS_HAS_WIN32_PREFIX AND
NodeJS_VERSION VERSION_GREATER ${NodeJS_PREFIX_VERSION})
set(NodeJS_WIN32_BINARY_PATH "win-")
if(NodeJS_ARCH_IA32)
set(NodeJS_WIN32_BINARY_PATH "${NodeJS_WIN32_BINARY_PATH}x86/")
endif()
endif()
# 64-bit versions are prefixed
if(NodeJS_ARCH_X64)
set(NodeJS_WIN32_BINARY_PATH "${NodeJS_WIN32_BINARY_PATH}x64/")
endif()
set(NodeJS_WIN32_BINARY_PATH
"${NodeJS_WIN32_BINARY_PATH}${NodeJS_WIN32_BINARY_NAME}"
)
endif()
# Specify windows libraries
# XXX: This may need to be version/variant specific in the future
if(NodeJS_DEFAULT_LIBS AND NodeJS_PLATFORM_WIN32)
list(APPEND NodeJS_LIBRARIES
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib DelayImp.lib
)
endif()
mark_as_advanced(
NodeJS_URL_BASE
NodeJS_DEFAULT_VARIANT_BASE
NodeJS_DEFAULT_WIN32_BINARY_NAME
NodeJS_LATEST_RELEASE_URL
)
+1
View File
@@ -1,6 +1,7 @@
coverage: coverage:
ignore: ignore:
- unit_tests/.*
- third_party/.* - third_party/.*
comment: off comment: off
+1 -1
View File
@@ -3,5 +3,5 @@ module.exports = {
verify: '--strict --tags ~@stress --tags ~@todo -f progress --require features/support --require features/step_definitions', verify: '--strict --tags ~@stress --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 --tags ~@alternative --require features/support --require features/step_definitions -f progress' mld: '--strict --tags ~@stress --tags ~@todo --tags ~@match --tags ~@alternative --tags ~@matrix --tags ~@trip --tags ~@via --require features/support --require features/step_definitions -f progress'
} }
+11 -18
View File
@@ -1,9 +1,15 @@
FROM alpine:3.5 FROM alpine:3.5
ARG DOCKER_TAG
RUN mkdir /src
COPY . /src
RUN mkdir /opt RUN mkdir /opt
WORKDIR /opt WORKDIR /opt
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; *) BUILD_TYPE="Release";; esac && \
\
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 && \
@@ -17,26 +23,13 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
cd build && \ cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \ cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j${NPROC} && \ make -j${NPROC} && \
make install 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 && \ cd /src && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir build && \ mkdir build && \
cd build && \ cd build && \
BUILD_TYPE="Release" && \ cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_LTO=On .. && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
make -j${NPROC} install && \ make -j${NPROC} install && \
cd ../profiles && \ cd ../profiles && \
cp -r * /opt && \ cp -r * /opt && \
+16 -26
View File
@@ -15,7 +15,7 @@ GET /{service}/{version}/{profile}/{coordinates}[.{format}]?option=value&option=
| `service` | One of the following values: [`route`](#route-service), [`nearest`](#nearest-service), [`table`](#table-service), [`match`](#match-service), [`trip`](#trip-service), [`tile`](#tile-service) | | `service` | One of the following values: [`route`](#route-service), [`nearest`](#nearest-service), [`table`](#table-service), [`match`](#match-service), [`trip`](#trip-service), [`tile`](#tile-service) |
| `version` | Version of the protocol implemented by the service. `v1` for all OSRM 5.x installations | | `version` | Version of the protocol implemented by the service. `v1` for all OSRM 5.x installations |
| `profile` | Mode of transportation, is determined statically by the Lua profile that is used to prepare the data using `osrm-extract`. Typically `car`, `bike` or `foot` if using one of the supplied profiles. | | `profile` | Mode of transportation, is determined statically by the Lua profile that is used to prepare the data using `osrm-extract`. Typically `car`, `bike` or `foot` if using one of the supplied profiles. |
| `coordinates`| String of format `{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]` or `polyline({polyline}) or polyline6({polyline6})`. | | `coordinates`| String of format `{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]` or `polyline({polyline})`. |
| `format`| Only `json` is supported at the moment. This parameter is optional and defaults to `json`. | | `format`| Only `json` is supported at the moment. This parameter is optional and defaults to `json`. |
Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 by default and can be generated using [this package](https://www.npmjs.com/package/polyline). Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 by default and can be generated using [this package](https://www.npmjs.com/package/polyline).
@@ -30,7 +30,6 @@ To pass parameters to each location some options support an array like encoding:
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. | |radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. | |generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. | |hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curb side. |
Where the elements follow the following format: Where the elements follow the following format:
@@ -39,7 +38,6 @@ Where the elements follow the following format:
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` | |bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|radius |`double >= 0` or `unlimited` (default) | |radius |`double >= 0` or `unlimited` (default) |
|hint |Base64 `string` | |hint |Base64 `string` |
|approach |`curb` or `unrestricted` (default) |
``` ```
{option}={element};{element}[;{element} ... ] {option}={element};{element}[;{element} ... ]
@@ -165,21 +163,21 @@ curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?numb
Finds the fastest route between coordinates in the supplied order. Finds the fastest route between coordinates in the supplied order.
```endpoint ```endpoint
GET /route/v1/{profile}/{coordinates}?alternatives={true|false|number}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false} GET /route/v1/{profile}/{coordinates}?alternatives={true|false}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false}
``` ```
In addition to the [general options](#general-options) the following options are supported for this service: In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description | |Option |Values |Description |
|------------|---------------------------------------------|-------------------------------------------------------------------------------| |------------|---------------------------------------------|-------------------------------------------------------------------------------|
|alternatives|`true`, `false` (default), or Number |Search for alternative routes. Passing a number `alternatives=n` searches for up to `n` alternative routes.\* | |alternatives|`true`, `false` (default) |Search for alternative routes and return as well.\* |
|steps |`true`, `false` (default) |Returned route steps for each route leg | |steps |`true`, `false` (default) |Return route steps for each route leg |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. | |annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) | |geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.| |overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. | |continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
\* Please note that even if alternative routes are requested, a result cannot be guaranteed. \* Please note that even if an alternative route is requested, a result cannot be guaranteed.
**Response** **Response**
@@ -275,14 +273,12 @@ In addition to the [general options](#general-options) the following options are
|Option |Values |Description | |Option |Values |Description |
|------------|------------------------------------------------|------------------------------------------------------------------------------------------| |------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|steps |`true`, `false` (default) |Returned route steps for each route | |steps |`true`, `false` (default) |Return route steps for each route |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) | |geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. | |annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.| |overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. | |timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. |
|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. |
|tidy |`true`, `false` (default) |Allows the input track modification to obtain better matching quality for noisy tracks. |
|Parameter |Values | |Parameter |Values |
|------------|-----------------------------------| |------------|-----------------------------------|
@@ -302,7 +298,7 @@ The area to search is chosen such that the correct candidate should be considere
Each `Waypoint` object has the following additional properties: Each `Waypoint` object has the following additional properties:
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to. - `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
- `waypoint_index`: Index of the waypoint inside the matched route. - `waypoint_index`: Index of the waypoint inside the matched route.
- `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching. - `alternatives_count`: number of alternative routes leading to the destination from this trace point. 0 means there are no other routes reaching destination. Greater values mean that there are different routes available and different route can be selected if you provide more coordinates.
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties: - `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct. - `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.
@@ -328,10 +324,10 @@ In addition to the [general options](#general-options) the following options are
|Option |Values |Description | |Option |Values |Description |
|------------|------------------------------------------------|---------------------------------------------------------------------------| |------------|------------------------------------------------|---------------------------------------------------------------------------|
|roundtrip |`true` (default), `false` |Returned route is a roundtrip (route returns to first location) | |roundtrip |`true` (default), `false` |Return route is a roundtrip (route returns to first location) |
|source |`any` (default), `first` |Returned route starts at `any` or `first` coordinate | |source |`any` (default), `first` |Return route starts at `any` or `first` coordinate |
|destination |`any` (default), `last` |Returned route ends at `any` or `last` coordinate | |destination |`any` (default), `last` |Return route ends at `any` or `last` coordinate |
|steps |`true`, `false` (default) |Returned route instructions for each trip | |steps |`true`, `false` (default) |Return route instructions for each trip |
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. | |annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) | |geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.| |overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
@@ -419,10 +415,8 @@ Vector tiles contain two layers:
| `speed` | `integer` | the speed on that road segment, in km/h | | `speed` | `integer` | the speed on that road segment, in km/h |
| `is_small` | `boolean` | whether this segment belongs to a small (< 1000 node) [strongly connected component](https://en.wikipedia.org/wiki/Strongly_connected_component) | | `is_small` | `boolean` | whether this segment belongs to a small (< 1000 node) [strongly connected component](https://en.wikipedia.org/wiki/Strongly_connected_component) |
| `datasource` | `string` | the source for the speed value (normally `lua profile` unless you're using the [traffic update feature](https://github.com/Project-OSRM/osrm-backend/wiki/Traffic), in which case it contains the stem of the filename that supplied the speed value for this segment | | `datasource` | `string` | the source for the speed value (normally `lua profile` unless you're using the [traffic update feature](https://github.com/Project-OSRM/osrm-backend/wiki/Traffic), in which case it contains the stem of the filename that supplied the speed value for this segment |
| `duration` | `float` | how long this segment takes to traverse, in seconds. This value is to calculate the total route ETA. | | `duration` | `float` | how long this segment takes to traverse, in seconds |
| `weight ` | `integer` | how long this segment takes to traverse, in units (may differ from `duration` when artificial biasing is applied in the Lua profiles). ACTUAL ROUTING USES THIS VALUE. |
| `name` | `string` | the name of the road this segment belongs to | | `name` | `string` | the name of the road this segment belongs to |
| `rate` | `float` | the value of `length/weight` - analagous to `speed`, but using the `weight` value rather than `duration`, rounded to the nearest integer |
`turns` layer: `turns` layer:
@@ -431,7 +425,6 @@ Vector tiles contain two layers:
| `bearing_in` | `integer` | the absolute bearing that approaches the intersection. -180 to +180, 0 = North, 90 = East | | `bearing_in` | `integer` | the absolute bearing that approaches the intersection. -180 to +180, 0 = North, 90 = East |
| `turn_angle` | `integer` | the angle of the turn, relative to the `bearing_in`. -180 to +180, 0 = straight ahead, 90 = 90-degrees to the right | | `turn_angle` | `integer` | the angle of the turn, relative to the `bearing_in`. -180 to +180, 0 = straight ahead, 90 = 90-degrees to the right |
| `cost` | `float` | the time we think it takes to make that turn, in seconds. May be negative, depending on how the data model is constructed (some turns get a "bonus"). | | `cost` | `float` | the time we think it takes to make that turn, in seconds. May be negative, depending on how the data model is constructed (some turns get a "bonus"). |
| `weight` | `float` | the weight we think it takes to make that turn. May be negative, depending on how the data model is constructed (some turns get a "bonus"). ACTUAL ROUTING USES THIS VALUE |
## Result objects ## Result objects
@@ -539,10 +532,10 @@ Annotation of the whole route leg with fine-grained information about each segme
**Properties** **Properties**
- `distance`: The distance, in metres, between each pair of coordinates - `distance`: The distance, in metres, between each pair of coordinates
- `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns. - `duration`: The duration between each pair of coordinates, in seconds
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` - `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract`
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates - `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
- `weight`: The weights between each pair of coordinates. Does not include any turn costs. - `weight`: The weights between each pair of coordinates
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place - `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
#### Example #### Example
@@ -581,7 +574,6 @@ step.
- `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`: The pronunciation hint of the way name. Will be `undefined` if there is no pronunciation hit. - `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.
- `mode`: A string signifying the mode of transportation. - `mode`: A string signifying the mode of transportation.
- `maneuver`: A `StepManeuver` object representing the maneuver. - `maneuver`: A `StepManeuver` object representing the maneuver.
- `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
@@ -655,12 +647,12 @@ step.
| `off ramp` | take a ramp to exit a highway (direction given my `modifier`) | | `off ramp` | take a ramp to exit a highway (direction given my `modifier`) |
| `fork` | take the left/right side at a fork depending on `modifier` | | `fork` | take the left/right side at a fork depending on `modifier` |
| `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` | going straight on a specific lane |
| `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, has additional property `exit` with NR if the roundabout is left. 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. If the road takes a turn itself, the `modifier` describes the direction |
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
between all instructions. They only offer a fallback in case nothing else is to report. between all instructions. They only offer a fallback in case nothing else is to report.
@@ -733,7 +725,6 @@ location of the StepManeuver. Further intersections are listed for every cross-w
- `location`: A `[longitude, latitude]` pair describing the location of the turn. - `location`: A `[longitude, latitude]` pair describing the location of the turn.
- `bearings`: A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection. Values are between 0-359 (0=true north) - `bearings`: A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection. Values are between 0-359 (0=true north)
- `classes`: An array of strings signifying the classes (as specified in the profile) of the road exiting the intersection.
- `entry`: A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route. - `entry`: A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route.
`false` indicates that the turn onto the respective road would violate a restriction. `false` indicates that the turn onto the respective road would violate a restriction.
- `in`: index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the - `in`: index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the
@@ -752,7 +743,6 @@ location of the StepManeuver. Further intersections are listed for every cross-w
"out":2, "out":2,
"bearings":[60,150,240,330], "bearings":[60,150,240,330],
"entry":["false","true","true","true"], "entry":["false","true","true","true"],
"classes": ["toll", "restricted"],
"lanes":{ "lanes":{
"indications": ["left", "straight"], "indications": ["left", "straight"],
"valid": "false" "valid": "false"
+123 -134
View File
@@ -1,66 +1,66 @@
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> # OSRM
## OSRM The `OSRM` method is the main constructor for creating an OSRM instance. An OSRM instance requires a `.osrm` network,
which is prepared by the OSRM Backend C++ library.
The `OSRM` method is the main constructor for creating an OSRM instance.
An OSRM instance requires a `.osrm` dataset, which is prepared by the OSRM toolchain.
You can create such a `.osrm` file by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default You can create such a `.osrm` file by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default
profiles (e.g. for setting speeds and determining road types to route on) in `node_modules/osrm/profiles/`: profiles (e.g. for setting speeds and determining road types to route on) in `node_modules/osrm/profiles/`:
node_modules/osrm/lib/binding/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua node_modules/osrm/lib/binding/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
node_modules/osrm/lib/binding/osrm-contract data.osrm node_modules/osrm/lib/binding/osrm-contract data.osrm
Consult the [osrm-backend](https://github.com/Project-OSRM/osrm-backend) documentation for further details. Consult the [osrm-backend](https://github.com/Project-OSRM/osrm-backend) documentation or further details.
Once you have a complete `network.osrm` file, you can calculate routes in javascript with this object. Once you have a complete `network.osrm` file, you can calculate networks in javascript with this library using the
methods below. To create an OSRM instance with your network you need to construct an instance like this:
```javascript ```javascript
var osrm = new OSRM('network.osrm'); var osrm = new OSRM('network.osrm');
``` ```
**Parameters** #### Methods
- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`) | Service | Description |
- `options.algorithm` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'. | -------------------------- | --------------------------------------------------------- |
Make sure you prepared the dataset with the correct toolchain. | [`osrm.route`](#route) | shortest path between given coordinates |
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore. | [`osrm.nearest`](#nearest) | returns the nearest street segment for a given coordinate |
This requires you to run `osrm-datastore` prior to creating an `OSRM` object. | [`osrm.table`](#table) | computes distance tables for given coordinates |
- `options.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true. | [`osrm.match`](#match) | matches given coordinates to the road network |
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited). | [`osrm.trip`](#trip) | Compute the shortest trip between given coordinates |
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query 9default: unlimited). | [`osrm.tile`](#tile) | Return vector tiles containing debugging info |
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map matching query (default: unlimited).
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
- `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternative routes supported (default: 3).
### route #### General Options
Each OSRM method (except for `OSRM.tile()`) has set of general options as well as unique options, outlined below.
| Option | Values | Description | Format |
| --------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| coordinates | `array` of `coordinate` elements: `[{coordinate}, ...]` | The coordinates this request will use. | `array` with `[{lon},{lat}]` values, in decimal degrees |
| bearings | `array` of `bearing` elements: `[{bearing}, ...]` | Limits the search to segments with given bearing in degrees towards true north in clockwise direction. | `null` or `array` with `[{value},{range}]` `integer 0 .. 360,integer 0 .. 180` |
| radiuses | `array` of `radius` elements: `[{radius}, ...]` | Limits the search to given radius in meters. | `null` or `double >= 0` or `unlimited` (default) |
| hints | `array` of `hint` elements: `[{hint}, ...]` | Hint to derive position in street network. | Base64 `string` |
| generate\_hints | `true` (default) or `false` | Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. | `Boolean` |
## route
Returns the fastest route between two or more coordinates while visiting the waypoints in order. Returns the fastest route between two or more coordinates while visiting the waypoints in order.
**Parameters** **Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query. - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - `options.alternatives` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Search for alternative routes and return as well. _Please note that even if an alternative route is requested, a result cannot be guaranteed._ (optional, default `false`)
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. - `options.steps` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Return route steps for each route leg. (optional, default `false`)
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - `options.annotations` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)] or \[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>]** Return annotations for each route leg for duration, nodes, distance, weight, datasources and/or speed. Annotations can be `false` or `true` (no/full annotations) or an array of strings with `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed`. (optional, default `false`)
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. - `options.geometries` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - `options.overview` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes and return as well. - `options.continue_straight` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile. `null`/`true`/`false`
_Please note that even if an alternative route is requested, a result cannot be guaranteed._ (optional, default `false`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route leg. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
`null`/`true`/`false`
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** - `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples** **Examples**
```javascript ```javascript
var osrm = new OSRM("berlin-latest.osrm"); var osrm = new OSRM("berlin-latest.osrm");
osrm.route({coordinates: [[52.519930,13.438640], [52.513191,13.415852]]}, function(err, result) { osrm.route({coordinates: [[13.438640,52.519930], [13.415852, 52.513191]]}, function(err, result) {
if(err) throw err; if(err) throw err;
console.log(result.waypoints); // array of Waypoint objects representing all waypoints in order console.log(result.waypoints); // array of Waypoint objects representing all waypoints in order
console.log(result.routes); // array of Route objects ordered by descending recommendation rank console.log(result.routes); // array of Route objects ordered by descending recommendation rank
@@ -69,7 +69,7 @@ osrm.route({coordinates: [[52.519930,13.438640], [52.513191,13.415852]]}, functi
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank. Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank.
### nearest ## nearest
Snaps a coordinate to the street network and returns the nearest n matches. Snaps a coordinate to the street network and returns the nearest n matches.
@@ -78,14 +78,8 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
**Parameters** **Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query. - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - `options.number` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Number of nearest segments that should be returned.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.number` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
Must be an integer greater than or equal to `1`. (optional, default `1`) Must be an integer greater than or equal to `1`. (optional, default `1`)
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** - `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples** **Examples**
@@ -104,27 +98,19 @@ osrm.nearest(options, function(err, response) {
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`. Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`.
**`waypoints`**: array of [`Ẁaypoint`](#waypoint) objects sorted by distance to the input coordinate. **`waypoints`**: array of [`Ẁaypoint`](#waypoint) objects sorted by distance to the input coordinate.
Each object has an additional `distance` property, which is the distance in meters to the supplied input coordinate. Each object has an additional `distance` property, which is the distance in meters to the supplied
input coordinate.
### table ## table
Computes duration tables for the given locations. Allows for both symmetric and asymmetric Computes duration tables for the given locations. Allows for both symmetric and asymmetric tables.
tables.
**Parameters** **Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query. - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - `options.sources` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** An array of `index` elements (`0 <= integer < #coordinates`) to use
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.sources` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to
use
location with given index as source. Default is to use all. location with given index as source. Default is to use all.
- `options.destinations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < - `options.destinations` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
#coordinates`) to use location with given index as destination. Default is to use all.
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** - `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples** **Examples**
@@ -146,25 +132,24 @@ osrm.table(options, function(err, response) {
``` ```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `sources`, and `destinations`. Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `sources`, and `destinations`.
**`durations`**: array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint. **`durations`**: array of arrays that stores the matrix in row-major order. `durations[i][j]`
Values are given in seconds. gives the travel time from the i-th waypoint to the j-th waypoint. Values are given in seconds.
**`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order. **`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order.
**`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order. **`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order.
### tile ## tile
This generates [Mapbox Vector Tiles](https://mapbox.com/vector-tiles) that can be viewed with a This generates [Mapbox Vector Tiles](https://mapbox.com/vector-tiles) that can be viewed with a
vector-tile capable slippy-map viewer. The tiles contain road geometries and metadata that can vector-tile capable slippy-map viewer. The tiles contain road geometries and metadata that can
be used to examine the routing graph. The tiles are generated directly from the data in-memory, be used to examine the routing graph. The tiles are generated directly from the data in-memory,
so are in sync with actual routing results, and let you examine which roads are actually so are in sync with actual routing results, and let you examine which roads are actually routable,
routable,
and what weights they have applied. and what weights they have applied.
**Parameters** **Parameters**
- `ZXY` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like - `ZXY` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like
[wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) [wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames)
and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/). and are supported by vector tile viewers like [Mapbox GL JS]\(<https://www.mapbox.com/mapbox-gl-js/api/>.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** - `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples** **Examples**
@@ -179,7 +164,7 @@ osrm.tile([0, 0, 0], function(err, response) {
Returns **[Buffer](https://nodejs.org/api/buffer.html)** contains a Protocol Buffer encoded vector tile. Returns **[Buffer](https://nodejs.org/api/buffer.html)** contains a Protocol Buffer encoded vector tile.
### match ## match
Map matching matches given GPS points to the road network in the most plausible way. Map matching matches given GPS points to the road network in the most plausible way.
Please note the request might result multiple sub-traces. Large jumps in the timestamps Please note the request might result multiple sub-traces. Large jumps in the timestamps
@@ -190,18 +175,15 @@ if they can not be matched successfully.
**Parameters** **Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query. - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - `options.steps` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Return route steps for each route. (optional, default `false`)
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. - `options.annotations` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)] or \[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>]** Return annotations for each route leg for duration, nodes, distance, weight, datasources and/or speed. Annotations can be `false` or `true` (no/full annotations) or an array of strings with `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed`. (optional, default `false`)
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - `options.geometries` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Returned route geometry format (influences overview
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route. (optional, default `false`) - `options.overview` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Add overview geometry either `full`, `simplified`
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - `options.timestamps` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>]** Timestamp of the input location (integers, UNIX-like timestamp).
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) - `options.radiuses` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** Standard deviation of GPS precision used for map matching.
- `options.timestamps` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp). If applicable use GPS accuracy (`double >= 0`, default `5m`).
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`.
- `options.gaps` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore`. (optional, default `split`)
- `options.tidy` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allows the input track modification to obtain better matching quality for noisy tracks. (optional, default `false`)
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** - `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples** **Examples**
@@ -221,55 +203,69 @@ osrm.match(options, function(err, response) {
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`. Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order. **`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
If the trace point was ommited by map matching because it is an outlier, the entry will be null. If the trace point was ommited by map matching because it is an outlier, the entry will be null. Each
Each `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the
[`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of [`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of
the waypoint inside the matched route. the waypoint inside the matched route.
**`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property, **`matchings`** is an array of [`Route`](#route) objects that
which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct. assemble the trace. Each `Route` object has an additional `confidence` property, which is the confidence of
the matching. float value between `0` and `1`. `1` is very confident that the matching is correct.
### trip ## trip
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm). The returned path does not have to be the fastest path, as TSP is NP-hard it is only an approximation. Note that all input coordinates have to be connected for the trip service to work.
(farthest-insertion algorithm) for 10 or _ more waypoints and uses brute force for less than 10
waypoints. The returned path does not have to be the shortest path, _ as TSP is NP-hard it is
only an approximation.
**Parameters** **Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query. - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - `options.roundtrip` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Return route is a roundtrip. (optional, default `true`)
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. - `options.source` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Return route starts at `any` coordinate. Can also be `first`. (optional, default `any`)
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - `options.destination` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Return route ends at `any` coordinate. Can also be `last`. (optional, default `any`)
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default). - `options.steps` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Return route steps for each route. (optional, default `false`)
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - `options.annotations` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)] or \[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>]** Return annotations for each route leg for duration, nodes, distance, weight, datasources and/or speed. Annotations can be `false` or `true` (no/full annotations) or an array of strings with `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed`. (optional, default `false`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route. (optional, default `false`) - `options.geometries` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Returned route geometry format (influences overview
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - `options.overview` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route is a roundtrip (route returns to first location). (optional, default `true`)
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route starts at `any` or `first` coordinate. (optional, default `any`)
- `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route ends at `any` or `last` coordinate. (optional, default `any`)
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** - `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
A requirement for computing trips is that all input coordinates are connected. **Fixing Start and End Points**
It is possible to explicitly set the start or end coordinate of the trip. When source is set to `first`, the first coordinate is used as start coordinate of the trip in the output. When destination is set to `last`, the last coordinate will be used as destination of the trip in the returned output. If you specify `any`, any of the coordinates can be used as the first or last coordinate in the output.
However, if `source=any&destination=any` the returned round-trip will still start at the first input coordinate by default.
Currently, not all combinations of `roundtrip`, `source` and `destination` are supported. Currently, not all combinations of `roundtrip`, `source` and `destination` are supported.
Right now, the following combinations are possible: Right now, the following combinations are possible:
| roundtrip | source | destination | supported | | roundtrip | source | destination | supported |
| :-------- | :----- | :---------- | :-------- | | :-- | :-- | :-- | :-- |
| true | first | last | **yes** | | true | first | last | **yes** |
| true | first | any | **yes** | | true | first | any | **yes** |
| true | any | last | **yes** | | true | any | last | **yes** |
| true | any | any | **yes** | | true | any | any | **yes** |
| false | first | last | **yes** | | false | first | last | **yes** |
| false | first | any | no | | false | first | any | no |
| false | any | last | no | | false | any | last | no |
| false | any | any | no | | false | any | any | no |
**Examples** **Examples**
Roundtrip Request
```javascript
var osrm = new OSRM('network.osrm');
var options = {
coordinates: [
[13.36761474609375, 52.51663871100423],
[13.374481201171875, 52.506191342034576]
]
}
osrm.trip(options, function(err, response) {
if (err) throw err;
console.log(response.waypoints); // array of Waypoint objects
console.log(response.trips); // array of Route objects
});
```
Non Roundtrip Request
```javascript ```javascript
var osrm = new OSRM('network.osrm'); var osrm = new OSRM('network.osrm');
var options = { var options = {
@@ -289,56 +285,49 @@ osrm.trip(options, function(err, response) {
``` ```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`. Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`.
**`waypoints`**: an array of [`Waypoint`](#waypoint) objects representing all waypoints in input order. **`waypoints`**: an array of [`Ẁaypoint`](#waypoint) objects representing all waypoints in input order.
Each Waypoint object has the following additional properties, Each Waypoint object has the following additional properties, 1) `trips_index`: index to trips of the
1) `trips_index`: index to trips of the sub-trip the point was matched to, and sub-trip the point was matched to, and 2) `waypoint_index`: index of the point in the trip.
2) `waypoint_index`: index of the point in the trip.
**`trips`**: an array of [`Route`](#route) objects that assemble the trace. **`trips`**: an array of [`Route`](#route) objects that assemble the trace.
## Responses # Responses
Responses Responses
### Route ## Route
Represents a route through (potentially multiple) waypoints. Represents a route through (potentially multiple) waypoints.
**Parameters** **Parameters**
- `exteral` **documentation** in - `exteral` **documentation** in [`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#route)
[`osrm-backend`](../http.md#route)
### RouteLeg ## RouteLeg
Represents a route between two waypoints. Represents a route between two waypoints.
**Parameters** **Parameters**
- `exteral` **documentation** in - `exteral` **documentation** in [`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#routeleg)
[`osrm-backend`](../http.md#routeleg)
### RouteStep ## RouteStep
A step consists of a maneuver such as a turn or merge, followed by a distance of travel along a A step consists of a maneuver such as a turn or merge, followed by a distance of travel along a single way to the subsequent step.
single way to the subsequent step.
**Parameters** **Parameters**
- `exteral` **documentation** in - `exteral` **documentation** in [`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#routestep)
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#routestep)
### StepManeuver ## StepManeuver
**Parameters** **Parameters**
- `exteral` **documentation** in - `exteral` **documentation** in [`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#stepmanuever)
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#stepmaneuver)
### Waypoint ## Waypoint
Object used to describe waypoint on a route. Object used to describe waypoint on a route.
**Parameters** **Parameters**
- `exteral` **documentation** in - `exteral` **documentation** in [`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint)
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint)
+5 -86
View File
@@ -25,104 +25,23 @@ As you scroll down the file you'll see local variables, and then local functions
`way_function` and `node_function` are the important functions which are called when extracting OpenStreetMap data with `osrm-extract`. `way_function` and `node_function` are the important functions which are called when extracting OpenStreetMap data with `osrm-extract`.
The following global properties can be set in your profile:
Attribute | Type | Notes
-------------------------------------|----------|----------------------------------------------------------------------------
weight_name | String | Name used in output for the routing weight property (default `'duration'`)
weight_precision | Unsigned | Decimal precision of edge weights (default `1`)
left_hand_driving | Boolean | Are vehicles assumed to drive on the left? (used in guidance, default `false`)
use_turn_restrictions | Boolean | Are turn instructions followed? (default `false`)
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed? (default `true`)
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
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 `segment_function` will be called for all segments (default `false`)
## way_function ## way_function
Given an OpenStreetMap way, the `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 to be returned. The most important thing it will do is set the value of `result.forward_speed` and `result.backward_speed` as a suitable integer value representing the speed for traversing the way. Given an OpenStreetMap way, the 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 to be returned. The most important thing it will do is set the value of `result.forward_speed` and `result.backward_speed` as a suitable integer value representing the speed for traversing the way.
All other calculations stem from that, including the returned timings in driving directions, but also, less directly, it feeds into the actual routing decisions the engine will take (a way with a slow traversal speed, may be less favoured than a way with fast traversal speed, but it depends how long it is, and... what it connects to in the rest of the network graph) All other calculations stem from that, including the returned timings in driving directions, but also, less directly, it feeds into the actual routing decisions the engine will take (a way with a slow traversal speed, may be less favoured than a way with fast traversal speed, but it depends how long it is, and... what it connects to in the rest of the network graph)
Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the `way_function`. Instead a `way_function` will examine the tagging (e.g. `way:get_value_by_key("highway")` and many others), process this information in various ways, calling other local functions, referencing the global variables and look-up hashes, 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 way_function. Instead a way_function will examine the tagging (e.g. `way:get_value_by_key("highway")` and many others), process this information in various ways, calling other local functions, referencing the global variables and look-up hashes, before arriving at the result.
The following attributes can be set on the result in `way_function`: ## Guidance
Attribute | Type | Notes
----------------------------------------|----------|--------------------------------------------------------------------------
forward_speed | Float | Speed on this way in km/h. Mandatory.
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)
backward_rate | Float | " "
forward_mode | Enum | Mode of travel (e.g. `car`, `ferry`). Mandatory. Defined in `include/extractor/travel_mode.hpp`.
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`.
backward_classes | Table | " "
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
turn_lanes_forward | String | Directions for individual lanes (normalised OSM `turn:lanes` value)
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)
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)
roundabout | Boolean | Is this part of a roundabout?
circular | Boolean | Is this part of a non-roundabout circular junction?
name | String | Name of the way
ref | String | Road number
destinations | String | The road's destinations
exits | String | The ramp's exit numbers or names
pronunciation | String | Name pronunciation
road_classification.motorway_class | Boolean | Guidance: way is a motorway
road_classification.link_class | Boolean | Guidance: way is a slip/link road
road_classification.road_priority_class | Enum | Guidance: order in priority list. Defined in `include/extractor/guidance/road_classification.hpp`
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
### 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.
Please be aware of this when using guidance configuration possibilities. Please be aware of this when using guidance configuration possibilities.
### Road Classification
Guidance uses road classes to decide on when/if to emit specific instructions and to discover which road is obvious when following a route. Guidance uses road classes to decide on when/if to emit specific instructions and to discover which road is obvious when following a route.
Classification uses three flags and a priority-category. Classification uses three flags and a priority-category.
The flags indicate whether a road is a motorway (required for on/off ramps), a link type (the ramps itself, if also a motorway) and whether a road may be omittted in considerations (is considered purely for connectivity). The flags indicate whether a road is a motorway (required for on/off ramps), a link type (the ramps itself, if also a motorway) and whether a road may be omittted in considerations (is considered purely for connectivity).
The priority-category influences the decision which road is considered the obvious choice and which roads can be seen as fork. The priority-category influences the decision which road is considered the obvious choice and which roads can be seen as fork.
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.
## node_function
The following attributes can be set on the result in `node_function`:
Attribute | Type | Notes
----------------|---------|-------------------------------------------------------
barrier | Boolean | Is it an impassable barrier?
traffic_lights | Boolean | Is it a traffic light (incurs delay in `turn_function`)?
## segment_function
The following attributes can be read and set on the result in `segment_function`:
Attribute | Read/write? | Type | Notes
-------------------|-------------|---------|------------------------------------------------------
source.lon | Read | Float | Co-ordinates of segment start
source.lat | Read | Float | " "
target.lon | Read | Float | Co-ordinates of segment end
target.lat | Read | Float | " "
target.distance | Read | Float | Length of segment
weight | Read/write | Float | Routing weight for this segment
duration | Read/write | Float | Duration for this segment
## turn_function
The following attributes can be read and set on the result in `turn_function`:
Attribute | Read/write? | Type | Notes
-------------------|-------------|---------|------------------------------------------------------
direction_modifier | Read | Enum | Geometry of turn. Defined in `include/extractor/guidance/turn_instruction.hpp`
turn_type | Read | Enum | Priority of turn. Defined in `include/extractor/guidance/turn_instruction.hpp`
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 `way_function`)
target_restricted | Read | Boolean | Is it to a restricted access road? (See definition in `way_function`)
angle | Read | Float | Angle of turn in degrees (`0-360`: `0`=u-turn, `180`=straight on)
duration | Read/write | Float | Penalty to be applied for this turn (duration in deciseconds)
weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
+9 -13
View File
@@ -32,25 +32,21 @@ We may introduce forward-compatible changes: query parameters and response prope
- The `master` branch is for the bleeding edge development - The `master` branch is for the bleeding edge development
- We create and maintain release branches `x.y` to control the release flow - We create and maintain release branches `x.y` to control the release flow
- We create the release branch once we create release branches once we want to release the first RC - We create the release branch once we tagged the final version `x.y.0` version, RCs go on master
- RCs go in the release branch, commits needs to be cherry-picked from master
- No minor or major version will be released without a code-equal release candidates - No minor or major version will be released without a code-equal release candidates
- For quality assurance, release candidates need to be staged beforing tagging a final release - For quality assurance, release candidates will be run on the demo server for 24 hours before releaseing the version proper
- Patch versions may be released without a release candidate - Patch versions may be released without a release candidate
- We may backport fixes to older versions and release them as patch versions - We may backport fixes to older versions and release them as patch versions
## Releasing a version ## Releasing a version
1. Check out the appropriate release branch `x.y` 1. Check out the appropriate release branch `x.y`
2. Make sure `CHANGELOG.md` is up to date. 2. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
3. Make sure the OSRM version in `CMakeLists.txt` is up to date 3. Make sure `CHANGELOG.md` is up to date.
4. Make sure the `package.json` is up to date. 4. Make sure the OSRM version in `CMakeLists.txt` is up to date
5. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:) 5. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
6. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries. 6. Use `npm run build-api-docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
7. Use `npm run build-api-docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory 6. Push tags and commits: `git push; git push --tags`
8. Push tags and commits: `git push; git push --tags` 8. Proceede with the `node-osrm` release as [outlined in the repository](https://github.com/Project-OSRM/node-osrm/blob/master/docs/releasing.md).
9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release 9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
10. Wait until the travis build has been completed and check if the node binaries were published by doing:
`rm -rf node_modules && npm install` locally.
11. For final releases run `npm publish` or `npm publish --tag next` for release candidates.
-35
View File
@@ -1,35 +0,0 @@
@routing @bicycle @alley
Feature: Bicycle - Route around alleys
Background:
Given the profile file
"""
require 'bicycle'
properties.weight_name = 'cyclability'
"""
Scenario: Bicycle - Avoid taking alleys
Given the query options
| annotations | nodes |
Given the node map
"""
a-----b-----c
| : |
d.....e.....f
"""
And the ways
| nodes | highway | service |
| abc | residential | |
| def | service | alley |
| ad | residential | |
| be | service | alley |
| cf | residential | |
When I route I should get
| from | to | a:nodes | weight | # |
| a | f | 1:2:3:6 | 200.4 | Avoids d,e,f |
| a | e | 1:2:5 | 176.4 | Take the alley b,e if neccessary |
| d | f | 4:1:2:3:6 | 252.6 | Avoids the alley d,e,f |
-16
View File
@@ -79,19 +79,3 @@ Feature: Bike - Cycle tracks/lanes
| residential | lane | yes | x | x | | residential | lane | yes | x | x |
| footway | lane | yes | x | x | | footway | lane | yes | x | x |
| cycleway | lane | yes | x | x | | cycleway | lane | yes | x | x |
Scenario: Bike - Cycleway on oneways, modes
Then routability should be
| highway | cycleway | oneway | forw | backw |
| motorway | track | yes | cycling | |
| residential | track | yes | cycling | pushing bike |
| cycleway | track | yes | cycling | pushing bike |
| footway | track | yes | cycling | pushing bike |
Scenario: Bike - Cycleway on oneways, speeds
Then routability should be
| highway | cycleway | oneway | forw | backw |
| motorway | track | yes | 15 km/h | |
| residential | track | yes | 15 km/h | 6 km/h +-1 |
| cycleway | track | yes | 15 km/h | 6 km/h +-1 |
| footway | track | yes | 15 km/h | 6 km/h +-1 |
+2 -1
View File
@@ -53,7 +53,8 @@ Feature: Bike - Handle ferry routes
Scenario: Bike - Ferry duration, multiple nodes Scenario: Bike - Ferry duration, multiple nodes
Given the node map Given the node map
""" """
x a b c d y x y
a b c d
""" """
And the ways And the ways
-9
View File
@@ -134,12 +134,3 @@ Feature: Bike - Oneway streets
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | c | ab,bc,bc | | a | c | ab,bc,bc |
Scenario: Bike - Left/right cycleways on oneways
Then routability should be
| highway | oneway | cycleway:left | cycleway:right | forw | backw |
| primary | yes | | | cycling | pushing bike |
| primary | yes | | track | cycling | pushing bike |
| primary | yes | track | | cycling | cycling |
| primary | yes | track | track | cycling | cycling |
-105
View File
@@ -1,105 +0,0 @@
@routing @bicycle @safety
Feature: Bicycle - Adds penalties to unsafe roads
Background:
Given the profile file
"""
require 'bicycle'
properties.weight_name = 'cyclability'
"""
Scenario: Bike - Apply penalties to ways without cycleways
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| motorway | | | | | |
| primary | | 15 km/h | 15 km/h | 2.9 | 2.9 |
| secondary | | 15 km/h | 15 km/h | 3.1 | 3.1 |
| tertiary | | 15 km/h | 15 km/h | 3.3 | 3.3 |
| primary_link | | 15 km/h | 15 km/h | 2.9 | 2.9 |
| secondary_link | | 15 km/h | 15 km/h | 3.1 | 3.1 |
| tertiary_link | | 15 km/h | 15 km/h | 3.3 | 3.3 |
| residential | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | 6 km/h +-1 | 6 km/h +-1 | 1.7 | 1.7 |
Scenario: Bike - Apply no penalties to ways with cycleways
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| motorway | track | 15 km/h | | 4.2 | |
| primary | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| primary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| motorway | lane | 15 km/h | | 4.2 | |
| primary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| primary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| motorway | shared_lane | 15 km/h | | 4.2 | |
| primary | shared_lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
Scenario: Bike - Apply no penalties to ways in direction of cycleways
Then routability should be
| highway | cycleway:right | cycleway:left | forw | backw | forw_rate | backw_rate |
| motorway | track | | 15 km/h | | 4.2 | |
| primary | track | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary | track | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| primary_link | track | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| residential | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | | 15 km/h | 6 km/h +-1 | 4.2 | 1.7 |
| motorway | | track | | 15 km/h | | 4.2 |
| primary | | track | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary | | track | 15 km/h | 15 km/h | 3.1 | 4.2 |
| tertiary | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
| primary_link | | track | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary_link | | track | 15 km/h | 15 km/h | 3.1 | 4.2 |
| tertiary_link | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
| residential | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | track | 6 km/h +-1 | 15 km/h | 1.7 | 4.2 |
| motorway | lane | | 15 km/h | | 4.2 | |
| primary | lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary | lane | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| tertiary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| residential | lane | | 15 km/h +-1 | 15 km/h +-1 | 4.2 | 4.2 |
| cycleway | lane | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | lane | | 15 km/h | 6 km/h +-1 | 4.2 | 1.7 |
| motorway | | lane | | 15 km/h | | 4.2 |
| primary | | lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 3.1 | 4.2 |
| tertiary | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
| primary_link | | lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary_link | | lane | 15 km/h | 15 km/h | 3.1 | 4.2 |
| tertiary_link | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
| residential | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | lane | 6 km/h +-1 | 15 km/h | 1.7 | 4.2 |
| motorway | shared_lane | | 15 km/h | | 4.2 | |
| primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| motorway | | shared_lane | | 15 km/h | | 4.2 |
| primary | | shared_lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
Scenario: Bike - Don't apply penalties for all kind of cycleways
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| tertiary | shared_lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary | opposite | 15 km/h | 15 km/h | 3.3 | 4.2 |
-53
View File
@@ -1,53 +0,0 @@
@routing @bicycle @startpoint
Feature: Bike - Allowed start/end modes
Background:
Given the profile "bicycle"
Scenario: Bike - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | cycling,cycling |
| 2 | 1 | ab,ab | cycling,cycling |
Scenario: Bike - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | cycling,cycling |
| 2 | 1 | ab,ab | cycling,cycling |
Scenario: Bike - OK to start pushing bike
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | steps |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,bc,bc | cycling,pushing bike,pushing bike |
| 2 | 1 | bc,ab,ab | pushing bike,cycling,cycling |
+28 -60
View File
@@ -1,71 +1,39 @@
@routing @bicycle @train @routing @bicycle @train
Feature: Bike - Handle ferry routes Feature: Bike - Handle ferry routes
# Bringing bikes on trains and subways # Bringing bikes on trains and subways
# We cannot currently use a 'routability' type test, since the bike
# profile does not allow starting/stopping on trains, and
# it's not possible to modify the bicycle profile table because it's
# defined as local.
Background: Background:
Given the profile "bicycle" Given the profile "bicycle"
Scenario: Bike - Bringing bikes on trains Scenario: Bike - Bringing bikes on trains
Given the node map Then routability should be
""" | highway | railway | bicycle | bothw |
a 1 b c 2 d e 3 f g 4 h | primary | | | cycling |
""" | (nil) | train | | |
| (nil) | train | no | |
And the ways | (nil) | train | yes | train |
| nodes | highway | railway | bicycle | | (nil) | railway | | |
| ab | primary | | | | (nil) | railway | no | |
| cd | primary | | | | (nil) | railway | yes | train |
| ef | primary | | | | (nil) | subway | | |
| gh | primary | | | | (nil) | subway | no | |
| bc | | train | | | (nil) | subway | yes | train |
| de | | train | yes | | (nil) | tram | | |
| fg | | train | no | | (nil) | tram | no | |
| (nil) | tram | yes | train |
When I route I should get | (nil) | light_rail | | |
| from | to | route | | (nil) | light_rail | no | |
| 1 | 2 | | | (nil) | light_rail | yes | train |
| 2 | 3 | cd,de,ef,ef | | (nil) | monorail | | |
| 3 | 4 | | | (nil) | monorail | no | |
| (nil) | monorail | yes | train |
Scenario: Bike - Bringing bikes on trains, invalid railway tag is accepted if access specified | (nil) | some_tag | | |
Given the node map | (nil) | some_tag | no | |
""" | (nil) | some_tag | yes | cycling |
a 1 b c 2 d e 3 f g 4 h
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| cd | primary | | |
| ef | primary | | |
| gh | primary | | |
| bc | | invalid_tag | |
| de | | invalid_tag | yes |
| fg | | invalid_tag | no |
When I route I should get
| from | to | route |
| 1 | 2 | |
| 2 | 3 | cd,de,ef|
| 3 | 4 | |
@construction @construction
Scenario: Bike - Don't route on railways under construction Scenario: Bike - Don't route on railways under construction
Given the node map Then routability should be
""" | highway | railway | bicycle | bothw |
a 1 b c 2 d | primary | | | cycling |
""" | (nil) | construction | yes | |
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| cd | primary | | |
| bc | | construction | yes |
When I route I should get
| from | to | route |
| 1 | 2 | |
+22 -29
View File
@@ -2,42 +2,35 @@
Feature: Turn Penalties Feature: Turn Penalties
Background: Background:
Given the profile "bicycle" Given the profile "turnbot"
Given a grid size of 200 meters Given a grid size of 200 meters
Scenario: Bike - turns should incur a delay that depend on the angle
Scenario: Bicycle - Turn penalties on cyclability
Given the profile file
"""
require 'bicycle'
properties.weight_name = 'cyclability'
"""
Given the node map Given the node map
""" """
a--b-----c c d e
| b j f
| a s g
d
e--------f-----------g
/
/
/
h
""" """
And the ways And the ways
| nodes | highway | | nodes |
| abc | residential | | sj |
| bd | residential | | ja |
| efg | residential | | jb |
| fh | residential | | jc |
| jd |
| je |
| jf |
| jg |
When I route I should get When I route I should get
| from | to | distance | weight | # | | from | to | route | time | distance |
| a | c | 900m +- 1 | 216 | Going straight has no penalties | | s | a | sj,ja,ja | 63s +-1 | 483m +-1 |
| a | d | 900m +- 1 | 220.2 | Turning right had penalties | | s | b | sj,jb,jb | 50s +-1 | 400m +-1 |
| e | g | 2100m +- 4| 503.9 | Going straght has no penalties | | s | c | sj,jc,jc | 54s +-1 | 483m +-1 |
| e | h | 2100m +- 4| 515.1 | Turn sharp right has even higher penalties| | s | d | sj,jd,jd | 40s +-1 | 400m +-1 |
| s | e | sj,je,je | 53s +-1 | 483m +-1 |
| s | f | sj,jf,jf | 50s +-1 | 400m +-1 |
| s | g | sj,jg,jg | 63s +-1 | 483m +-1 |
+20 -20
View File
@@ -183,9 +183,9 @@ Feature: Car - Restricted access
Scenario: Car - designated HOV ways are rated low Scenario: Car - designated HOV ways are rated low
Then routability should be Then routability should be
| highway | hov | bothw | forw_rate | backw_rate | | highway | hov | bothw | forw_rate | backw_rate |
| primary | designated | x | 18.2 | 18.2 | | primary | designated | x | 18 | 18 |
| primary | yes | x | 18.2 | 18.2 | | primary | yes | x | 18 | 18 |
| primary | no | x | 18.2 | 18.2 | | primary | no | x | 18 | 18 |
# Models: # Models:
# https://www.openstreetmap.org/way/124891268 # https://www.openstreetmap.org/way/124891268
@@ -201,24 +201,24 @@ Feature: Car - Restricted access
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated) Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
Then routability should be Then routability should be
| highway | hov:lanes:forward | hov:lanes:backward | hov:lanes | oneway | forw | backw | forw_rate | backw_rate | | highway | hov:lanes:forward | hov:lanes:backward | hov:lanes | oneway | forw | backw | forw_rate | backw_rate |
| primary | designated | designated | | | x | x | 18.2 | 18.2 | | primary | designated | designated | | | x | x | 18 | 18 |
# This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769 # This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769
#| primary | | designated | | | x | x | 18.2 | 18.2 | #| primary | | designated | | | x | x | 18 | 18 |
#| primary | designated | | | | x | x | 18.2 | 18.2 | #| primary | designated | | | | x | x | 18 | 18 |
| primary | designated\|designated | designated\|designated | | | x | x | 18.2 | 18.2 | | primary | designated\|designated | designated\|designated | | | x | x | 18 | 18 |
| primary | designated\|no | designated\|no | | | x | x | 18.2 | 18.2 | | primary | designated\|no | designated\|no | | | x | x | 18 | 18 |
| primary | yes\|no | yes\|no | | | x | x | 18.2 | 18.2 | | primary | yes\|no | yes\|no | | | x | x | 18 | 18 |
| primary | | | | | x | x | 18.2 | 18.2 | | primary | | | | | x | x | 18 | 18 |
| primary | designated | | | -1 | | x | | 18.2 | | primary | designated | | | -1 | | x | | 18 |
| primary | | designated | | -1 | | x | | 18.2 | | primary | | designated | | -1 | | x | | 18 |
| primary | | | designated | yes | x | | 18.2 | | | primary | | | designated | yes | x | | 18 | |
| primary | | | designated | -1 | | x | | 18.2 | | primary | | | designated | -1 | | x | | 18 |
| primary | | | designated\| | yes | x | | 18.2 | | | primary | | | designated\| | yes | x | | 18 | |
| primary | | | designated\| | -1 | | x | | 18.2 | | primary | | | designated\| | -1 | | x | | 18 |
| primary | | | designated\|designated | yes | x | | 18.2 | | | primary | | | designated\|designated | yes | x | | 18 | |
| primary | | | designated\|designated | -1 | | x | | 18.2 | | primary | | | designated\|designated | -1 | | x | | 18 |
| primary | | | designated\|yes | yes | x | | 18.2 | | | primary | | | designated\|yes | yes | x | | 18 | |
| primary | | | designated\|no | -1 | | x | | 18.2 | | primary | | | designated\|no | -1 | | x | | 18 |
Scenario: Car - these toll roads always work Scenario: Car - these toll roads always work
Then routability should be Then routability should be
-127
View File
@@ -1,127 +0,0 @@
@routing @car @mode
Feature: Car - Mode flag
Background:
Given the profile "car"
Scenario: Car - We tag ferries with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | route |
| ab | primary | |
| bc | | ferry |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| d | a | cd,bc,ab,ab | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| c | a | bc,ab,ab | depart,notification left,arrive | [(ferry)],[()],[()] |
| d | b | cd,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| a | c | ab,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| b | d | bc,cd,cd | depart,notification left,arrive | [(ferry)],[()],[()] |
Scenario: Car - We tag motorways with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | motorway|
| cd | primary |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive | [(),(motorway),()],[()] |
| a | c | ab,bc | depart,arrive | [(),(motorway)],[()] |
| b | d | bc,cd | depart,arrive | [(motorway),()],[()] |
Scenario: Car - We tag motorway_link with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway |
| ab | primary |
| bc | motorway_link |
| cd | primary |
When I route I should get
| from | to | route | turns | classes | # |
| a | d | ab,bc,cd | depart,on ramp right,arrive | [()],[(motorway),()],[()] | on-ramp at class change |
| a | c | ab,bc,bc | depart,on ramp right,arrive | [()],[(motorway)],[()] | " " |
| b | d | bc,cd | depart,arrive | [(motorway),()],[()] | no announcement |
Scenario: Car - We tag restricted with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | access |
| ab | primary | private |
| bc | motorway| private |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] |
Scenario: Car - We toll restricted with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | toll |
| ab | primary | yes |
| bc | motorway| yes |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive | [(toll),(motorway,toll),()],[()] |
Scenario: Car - From roundabout on toll road
Given the node map
"""
c
/ \
a---b d---f
\ /
e
|
g
"""
And the ways
| nodes | oneway | highway | junction | toll |
| ab | yes | primary | | |
| cb | yes | primary | roundabout | |
| dc | yes | primary | roundabout | |
| be | yes | primary | roundabout | |
| ed | yes | motorway| roundabout | |
| eg | yes | primary | | |
| df | yes | motorway| | yes |
When I route I should get
| from | to | route | turns | classes |
| a | f | ab,df,df | depart,roundabout-exit-2,arrive | [()],[(),(motorway),(toll,motorway)],[()] |
@@ -1,741 +0,0 @@
@routing @car @restrictions
Feature: Car - Turn restrictions
# Handle turn restrictions as defined by http://wiki.openstreetmap.org/wiki/Relation:restriction
# Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes.
Background: Use car routing
Given the profile "car"
Given a grid size of 200 meters
Given the origin -9.2972,10.3811
# coordinate in Guinée, a country that observes GMT year round
@no_turning @conditionals
Scenario: Car - ignores unrecognized restriction
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | only_right_turn @ (has_pygmies > 10 p) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Restriction would be on, but the restriction was badly tagged
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p |
\ |
j
| \
s m
"""
And the ways
| nodes |
| nj |
| js |
| pjm |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | nj | pjm | j | no_left_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
| from | to | route |
| n | m | nj,pjm,pjm |
| s | m | js,pjm,pjm |
@no_turning @conditionals
Scenario: Car - ignores except restriction
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | no |
| jp | no |
And the relations
| type | way:from | way:to | node:via | restriction:conditional | except |
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar |
| restriction | jp | nj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus |
When I route I should get
| from | to | route | # |
| e | s | ej,js,js | |
| e | n | ej,nj,nj | restriction does not apply to cars |
| e | p | ej,jp,jp | |
| p | s | jp,nj,nj,js,js | restriction excepting busses still applies to cars |
@no_turning @conditionals
Scenario: Car - only_right_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,nj,nj,jp,jp |
@no_turning @conditionals
Scenario: Car - No right turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get
| from | to | route | # |
| e | s | ej,js,js | normal turn |
| e | n | ej,js,js,nj,nj | avoids right turn |
| e | p | ej,jp,jp | normal maneuver |
@only_turning @conditionals
Scenario: Car - only_left_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,js,js,jp,jp |
@no_turning @conditionals
Scenario: Car - No left turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Conditional restriction is off
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Conditional restriction is on
Given the extract extra arguments "--parse-conditional-restrictions"
# 10am utc, wed
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the node map
"""
n
p |
\ |
j
| \
s m
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| jp | yes |
| mj | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get
| from | to | route |
| n | p | nj,js,js,jp,jp |
| m | p | mj,jp,jp |
@no_turning @conditionals
Scenario: Car - only_right_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,nj,nj,jp,jp |
@no_turning @conditionals
Scenario: Car - No right turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get
| from | to | route | # |
| e | s | ej,js,js | normal turn |
| e | n | ej,js,js,nj,nj | avoids right turn |
| e | p | ej,jp,jp | normal maneuver |
@only_turning @conditionals
Scenario: Car - only_left_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,js,js,jp,jp |
@no_turning @conditionals
Scenario: Car - No left turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Conditional restriction is off
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Conditional restriction is on
Given the extract extra arguments "--parse-conditional-restrictions"
# 10am utc, wed
Given the contract 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
"""
n
p j e
s
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,jp,jp |
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the node map
"""
n
p |
\ |
j
| \
s m
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| jp | yes |
| mj | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get
| from | to | route |
| n | p | nj,js,js,jp,jp |
| m | p | mj,jp,jp |
# https://www.openstreetmap.org/#map=18/38.91099/-77.00888
@no_turning @conditionals
Scenario: Car - DC North capitol situation, two on one off
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 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 customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493845200"
# """
# a h
# d
# b g
# e
# c f
# """
Given the node locations
| node | lat | lon |
| a | 38.9113 | -77.0091 |
| b | 38.9108 | -77.0091 |
| c | 38.9104 | -77.0091 |
| d | 38.9110 | -77.0096 |
| e | 38.9106 | -77.0086 |
| f | 38.9105 | -77.0090 |
| g | 38.9108 | -77.0090 |
| h | 38.9113 | -77.0090 |
And the ways
| nodes | oneway | name |
| ab | yes | cap south |
| bc | yes | cap south |
| fg | yes | cap north |
| gh | yes | cap north |
| db | no | florida nw |
| bg | no | florida |
| ge | no | florida ne |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | bg | b | no_left_turn @ (Mo-Fr 07:00-09:30,16:00-18:30) |
| restriction | fg | bg | g | no_left_turn @ (Mo-Fr 06:00-10:00) |
| restriction | bg | bc | b | no_left_turn @ (Mo-Fr 07:00-09:30,16:00-18:30) |
When I route I should get
| from | to | route | turns |
| a | e | cap south,florida nw,florida nw,florida ne | depart,turn right,continue uturn,arrive |
| f | d | cap north,florida,florida nw | depart,turn left,arrive |
| e | c | florida ne,florida nw,cap south,cap south | depart,continue uturn,turn right,arrive |
@no_turning @conditionals
Scenario: Car - DC North capitol situation, one on two off
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 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 customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493807400"
# """
# a h
# d
# b g
# e
# c f
# """
Given the node locations
| node | lat | lon |
| a | 38.9113 | -77.0091 |
| b | 38.9108 | -77.0091 |
| c | 38.9104 | -77.0091 |
| d | 38.9110 | -77.0096 |
| e | 38.9106 | -77.0086 |
| f | 38.9105 | -77.0090 |
| g | 38.9108 | -77.0090 |
| h | 38.9113 | -77.0090 |
And the ways
| nodes | oneway | name |
| ab | yes | cap south |
| bc | yes | cap south |
| fg | yes | cap north |
| gh | yes | cap north |
| db | no | florida nw |
| bg | no | florida |
| ge | no | florida ne |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | bg | b | no_left_turn @ (Mo-Fr 07:00-09:30,16:00-18:30) |
| restriction | fg | bg | g | no_left_turn @ (Mo-Fr 06:00-10:00) |
| restriction | bg | bc | b | no_left_turn @ (Mo-Fr 07:00-09:30,16:00-18:30) |
When I route I should get
| from | to | route | turns |
| a | e | cap south,florida,florida ne | depart,turn left,arrive |
| f | d | cap north,florida ne,florida ne,florida nw | depart,turn sharp right,continue uturn,arrive |
| e | c | florida ne,cap south,cap south | depart,turn left,arrive |
@only_turning @conditionals
Scenario: Car - Restriction is always off when point not found in timezone files
# same test as the following one, but given a different time zone file
Given the extract extra arguments "--parse-conditional-restrictions"
# 9am UTC, 10am BST
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493802000"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/dc.geojson --parse-conditionals-from-now=1493802000"
# """
# a
# e
# b
# d
# c
# """
Given the node locations
| node | lat | lon |
| a | 51.5250 | -0.1166 |
| b | 51.5243 | -0.1159 |
| c | 51.5238 | -0.1152 |
| d | 51.5241 | -0.1167 |
| e | 51.5247 | -0.1153 |
And the ways
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | be | b | only_left_turn @ (Mo-Fr 07:00-11:00) |
When I route I should get
| from | to | route | turns |
| a | c | albic,albic | depart,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |
@only_turning @conditionals
Scenario: Car - Somewhere in london, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions"
# 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 customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
# """
# a
# e
# b
# d
# c
# """
Given the node locations
| node | lat | lon |
| a | 51.5250 | -0.1166 |
| b | 51.5243 | -0.1159 |
| c | 51.5238 | -0.1152 |
| d | 51.5241 | -0.1167 |
| e | 51.5247 | -0.1153 |
And the ways
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | be | b | only_left_turn @ (Mo-Fr 07:00-11:00) |
When I route I should get
| from | to | route | turns |
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |
@only_turning @conditionals
Scenario: Car - Somewhere in London, the UK, GMT timezone
Given the extract extra arguments "--parse-conditional-restrictions=1"
# 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 customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/london.geojson --parse-conditionals-from-now=1493802000"
# """
# a
# e
# b
# d
# c
# """
Given the node locations
| node | lat | lon |
| a | 51.5250 | -0.1166 |
| b | 51.5243 | -0.1159 |
| c | 51.5238 | -0.1152 |
| d | 51.5241 | -0.1167 |
| e | 51.5247 | -0.1153 |
And the ways
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ab | be | b | only_left_turn @ (Mo-Fr 07:00-11:00) |
When I route I should get
| from | to | route | turns |
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |
-17
View File
@@ -1,17 +0,0 @@
@routing @car @construction
Feature: Car - all construction tags the OpenStreetMap community could think of and then some
Background:
Given the profile "car"
Scenario: Various ways to tag construction and proposed roads
Then routability should be
| highway | construction | proposed | bothw |
| primary | | | x |
| construction | | | |
| proposed | | | |
| primary | yes | | |
| primary | | yes | |
| primary | no | | x |
| primary | widening | | x |
| primary | minor | | x |
+32 -32
View File
@@ -88,18 +88,18 @@ OSRM will use 4/5 of the projected free-flow speed.
| highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate | | highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 | | primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
| primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 | | primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 |
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 | | primary | 60 | | | | 47 km/h | 47 km/h | 13 | 13 |
| primary | 60 | 3 | | | 47 km/h | 47 km/h | 6.7 | 6.7 | | primary | 60 | 3 | | | 47 km/h | 47 km/h | 7 | 7 |
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 | | primary | | | 60 | | 47 km/h | 64 km/h | 13 | 18 |
| primary | | 3 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 | | primary | | 3 | 60 | | 47 km/h | 64 km/h | 7 | 9 |
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 | | primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13 |
| primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 | | primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 7 |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 | | primary | 15 | | 60 | | 47 km/h | 11 km/h | 13 | 3 |
| primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 | | primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 7 | 2 |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 | | primary | 15 | | | 60 | 12 km/h | 47 km/h | 3 | 13 |
| primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 | | primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 2 | 7 |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 7 | 13 |
| primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 | | primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3 | 7 |
Scenario: Car - Single lane streets be ignored or incur a penalty Scenario: Car - Single lane streets be ignored or incur a penalty
Then routability should be Then routability should be
@@ -107,33 +107,33 @@ OSRM will use 4/5 of the projected free-flow speed.
| highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate | | highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 | | primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
| primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 | | primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 |
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 | | primary | 60 | | | | 47 km/h | 47 km/h | 13 | 13 |
| primary | 60 | 1 | | | 47 km/h | 47 km/h | 6.7 | 6.7 | | primary | 60 | 1 | | | 47 km/h | 47 km/h | 7 | 7 |
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 | | primary | | | 60 | | 47 km/h | 64 km/h | 13 | 18 |
| primary | | 1 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 | | primary | | 1 | 60 | | 47 km/h | 64 km/h | 7 | 9 |
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 | | primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13 |
| primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 | | primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 7 |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 | | primary | 15 | | 60 | | 47 km/h | 11 km/h | 13 | 3 |
| primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 | | primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 7 | 2 |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 | | primary | 15 | | | 60 | 12 km/h | 47 km/h | 3 | 13 |
| primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 | | primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 2 | 7 |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 7 | 13 |
| primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 | | primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3 | 7 |
Scenario: Car - Single lane streets only incur a penalty for two-way streets Scenario: Car - Single lane streets only incur a penalty for two-way streets
Then routability should be Then routability should be
| highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate | | highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate |
| primary | 30 | 1 | yes | 23 km/h | | 6.7 | | | primary | 30 | 1 | yes | 23 km/h | | 7 | |
| primary | 30 | 1 | -1 | | 23 km/h | | 6.7 | | primary | 30 | 1 | -1 | | 23 km/h | | 7 |
| primary | 30 | 1 | | 23 km/h | 23 km/h | 3.3 | 3.3 | | primary | 30 | 1 | | 23 km/h | 23 km/h | 3 | 3 |
| primary | 30 | 2 | | 23 km/h | 23 km/h | 6.7 | 6.7 | | primary | 30 | 2 | | 23 km/h | 23 km/h | 7 | 7 |
Scenario: Car - Forward/backward maxspeed on reverse oneways Scenario: Car - Forward/backward maxspeed on reverse oneways
Then routability should be Then routability should be
| highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate | | highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate |
| primary | | | | -1 | | 64 km/h | | 18 | | primary | | | | -1 | | 64 km/h | | 18 |
| primary | 30 | | | -1 | | 23 km/h | | 6.7 | | primary | 30 | | | -1 | | 23 km/h | | 7 |
| primary | | 30 | | -1 | | 64 km/h | | 18 | | primary | | 30 | | -1 | | 64 km/h | | 18 |
| primary | | | 30 | -1 | | 23 km/h | | 6.7 | | primary | | | 30 | -1 | | 23 km/h | | 7 |
| primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 | | primary | 20 | 30 | | -1 | | 15 km/h | | 4 |
| primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 | | primary | 20 | | 30 | -1 | | 23 km/h | | 7 |
+4 -4
View File
@@ -7,8 +7,8 @@ Feature: Car - Surfaces
Scenario: Car - Ways tagged service should reduce speed Scenario: Car - Ways tagged service should reduce speed
Then routability should be Then routability should be
| highway | service | forw | backw | forw_rate | | highway | service | forw | backw | forw_rate |
| service | alley | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | alley | 15 km/h +-1 | 15 km/h +-1 | 2 |
| service | emergency_access | | | | | service | emergency_access | | | |
| service | driveway | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | driveway | 15 km/h +-1 | 15 km/h +-1 | 2 |
| service | drive-through | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | drive-through | 15 km/h +-1 | 15 km/h +-1 | 2 |
| service | parking | 15 km/h +-1 | 15 km/h +-1 | 2.1 | | service | parking | 15 km/h +-1 | 15 km/h +-1 | 2 |
+1 -1
View File
@@ -50,4 +50,4 @@ Feature: Car - speeds
Then routability should be Then routability should be
| highway | side_road | forw | backw | forw_rate | backw_rate | | highway | side_road | forw | backw | forw_rate | backw_rate |
| primary | yes | 64 km/h | 64 km/h | 14.4 | 14.4 | | primary | yes | 64 km/h | 64 km/h | 14 | 14 |
-37
View File
@@ -1,37 +0,0 @@
@routing @car @startpoint
Feature: Car - Allowed start/end modes
Background:
Given the profile "car"
Scenario: Car - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
Scenario: Car - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
+2 -2
View File
@@ -60,8 +60,8 @@ Feature: Basic Routing
| bc | | 101 | | bc | | 101 |
When I route I should get When I route I should get
| waypoints | route | summary | | waypoints | route | summary |
| a,c | road,, | road, 101 | | a,c | road, | road, 101 |
Scenario: Only Refs Scenario: Only Refs
Given the node map Given the node map
@@ -1,39 +0,0 @@
@routing @car @traffic_light
Feature: Car - Handle traffic lights
Background:
Given the profile "car"
Scenario: Car - Encounters a traffic light
Given the node map
"""
a-1-b-2-c
d-3-e-4-f
g-h-i k-l-m
| |
j n
"""
And the ways
| nodes | highway |
| abc | primary |
| def | primary |
| ghi | primary |
| klm | primary |
| hj | primary |
| ln | primary |
And the nodes
| node | highway |
| e | traffic_signals |
| l | traffic_signals |
When I route I should get
| from | to | time | # |
| 1 | 2 | 11.1s | no turn with no traffic light |
| 3 | 4 | 13.1s | no turn with traffic light |
| g | j | 18.7s | turn with no traffic light |
| k | n | 20.7s | turn with traffic light |
@@ -48,6 +48,7 @@ Feature: Traffic - turn penalties
| mn | primary | | mn | primary |
| mp | primary | | mp | primary |
And the profile "car" And the profile "car"
And the extract extra arguments "--generate-edge-lookup"
Scenario: Weighting not based on turn penalty file Scenario: Weighting not based on turn penalty file
When I route I should get When I route I should get
-33
View File
@@ -1,33 +0,0 @@
@routing @via
Feature: Via points
Background:
Given the profile "car"
# See issue #1896
Scenario: Via point at a dead end with barrier
Given the profile "car"
Given the node map
"""
a b c
1
d
f e
"""
And the nodes
| node | barrier |
| d | bollard |
And the ways
| nodes |
| abc |
| bd |
| afed |
When I route I should get
| waypoints | route |
| a,1,c | abc,bd,bd,bd,bd,abc,abc |
| c,1,a | abc,bd,bd,bd,bd,abc,abc |
+1 -25
View File
@@ -51,6 +51,7 @@ Feature: Car - weights
| cd | primary | yes | | cd | primary | yes |
| be | service | yes | | be | service | yes |
| ec | service | yes | | ec | service | yes |
And the extract extra arguments "--generate-edge-lookup"
And the contract extra arguments "--segment-speed-file {speeds_file}" And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}" And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file And the speed file
@@ -61,28 +62,3 @@ Feature: Car - weights
| 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 | 112 | | a | e | ab,be,be | 14 km/h | 112 |
Scenario: Distance weights
Given the profile file "car" extended with
"""
api_version = 1
properties.weight_name = 'distance'
"""
Given the node map
"""
a---b---c
|
d
"""
And the ways
| nodes |
| abc |
| bd |
When I route I should get
| waypoints | bearings | route | distance | weights | times |
| a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
| b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
| a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s |
-37
View File
@@ -1,37 +0,0 @@
@routing @foot @startpoint
Feature: Foot - Allowed start/end modes
Background:
Given the profile "foot"
Scenario: Foot - Don't start/stop on ferries
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | route | bicycle |
| ab | primary | | |
| bc | | ferry | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | walking,walking |
| 2 | 1 | ab,ab | walking,walking |
Scenario: Foot - Don't start/stop on trains
Given the node map
"""
a 1 b 2 c
"""
And the ways
| nodes | highway | railway | bicycle |
| ab | primary | | |
| bc | | train | yes |
When I route I should get
| from | to | route | modes |
| 1 | 2 | ab,ab | walking,walking |
| 2 | 1 | ab,ab | walking,walking |
+14 -14
View File
@@ -35,10 +35,10 @@ Feature: Turn Lane Guidance
| restriction | bc | cd | c | no_right_turn | | restriction | bc | cd | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false, | | a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true, | | a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,continue right,arrive | ,;right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
@sliproads @sliproads
Scenario: Separate Turn Lanes Scenario: Separate Turn Lanes
@@ -68,10 +68,10 @@ Feature: Turn Lane Guidance
| restriction | bc | cd | c | no_right_turn | | restriction | bc | cd | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false right:false, | | a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true right:false, | | a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true;left:false straight:false right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
@sliproads @sliproads
@@ -109,12 +109,12 @@ Feature: Turn Lane Guidance
| restriction | bc | cd | c | no_right_turn | | restriction | bc | cd | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false right:false, | | a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true right:false, | | a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true;left:false straight:false right:true, | | a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
| a,j | in,turn,other,other | depart,turn right,turn left,arrive | ,,left:true right:false, | | a,j | in,turn,other,other | depart,turn right,turn left,arrive | ,,left:true right:false, |
| a,i | in,turn,other,other | depart,turn right,turn right,arrive | ,,left:false right:true, | | a,i | in,turn,other,other | depart,turn right,turn right,arrive | ,,left:false right:true, |
@todo @2654 @none @todo @2654 @none
+86 -48
View File
@@ -3,7 +3,7 @@ Feature: Turn Lane Guidance
Background: Background:
Given the profile "car" Given the profile "car"
Given a grid size of 100 meters Given a grid size of 20 meters
@anticipate @anticipate
Scenario: Anticipate Lane Change for subsequent multi-lane intersections Scenario: Anticipate Lane Change for subsequent multi-lane intersections
@@ -151,9 +151,9 @@ Feature: Turn Lane Guidance
| cj | | 1 | motorway_link | yes | xbcj | | cj | | 1 | motorway_link | yes | xbcj |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,i | ab,ci,ci | depart,turn slight right,arrive | ;,none:false slight right:true, | | a,i | ab,ci,ci | depart,turn slight right,arrive | ,none:false slight right:true, |
| a,j | ab,xbcj | depart,arrive | ;;none:true slight right:false, | | a,j | ab,xbcj | depart,arrive | , |
@anticipate @anticipate
@@ -308,8 +308,8 @@ Feature: Turn Lane Guidance
| di | | off | | yes | | di | | off | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | destinations | locations | lanes | | waypoints | route | turns | destinations | lanes | locations |
| a,e | main,main | depart,arrive | One,Three | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, | | a,e | main,main,main | depart,use lane straight,arrive | One,Two,Three | ,left:false straight:false straight:true straight:false right:false, | a,c,e |
@anticipate @anticipate
Scenario: Anticipate Lanes for through and collapse multiple use lanes Scenario: Anticipate Lanes for through and collapse multiple use lanes
@@ -335,9 +335,9 @@ Feature: Turn Lane Guidance
| dj | | off | | dj | | off |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,c | main,main | depart,arrive | ;left:false straight:true straight:true right:false, | | a,c | main,main | depart,arrive | , |
| a,d | main,main | depart,arrive | ;left:false straight:true straight:true right:false;left:false straight:true straight:true right:false, | | a,d | main,main | depart,arrive | , |
@anticipate @anticipate
Scenario: Anticipate Lanes for through followed by left/right Scenario: Anticipate Lanes for through followed by left/right
@@ -363,17 +363,17 @@ Feature: Turn Lane Guidance
| ci | | off | | ci | | off |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:false straight:true straight:false straight:false right:false;left:false straight:true straight:false right:false,left:true right:false, | | a,d | main,main,main,left,left | depart,use lane straight,use lane straight,turn left,arrive | ,left:false straight:false straight:true straight:false straight:false right:false,left:false straight:true straight:false right:false,left:true right:false, |
| a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:false straight:false straight:true straight:false right:false;left:false straight:false straight:true right:false,left:false right:true, | | a,e | main,main,main,right,right | depart,use lane straight,use lane straight,turn right,arrive | ,left:false straight:false straight:false straight:true straight:false right:false,left:false straight:false straight:true right:false,left:false right:true, |
@anticipate @anticipate
Scenario: Anticipate Lanes for through with turn before / after Scenario: Anticipate Lanes for through with turn before / after
Given the node map Given the node map
""" """
c g l c g l
b d e h i b d e h - i
a f j a f j
""" """
And the ways And the ways
@@ -390,15 +390,15 @@ Feature: Turn Lane Guidance
| il | | il | | | il | | il | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | # | | waypoints | route | turns | lanes | # |
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | | a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | | a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:false right:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | | | a,j | ab,bdehi,bdehi,ij,ij | depart,turn right,use lane straight,turn right,arrive | ,right:true right:true right:false right:false,left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
| a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:false right:false right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect | | a,l | ab,bdehi,bdehi,il,il | depart,turn right,use lane straight,turn left,arrive | ,right:false right:false right:true right:true,left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | | c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | | c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:false left:false left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | | | c,l | cb,bdehi,bdehi,il,il | depart,turn left,use lane straight,turn left,arrive | ,left:false left:false left:true left:true,left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
| c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:false left:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect | | c,j | cb,bdehi,bdehi,ij,ij | depart,turn left,use lane straight,turn right,arrive | ,left:true left:true left:false left:false,left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
@anticipate @anticipate
Scenario: Anticipate Lanes for turns with through before and after Scenario: Anticipate Lanes for turns with through before and after
@@ -431,11 +431,11 @@ Feature: Turn Lane Guidance
| jk | | bot | primary | yes | | jk | | bot | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,i | top,main,top,top | depart,turn right,turn left,arrive | ,straight:false right:true right:true right:true;;left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, | | a,i | top,main,main,top,top | depart,turn right,use lane straight,turn left,arrive | ,straight:false right:false right:true right:true,left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| a,k | top,main,bot,bot | depart,turn right,turn right,arrive | ,straight:false right:true right:true right:true;;left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, | | a,k | top,main,main,bot,bot | depart,turn right,use lane straight,turn right,arrive | ,straight:false right:true right:true right:false,left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
| c,i | bot,main,top,top | depart,turn left,turn left,arrive | ,left:true left:true left:true straight:false;;left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, | | c,i | bot,main,main,top,top | depart,turn left,use lane straight,turn left,arrive | ,left:false left:true left:true straight:false,left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| c,k | bot,main,bot,bot | depart,turn left,turn right,arrive | ,left:true left:true left:true straight:false;;left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, | | c,k | bot,main,main,bot,bot | depart,turn left,use lane straight,turn right,arrive | ,left:true left:true left:false straight:false,left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
@anticipate @anticipate
Scenario: Anticipate Lanes for turn between throughs Scenario: Anticipate Lanes for turn between throughs
@@ -462,8 +462,8 @@ Feature: Turn Lane Guidance
| dt | | off | | dt | | off |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | main,main,main | depart,continue right,arrive | ;left:false straight:false straight:false straight:false straight:true straight:true right:false,straight:false straight:false right:false right:true right:true;left:false straight:true straight:true, | | a,e | main,main,main,main | depart,use lane straight,continue right,arrive | ,left:false straight:false straight:false straight:false straight:true straight:true right:false,straight:false straight:false right:false right:true right:true, |
@anticipate @todo @2661 @anticipate @todo @2661
Scenario: Anticipate with lanes in roundabout: roundabouts as the unit of anticipation Scenario: Anticipate with lanes in roundabout: roundabouts as the unit of anticipation
@@ -520,8 +520,8 @@ Feature: Turn Lane Guidance
| df | | primary | | | df | | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | intersection_lanes | | waypoints | route | turns | lanes |
| a,f | ab,df,df | depart,roundabout-exit-1,arrive | ,, | | | a,f | ab,df,df | depart,roundabout-exit-1,use lane slight right,arrive | ,,slight left:false slight left:false slight right:true, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@@ -553,8 +553,8 @@ Feature: Turn Lane Guidance
| fy | | primary | | | fy | | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | ab,gh,gh | depart,roundabout-exit-5,arrive | ,;;;;;, | | a,h | ab,gh,gh | depart,roundabout-exit-5,arrive | ,, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@@ -576,9 +576,9 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,;, | | x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,, |
| x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, | | x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,;, | | x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@@ -614,8 +614,8 @@ Feature: Turn Lane Guidance
| fy | | primary | | | fy | | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | ab,ch,ch | depart,roundabout-exit-5,arrive | ,;;;;;, | | a,h | ab,ch,ch | depart,roundabout-exit-5,arrive | ,, |
@anticipate @anticipate
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@@ -623,11 +623,40 @@ Feature: Turn Lane Guidance
""" """
/a\ /a\
x b d y x b d y
| |
| |
| |
| |
| |
| |
| |
| |
| | | |
| | | |
| | | |
| | | |
\ / | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
|
|
|
|
|
|
|
|
c c
""" """
@@ -642,9 +671,9 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,;, | | x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,, |
| x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, | | x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,;, | | x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
@anticipate @todo @2032 @anticipate @todo @2032
Scenario: No Lanes for Roundabouts, see #2626 Scenario: No Lanes for Roundabouts, see #2626
@@ -760,6 +789,13 @@ Feature: Turn Lane Guidance
Given the node map Given the node map
""" """
a b x a b x
|
|
|
|
|
|
|
| |
| |
| |
@@ -787,9 +823,11 @@ Feature: Turn Lane Guidance
Scenario: Don't Overdo It Scenario: Don't Overdo It
Given the node map Given the node map
""" """
q r s t u v q r s t u v
a - - b - - c - - d - - e - - f - g - h - i | | | | | |
p o n m l k j a - - - - - - - - - - b - - - - - - - - - - c - - - - - - - - - - d - - - - - - - - - - e - - - - - - - - - - f - - - - - - - - - - g - h - i
| | | | | | |
p o n m l k j
""" """
And the ways And the ways
@@ -811,6 +849,6 @@ Feature: Turn Lane Guidance
| hj | 7th | | no | | hj | 7th | | no |
When I route I should get When I route I should get
| waypoints | route | turns | locations | lanes | | waypoints | route | turns | locations | lanes |
| a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:false;none:true none:true right:false, | | a,i | road,road,road | depart,use lane straight,arrive | a,g,i | ,left:false none:true none:true none:false, |
| a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true;left:false none:false none:false none:true,none:false none:false right:true, | | a,j | road,road,7th,7th | depart,use lane straight,turn right,arrive | a,f,h,j | ,left:false none:false none:false none:true,none:false none:false right:true, |
+11 -66
View File
@@ -359,7 +359,7 @@ Feature: Collapse
| a,g | first,second,second | depart,turn left,arrive | a,b,g | | a,g | first,second,second | depart,turn left,arrive | a,b,g |
| d,g | first,second,second | depart,turn right,arrive | d,e,g | | d,g | first,second,second | depart,turn right,arrive | d,e,g |
| g,f | second,first,first | depart,turn right,arrive | g,e,f | | g,f | second,first,first | depart,turn right,arrive | g,e,f |
| g,c | second,first,first | depart,turn left,arrive | g,e,c | | g,c | second,first,first | depart,end of road left,arrive | g,b,c |
Scenario: Do not collapse turning roads Scenario: Do not collapse turning roads
Given the node map Given the node map
@@ -690,9 +690,9 @@ Feature: Collapse
| restriction | bc | dc | c | no_right_turn | | restriction | bc | dc | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations |
| a,g | road,road,cross,cross | depart,continue slight left,turn left,arrive | a,b,c,g | | a,g | road,cross,cross | depart,turn left,arrive | a,b,g |
| a,e | road,road | depart,arrive | a,e | | a,e | road,road | depart,arrive | a,e |
Scenario: On-Off on Highway Scenario: On-Off on Highway
Given the node map Given the node map
@@ -807,8 +807,8 @@ Feature: Collapse
| di | | off | | di | | off |
When I route I should get When I route I should get
| waypoints | route | turns | locations | lanes | | waypoints | route | turns | locations |
| a,e | main,main | depart,arrive | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, | | a,e | main,main,main | depart,use lane straight,arrive | a,c,e |
Scenario: But _do_ collapse UseLane step when lanes stay the same Scenario: But _do_ collapse UseLane step when lanes stay the same
Given the node map Given the node map
@@ -996,8 +996,8 @@ Feature: Collapse
a . . b .' a . . b .'
` d. ` d.
f e f e
""" """
#Check collapse.detail for a similar case (shorter) that does not classify these turns as a sliproad anymore #Check collapse.detail for a similar case (shorter) that does not classify these turns as a sliproad anymore
And the ways And the ways
| nodes | name | oneway | highway | | nodes | name | oneway | highway |
@@ -1016,61 +1016,6 @@ Feature: Collapse
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations |
| a,g | road,road,cross,cross | depart,fork slight left,turn left,arrive | a,b,c,g | | a,g | road,cross,cross | depart,fork left,arrive | a,b,g |
| a,e | road,road,road | depart,fork slight right,arrive | a,b,e | | a,e | road,road,road | depart,fork slight right,arrive | a,b,e |
| a,f | road,road,cross,cross | depart,fork slight right,turn right,arrive | a,b,d,f | | a,f | road,road,cross,cross | depart,fork slight right,turn right,arrive | a,b,d,f |
# http://www.openstreetmap.org/way/92415447 #3933
Scenario: Use total angle for turn instruction if entry step has large distance
# """
# kf-_ a
# | - b
# | c
# |d
# e
# |
# i
# """
And the node locations
| node | lat | lon | #id |
| a | -33.9644254 | 151.1378673 | 33226063 |
| b | -33.9644373 | 151.1377172 | 1072787030 |
| c | -33.9644791 | 151.1374452 | 4222903609 |
| d | -33.9645661 | 151.1372654 | 4222903610 |
| e | -33.9646986 | 151.1371539 | 4222903611 |
| f | -33.964386 | 151.1372133 | 1072786875 |
| i | -33.9661796 | 151.1368491 | 2781176918 |
| k | -33.9643781 | 151.1371422 | 1684173853 |
And the ways
| nodes | highway | name | oneway | #id |
| ab | trunk | President Avenue | yes | 92415447 |
| bcde | trunk | President Avenue | yes | 422534457 |
| bf | trunk | President Avenue | yes | 447779786 |
| fk | trunk | President Avenue | yes | 179293012 |
| fei | trunk | Princes Highway | yes | 130099670 |
When I route I should get
| waypoints | route | turns | locations |
| a,i | President Avenue,Princes Highway,Princes Highway | depart,turn left,arrive | a,b,i |
Scenario: Don't combine uturns
Given the node map
"""
2 d
a - - b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - c
1
"""
And the ways
| nodes | highway |
| ab | tertiary |
| bc | tertiary |
| bd | service |
When I route I should get
| 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,_ |
-48
View File
@@ -1,48 +0,0 @@
@driveway @guidance
Feature: Driveways intersections
Background:
Given the profile "car"
Given a grid size of 5 meters
Scenario: Road with a turn to service road
Given the node map
"""
a
~.
b----c----d
|
e
"""
And the ways
| nodes | highway | name | oneway |
| abc | trunk | first | yes |
| cd | trunk | second | yes |
| be | service | parking | yes |
When I route I should get
| waypoints | route | turns | locations |
| a,d | first,second | depart,arrive | a,d |
Scenario: Turn Instead of Ramp
Given the node map
"""
a
~.
b----c----d
|
e
"""
And the ways
| nodes | highway | name | oneway |
| ab | trunk | | yes |
| bc | trunk | | yes |
| cd | trunk | second | yes |
| be | service | parking | yes |
When I route I should get
| waypoints | route | turns | locations |
| a,d | ,second | depart,arrive | a,d |
@@ -1,98 +0,0 @@
@routing @guidance
Feature: Exit Numbers and Names
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Exit number on the way after the motorway junction
Given the node map
"""
a . . b . c . . d
` e . . f
"""
And the nodes
| node | highway |
| b | motorway_junction |
And the ways
| nodes | highway | name | junction:ref |
| abcd | motorway | MainRoad | |
| be | motorway_link | ExitRamp | 3 |
| ef | motorway_link | ExitRamp | |
When I route I should get
| waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,3, |
Scenario: Exit number on the way, motorway junction node tag missing, multiple numbers
Given the node map
"""
a . . b . c . . d
` e . . f
"""
And the ways
| nodes | highway | name | junction:ref |
| abcd | motorway | MainRoad | |
| be | motorway_link | ExitRamp | 10;12 |
| ef | motorway_link | ExitRamp | |
When I route I should get
| waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10; 12, |
Scenario: Exit number on the ways after the motorway junction, multiple exits
Given the node map
"""
a . . b . c . . d
` e . . f
` g . . h
"""
And the nodes
| node | highway |
| b | motorway_junction |
And the ways
| nodes | highway | name | junction:ref |
| abcd | motorway | MainRoad | |
| be | motorway_link | ExitRamp | 3 |
| ef | motorway_link | ExitRamp | |
| bg | motorway_link | ExitRamp | 3 |
| gh | motorway_link | ExitRamp | |
When I route I should get
| waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,3, |
| a,h | MainRoad,ExitRamp,ExitRamp | depart,off ramp right,arrive | ,3, |
# http://www.openstreetmap.org/way/417524818#map=17/37.38663/-121.97972
Scenario: Exit 393 on Bayshore Freeway
Given the node map
"""
a
` b
` c
. ` d
f ` e
"""
And the nodes
| node | highway |
| c | motorway_junction |
And the ways
| nodes | highway | name | junction:ref | oneway | destination |
| abcde | motorway | Bayshore Freeway | | yes | |
| cf | motorway_link | | 393 | yes | Great America Parkway;Bowers Avenue |
When I route I should get
| waypoints | route | turns | exits | destinations |
| a,e | Bayshore Freeway,Bayshore Freeway | depart,arrive | , | , |
| a,f | Bayshore Freeway,, | depart,off ramp slight right,arrive | ,393,393 | ,Great America Parkway, Bowers Avenue,Great America Parkway, Bowers Avenue |
-20
View File
@@ -261,23 +261,3 @@ Feature: Motorway Guidance
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | | a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive |
#http://0.0.0.0:9966/?z=18&center=38.893323%2C-77.055117&loc=38.893551%2C-77.054833&loc=38.893112%2C-77.055536&hl=en&alt=0
Scenario: Merging with same name
Given the node map
"""
a - - -
> c - d
b
"""
And the ways
| nodes | name | ref | highway | oneway |
| ac | | US 50 | motorway | yes |
| bc | | I 66 | motorway | yes |
| cd | | US 50; I 66 | motorway | yes |
When I route I should get
| waypoints | route | turns |
| a,d | , | depart,arrive |
| b,d | , | depart,arrive |
@@ -37,37 +37,3 @@ Feature: Basic Roundabout
| h,a | gh,ab,ab | depart,roundabout turn left exit-3,arrive | | h,a | gh,ab,ab | depart,roundabout turn left exit-3,arrive |
| h,d | gh,cd,cd | depart,roundabout turn straight exit-2,arrive | | h,d | gh,cd,cd | depart,roundabout turn straight exit-2,arrive |
| h,f | gh,ef,ef | depart,roundabout turn right exit-1,arrive | | h,f | gh,ef,ef | depart,roundabout turn right exit-1,arrive |
# https://www.openstreetmap.org/way/223225602
Scenario: Enter and Exit with changing mode
Given the node map
"""
a
b
h g c d
e
f
"""
And the ways
| nodes | junction | highway |
| ab | | residential |
| cd | | residential |
| ef | | footway |
| gh | | footway |
| bgecb | roundabout | residential |
When I route I should get
| waypoints | route | turns |
| a,d | ab,cd,cd | depart,roundabout turn left exit-1,arrive |
| a,f | ab,ef,ef,ef | depart,roundabout turn left exit-1,notification right,arrive |
| a,h | ab,bgecb,gh,gh | depart,roundabout turn right exit-1,notification right,arrive |
| d,f | cd,ef,ef,ef | depart,roundabout turn sharp left exit-2,notification right,arrive |
| d,h | cd,gh,gh,gh | depart,roundabout turn left exit-2,notification right,arrive |
| d,a | cd,ab,ab | depart,roundabout turn right exit-1,arrive |
| f,h | ef,gh,gh,gh | depart,roundabout turn sharp left exit-3,notification right,arrive |
| f,a | ef,ab,ab | depart,roundabout turn straight exit-2,arrive |
| f,d | ef,cd,cd | depart,roundabout turn right exit-1,arrive |
| h,a | gh,ab,ab | depart,roundabout turn left exit-2,arrive |
| h,d | gh,cd,cd | depart,roundabout turn straight exit-1,arrive |
| h,f | gh,bgecb,ef,ef | depart,roundabout turn right exit-1,notification right,arrive |
+13 -178
View File
@@ -222,43 +222,6 @@ Feature: Basic Roundabout
| j,f | jkl,def,def | depart,roundabout-exit-2,arrive | | j,f | jkl,def,def | depart,roundabout-exit-2,arrive |
| j,c | jkl,abc,abc | depart,roundabout-exit-3,arrive | | j,c | jkl,abc,abc | depart,roundabout-exit-3,arrive |
Scenario: Mixed Entry and Exit - clockwise order
Given the node map
"""
c a
j b f
k e
l h d
g i
"""
And the ways
| nodes | junction | oneway |
| abc | | yes |
| def | | yes |
| ghi | | yes |
| jkl | | yes |
| behkb | roundabout | yes |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,roundabout-exit-4,arrive |
| a,l | abc,jkl,jkl | depart,roundabout-exit-3,arrive |
| a,i | abc,ghi,ghi | depart,roundabout-exit-2,arrive |
| a,f | abc,def,def | depart,roundabout-exit-1,arrive |
| d,f | def,def,def | depart,roundabout-exit-4,arrive |
| d,c | def,abc,abc | depart,roundabout-exit-3,arrive |
| d,l | def,jkl,jkl | depart,roundabout-exit-2,arrive |
| d,i | def,ghi,ghi | depart,roundabout-exit-1,arrive |
| g,i | ghi,ghi,ghi | depart,roundabout-exit-4,arrive |
| g,f | ghi,def,def | depart,roundabout-exit-3,arrive |
| g,c | ghi,abc,abc | depart,roundabout-exit-2,arrive |
| g,l | ghi,jkl,jkl | depart,roundabout-exit-1,arrive |
| j,l | jkl,jkl,jkl | depart,roundabout-exit-4,arrive |
| j,i | jkl,ghi,ghi | depart,roundabout-exit-3,arrive |
| j,f | jkl,def,def | depart,roundabout-exit-2,arrive |
| j,c | jkl,abc,abc | depart,roundabout-exit-1,arrive |
Scenario: Mixed Entry and Exit - segregated roads, different names Scenario: Mixed Entry and Exit - segregated roads, different names
Given the node map Given the node map
""" """
@@ -606,11 +569,11 @@ Feature: Basic Roundabout
| ob | trunk | yes | roundabout | Europaplatz | | | ob | trunk | yes | roundabout | Europaplatz | |
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns | lanes |
| a,d | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-1,arrive | | a,d | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-1,arrive | ,, |
| a,h | ,Allee Cite,Allee Cite | depart,Europaplatz-exit-2,arrive | | a,h | ,Allee Cite,Allee Cite | depart,Europaplatz-exit-2,arrive | ,, |
| a,l | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-3,arrive | | a,l | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-3,arrive | ,, |
| a,p | ,, | depart,Europaplatz-exit-4,arrive | | a,p | ,, | depart,Europaplatz-exit-4,arrive | ,, |
@turboroundabout @turboroundabout
# http://www.openstreetmap.org/?mlat=50.180039&mlon=8.474939&zoom=16#map=19/50.17999/8.47506 # http://www.openstreetmap.org/?mlat=50.180039&mlon=8.474939&zoom=16#map=19/50.17999/8.47506
@@ -658,14 +621,14 @@ Feature: Basic Roundabout
| wb | primary | yes | roundabout | | through\|through;right | | wb | primary | yes | roundabout | | through\|through;right |
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns | lanes |
| a,w | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-undefined,arrive | | a,w | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-undefined,arrive | ,, |
| a,r | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-4,arrive | | a,r | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-4,arrive | ,, |
| a,f | Le-Cannet-Rocheville-Strasse,Frankfurter Strasse,Frankfurter Strasse | depart,roundabout-exit-1,arrive | | a,f | Le-Cannet-Rocheville-Strasse,Frankfurter Strasse,Frankfurter Strasse | depart,roundabout-exit-1,arrive | ,, |
| a,h | Le-Cannet-Rocheville-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-2,arrive | | a,h | Le-Cannet-Rocheville-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-2,arrive | ,, |
| u,r | ,, | depart,roundabout-exit-5,arrive | | u,r | ,, | depart,roundabout-exit-5,arrive | ,, |
| j,h | Bischof-Kaller-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-5,arrive | | j,h | Bischof-Kaller-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-5,arrive | ,, |
| n,m | , | depart,arrive | | n,m | , | depart,arrive | , |
@turboroundabout @turboroundabout
# http://www.openstreetmap.org/?mlat=47.57723&mlon=7.796765&zoom=16#map=19/47.57720/7.79711 # http://www.openstreetmap.org/?mlat=47.57723&mlon=7.796765&zoom=16#map=19/47.57720/7.79711
@@ -718,131 +681,3 @@ Feature: Basic Roundabout
| u,r | ug,ar,ar | depart,roundabout-exit-3,arrive | | u,r | ug,ar,ar | depart,roundabout-exit-3,arrive |
| u,s | ug,ds,ds | depart,roundabout-exit-4,arrive | | u,s | ug,ds,ds | depart,roundabout-exit-4,arrive |
| u,t | ug,ft,ft | depart,roundabout-exit-5,arrive | | u,t | ug,ft,ft | depart,roundabout-exit-5,arrive |
@3762
Scenario: Only Enter
Given the node map
"""
a
b
i c e ~ ~ ~ f - h
j d
k g
"""
And the ways
| nodes | junction | route |
| ab | | |
| ef | | ferry |
| fh | | |
| dg | | |
| ic | | |
| jk | | |
| bcjdeb | roundabout | |
When I route I should get
| waypoints | route | turns |
| a,h | ab,ef,ef,fh,fh | depart,roundabout-exit-4,notification slight right,notification straight,arrive |
Scenario: Drive through roundabout
Given the node map
"""
a
b e d f
c
g h
"""
And the ways
| nodes | junction | oneway |
| abcda | roundabout | yes |
| edf | | |
| gch | | yes |
When I route I should get
| waypoints | bearings | route | turns |
| e,f | 90 90 | edf,edf,edf | depart,roundabout-exit-1,arrive |
| e,h | 90 135 | edf,gch,gch | depart,roundabout-exit-2,arrive |
| g,f | 45 90 | gch,edf,edf | depart,roundabout-exit-2,arrive |
| g,h | 45 135 | gch,gch,gch | depart,roundabout-exit-1,arrive |
| e,e | 90 270 | edf,edf,edf | depart,roundabout-exit-3,arrive |
Scenario: CCW and CW roundabouts with overlaps
Given the node map
"""
a d g h
b c j i
f e k l
"""
And the ways
| nodes | highway | junction |
| abcda | tertiary | roundabout |
| ed | tertiary | |
| af | tertiary | |
| ghijg | tertiary | roundabout |
| kg | tertiary | |
| hl | tertiary | |
When I route I should get
| from | to | route | turns | distance |
| e | f | ed,af,af | depart,roundabout-exit-1,arrive | 80.1m |
| f | e | af,ed,ed | depart,roundabout-exit-1,arrive | 120.1m |
| k | l | kg,hl,hl | depart,roundabout-exit-1,arrive | 80.1m |
| l | k | hl,kg,kg | depart,roundabout-exit-1,arrive | 120.1m |
@4030 @4075
Scenario: Service roundabout with service exits
Given the node map
"""
g a d f
h b1c e
"""
And the ways
| nodes | highway | junction |
| abcda | service | roundabout |
| ce | service | |
| df | service | |
| ag | tertiary | |
| bh | service | |
When I route I should get
| from | to | route | turns |
| 1 | e | abcda,ce,ce | depart,roundabout-exit-1,arrive |
| 1 | f | abcda,df,df | depart,roundabout-exit-2,arrive |
| 1 | g | abcda,ag,ag | depart,roundabout-exit-3,arrive |
| 1 | h | abcda,bh,bh | depart,roundabout-exit-4,arrive |
Scenario: Collapsing a sliproad step after roundabouts
Given the node map
"""
a r j
eb1ds ufghl
`i
c t
m v k
"""
And the ways
| nodes | highway | junction | oneway | # |
| abcda | tertiary | roundabout | | circle |
| ebds | tertiary | | | road |
| cm | tertiary | | | |
| ds | tertiary | | | road |
| rstur | tertiary | roundabout | | circle2 |
| ufghl | tertiary | | | road |
| tv | tertiary | | | |
| gi | tertiary | | yes | sliproad |
| jhik | tertiary | | | crossroad |
When I route I should get
| from | to | route | turns | distance |
| e | k | ebds,ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rotary-exit-1,rstur-exit-2,turn right,arrive | 189.1m |
| 1 | k | ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rstur-exit-2,turn right,arrive | 159.1m |
+10 -83
View File
@@ -201,14 +201,14 @@ Feature: Simple Turns
| ef | residential | road | 2 | yes | | ef | residential | road | 2 | yes |
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations |
| a,c | road,road | depart,arrive | a,c | | a,c | road,road | depart,arrive | a,c |
| c,a | road,road | depart,arrive | c,a | | c,a | road,road | depart,arrive | c,a |
| g,a | turn,road,road | depart,turn left,arrive | g,b,a | | g,a | turn,road,road | depart,turn left,arrive | g,b,a |
| g,c | turn,road,road | depart,turn right,arrive | g,b,c | | g,c | turn,road,road | depart,turn right,arrive | g,b,c |
| g,f | turn,road,road | depart,end of road left,arrive | g,e,f | | g,f | turn,road,road | depart,turn left,arrive | g,e,f |
| c,f | road,road,road | depart,turn right,arrive | c,b,f | | c,f | road,road,road | depart,continue right,arrive | c,b,f |
| a,f | road,road,road | depart,continue uturn,arrive | a,b,f | | a,f | road,road,road | depart,continue uturn,arrive | a,b,f |
# http://www.openstreetmap.org/#map=19/52.48753/13.52838 # http://www.openstreetmap.org/#map=19/52.48753/13.52838
Scenario: Traffic Circle Scenario: Traffic Circle
@@ -1312,8 +1312,8 @@ Feature: Simple Turns
# we don't care for turn instructions, this is a coordinate extraction bug check # we don't care for turn instructions, this is a coordinate extraction bug check
When I route I should get When I route I should get
| waypoints | route | intersections | | waypoints | route | intersections |
| a,g | ab,bcdefgh,bcdefgh | true:90;true:45 false:180 false:270;true:180 | | a,g | ab,bcdefgh | true:90,true:45 false:180 false:270;true:180 |
#https://github.com/Project-OSRM/osrm-backend/pull/3469#issuecomment-270806580 #https://github.com/Project-OSRM/osrm-backend/pull/3469#issuecomment-270806580
Scenario: Oszillating Lower Priority Road Scenario: Oszillating Lower Priority Road
@@ -1371,76 +1371,3 @@ Feature: Simple Turns
When I route I should get When I route I should get
| waypoints | route | | waypoints | route |
| g,e | abcde,abcde | | g,e | abcde,abcde |
# 4205
# https://www.openstreetmap.org/node/36153635#map=19/51.97548/7.61795
Scenario: merging onto a through street
Given the node map
"""
e
`
`
`
`
d
c
a - - - - - - - b``
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
f
"""
And the ways
| nodes | oneway | name |
| abc | yes | fww |
| fcde | no | jahn |
When I route I should get
| waypoints | route | turns |
| a,f | fww,jahn,jahn | depart,turn right,arrive |
| a,e | fww,jahn,jahn | depart,turn left,arrive |
+74 -103
View File
@@ -134,7 +134,7 @@ Feature: Turn Lane Guidance
| a | c | 180,180 180,180 | in,straight,straight | depart,new name straight,arrive | ,left;uturn:false straight;right:true, | a,b,c | | a | c | 180,180 180,180 | in,straight,straight | depart,new name straight,arrive | ,left;uturn:false straight;right:true, | a,b,c |
| a | d | 180,180 180,180 | in,right,right | depart,turn right,arrive | ,left;uturn:false straight;right:true, | a,b,d | | a | d | 180,180 180,180 | in,right,right | depart,turn right,arrive | ,left;uturn:false straight;right:true, | a,b,d |
| a | e | 180,180 180,180 | in,left,left | depart,turn left,arrive | ,left;uturn:true straight;right:false, | a,b,e | | a | e | 180,180 180,180 | in,left,left | depart,turn left,arrive | ,left;uturn:true straight;right:false, | a,b,e |
| 1 | a | 90,2 270,2 | in,in,in | depart,continue uturn,arrive | ,left;uturn:true straight;right:false, | _,b,a | | 1 | a | 90,2 270,2 | in,in,in | depart,turn uturn,arrive | ,left;uturn:true straight;right:false, | _,b,a |
#this next test requires decision on how to announce lanes for going straight if there is no turn #this next test requires decision on how to announce lanes for going straight if there is no turn
@@ -156,7 +156,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, | | a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, |
| a,c | road,road | depart,arrive | ;straight:true right:false, | | a,c | road,road | depart,arrive | , |
Scenario: Turn with Bus-Lane Left Scenario: Turn with Bus-Lane Left
Given the node map Given the node map
@@ -178,7 +178,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, | | a,d | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, |
| a,c | road,road | depart,arrive | ;left:false straight:true, | | a,c | road,road | depart,arrive | , |
# This tests whether empty/invalid PSV tags cause osrm-extract to crash # This tests whether empty/invalid PSV tags cause osrm-extract to crash
Scenario: Turn with Bus-Lane Scenario: Turn with Bus-Lane
@@ -248,23 +248,23 @@ Feature: Turn Lane Guidance
| fl | cross | | yes | | fl | cross | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | intersection_lanes | | waypoints | route | turns | lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true | ,left:false straight:false right:true | | a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true |
| a,d | road,road | depart,arrive | , | left:false straight:true right:false, | | a,d | road,road,road | depart,use lane straight,arrive | ,left:false straight:true right:false, |
| a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false, | | a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false | | a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | ,left:false straight;right:true, | | k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, |
| k,l | cross,cross | depart,arrive | , | left:false straight;right:true, | | k,l | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight;right:true, |
| k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, | | k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, |
| k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, | | k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | ,none:false straight:false straight;right:true, | | e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, |
| e,h | road,road | depart,arrive | , | none:false straight:true straight;right:true, | | e,h | road,road | depart,arrive | ,none:false straight:true straight;right:true |
| e,j | road,cross,cross | depart,turn left,arrive | ,none:true straight:false straight;right:false, | ,none:true straight:false straight;right:false, | | e,j | road,cross,cross | depart,turn left,arrive | ,none:true straight:false straight;right:false, |
| e,d | road,road,road | depart,continue uturn,arrive | ,none:true straight:false straight;right:false, | ,none:true straight:false straight;right:false, | | e,d | road,road,road | depart,continue uturn,arrive | ,none:true straight:false straight;right:false, |
| i,h | cross,road,road | depart,turn right,arrive | ,, | | | i,h | cross,road,road | depart,turn right,arrive | ,, |
| i,j | cross,cross | depart,arrive | | left:false straight:true, | | i,j | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight:true, |
| i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, | ,left:true straight:false, | | i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, | ,left:true straight:false, | | i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, |
#copy of former case to prevent further regression #copy of former case to prevent further regression
@collapse @partition-lanes @collapse @partition-lanes
@@ -295,13 +295,13 @@ Feature: Turn Lane Guidance
| fl | cross | | yes | | fl | cross | | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, | | a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | | k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | | e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, |
| i,h | cross,road,road | depart,turn right,arrive | ,, | | i,h | cross,road,road | depart,turn right,arrive | ,, |
| i,j | cross,cross | depart,arrive | ;;left:false straight:true, | | i,j | cross,cross | depart,arrive | , |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ;,left:true straight:false;left:true straight:false;left:false straight:true, | | i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, |
@partition-lanes @partition-lanes
Scenario: Turn Lanes at Segregated Road Scenario: Turn Lanes at Segregated Road
@@ -347,7 +347,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | road,turn,turn | depart,turn right,arrive | ,none:false right:true, | | a,e | road,turn,turn | depart,turn right,arrive | ,none:false right:true, |
| a,d | road,road | depart,arrive | ;none:true right:false, | | a,d | road,road | depart,arrive | , |
@2654 @previous-lanes @2654 @previous-lanes
Scenario: Turn Lanes Given earlier than actual turn Scenario: Turn Lanes Given earlier than actual turn
@@ -368,11 +368,11 @@ Feature: Turn Lane Guidance
| hk | second-turn | | | | hk | second-turn | | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,k | road,second-turn,second-turn | depart,turn right,arrive | ;,none:false right:true, | | a,k | road,second-turn,second-turn | depart,turn right,arrive | ,none:false right:true, |
| a,i | road,road | depart,arrive | ;;none:true right:false, | | a,i | road,road | depart,arrive | , |
| i,j | road,first-turn,first-turn | depart,turn left,arrive | ;,left:true none:false, | | i,j | road,first-turn,first-turn | depart,turn left,arrive | ,left:true none:false, |
| i,a | road,road | depart,arrive | ;;left:false none:true, | | i,a | road,road | depart,arrive | , |
@previous-lanes @previous-lanes
Scenario: Passing a one-way street Scenario: Passing a one-way street
@@ -390,8 +390,8 @@ Feature: Turn Lane Guidance
| cf | turn | | | | cf | turn | | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ;left:true straight:false,left:true straight:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, |
@partition-lanes @partition-lanes
Scenario: Passing a one-way street, partly pulled back lanes Scenario: Passing a one-way street, partly pulled back lanes
@@ -411,10 +411,10 @@ Feature: Turn Lane Guidance
| bg | right | | no | | bg | right | | no |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ;left:true straight;right:false,left:true straight;right:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight;right:false, |
| a,d | road,road | depart,arrive | ;left:false straight;right:true;left:false straight;right:true, | | a,d | road,road | depart,arrive | , |
| a,g | road,right,right | depart,turn right,arrive | ,left:false straight;right:true, | | a,g | road,right,right | depart,turn right,arrive | ,left:false straight;right:true, |
@partition-lanes @previous-lanes @partition-lanes @previous-lanes
Scenario: Passing a one-way street, partly pulled back lanes, no through Scenario: Passing a one-way street, partly pulled back lanes, no through
@@ -434,9 +434,9 @@ Feature: Turn Lane Guidance
| bg | right | | no | | bg | right | | no |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true right:false;left:true right:false, | | a,f | road,turn,turn | depart,turn left,arrive | ,left:true right:false, |
| a,g | road,right,right | depart,turn right,arrive | ,left:false right:true, | | a,g | road,right,right | depart,turn right,arrive | ,left:false right:true, |
@todo @partition-lanes @previous-lanes @todo @partition-lanes @previous-lanes
Scenario: Narrowing Turn Lanes Scenario: Narrowing Turn Lanes
@@ -484,7 +484,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,road | depart,arrive | ;straight:true right:false, | | a,d | road,road | depart,arrive | , |
| a,e | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, | | a,e | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, |
@todo @roundabout @todo @roundabout
@@ -554,9 +554,9 @@ Feature: Turn Lane Guidance
| restriction | bc | dc | c | no_right_turn | | restriction | bc | dc | c | no_right_turn |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,g | road,cross,cross | depart,turn left,arrive | ,left:true left:true straight:false straight:false right:false;left:true left:true straight:false straight:false right:false, | | a,g | road,cross,cross | depart,turn left,arrive | ,left:true left:true straight:false straight:false right:false, |
| a,e | road,road | depart,arrive | ;left:false left:false straight:true straight:true right:false;left:false left:false straight:true straight:true right:false, | | a,e | road,road | depart,arrive | , |
#NEEDS TO BE INVESTIGATED. Turn restriction shouldn't be here. See #2867 #NEEDS TO BE INVESTIGATED. Turn restriction shouldn't be here. See #2867
@reverse @previous-lanes @reverse @previous-lanes
@@ -589,11 +589,11 @@ Feature: Turn Lane Guidance
| restriction | de | ef | e | no_left_turn | | restriction | de | ef | e | no_left_turn |
When I route I should get When I route I should get
| from | to | bearings | route | turns | lanes | | from | to | bearings | route | turns | lanes |
| a | g | 180,180 180,180 | road,cross,cross | depart,turn right,arrive | ;none:false straight:false right:true,none:false straight:false right:true, | | a | g | 180,180 180,180 | road,cross,cross | depart,turn right,arrive | ,none:false straight:false right:true, |
| a | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ;none:true straight:false right:false,none:true straight:false right:false;, | | a | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ,none:true straight:false right:false, |
| a | i | 180,180 180,180 | road,road | depart,arrive | ;none:true straight:true right:false;none:true straight:true right:false, | | a | i | 180,180 180,180 | road,road | depart,arrive | , |
| b | a | 90,2 270,2 | road,road,road | depart,continue uturn,arrive | ,none:true straight:false right:false;, | | b | a | 90,2 270,2 | road,road,road | depart,continue uturn,arrive | ,none:true straight:false right:false, |
@reverse @reverse
Scenario: Segregated Intersection Merges With Lanes Scenario: Segregated Intersection Merges With Lanes
@@ -629,7 +629,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,f | road,left,left | depart,turn left,arrive | ,left:true left:true left:true straight:false straight:false, | | a,f | road,left,left | depart,turn left,arrive | ,left:true left:true left:true straight:false straight:false, |
| a,e | road,road,road | depart,continue uturn,arrive | ,left:true left:false left:false straight:false straight:false, | | a,e | road,road,road | depart,turn uturn,arrive | ,left:true left:false left:false straight:false straight:false, |
| a,g | road,straight,straight | depart,new name straight,arrive | ,left:false left:false left:false straight:true straight:true, | | a,g | road,straight,straight | depart,new name straight,arrive | ,left:false left:false left:false straight:true straight:true, |
@todo @roundabout @todo @roundabout
@@ -681,7 +681,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,road | depart,arrive | ;straight:true straight:true straight;slight right:true slight right:false, | | a,d | road,road | depart,arrive | , |
| a,e | road,cross,cross | depart,turn slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, | | a,e | road,cross,cross | depart,turn slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, |
@ramp @ramp
@@ -700,7 +700,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | hwy,hwy | depart,arrive | ;straight:true straight:true straight;slight right:true slight right:false, | | a,d | hwy,hwy | depart,arrive | , |
| a,e | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, | | a,e | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, |
@todo @todo
@@ -745,7 +745,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,c | hwy,hwy | depart,arrive | ;straight:true straight:true slight right:false, | | a,c | hwy,hwy | depart,arrive | , |
| a,d | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false slight right:true, | | a,d | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false slight right:true, |
@reverse @reverse
@@ -766,8 +766,8 @@ Feature: Turn Lane Guidance
| fgh | road | | primary | yes | | fgh | road | | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false straight:false;,| | a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false straight:false,|
@reverse @reverse
Scenario: Reverse Lane in Segregated Road with none Scenario: Reverse Lane in Segregated Road with none
@@ -787,8 +787,8 @@ Feature: Turn Lane Guidance
| fgh | road | | primary | yes | | fgh | road | | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false;, | | a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false, |
@reverse @reverse
Scenario: Reverse Lane in Segregated Road with none, Service Turn Prior Scenario: Reverse Lane in Segregated Road with none, Service Turn Prior
@@ -810,8 +810,8 @@ Feature: Turn Lane Guidance
| ji | park | | service | no | | ji | park | | service | no |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false;, | | a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false, |
@simple @simple
Scenario: Don't collapse everything to u-turn / too wide Scenario: Don't collapse everything to u-turn / too wide
@@ -873,9 +873,9 @@ Feature: Turn Lane Guidance
| ab | on | motorway_link | | | ab | on | motorway_link | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,j | on,xbcj | depart,arrive | ;;none:true slight right:false, | | a,j | on,xbcj | depart,arrive | , |
| a,i | on,off,off | depart,turn right,arrive | ;,none:false slight right:true, | | a,i | on,off,off | depart,turn right,arrive | ,none:false slight right:true, |
#http://www.openstreetmap.org/#map=17/52.47414/13.35712 #http://www.openstreetmap.org/#map=17/52.47414/13.35712
@todo @ramp @2645 @todo @ramp @2645
@@ -929,8 +929,8 @@ Feature: Turn Lane Guidance
| cf | turn | primary | | | cf | turn | primary | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| x,d | road,road | depart,arrive | ;straight;right:true;straight;right:true, | | x,d | road,road | depart,arrive | , |
@partition-lanes @partition-lanes
Scenario: Partitioned turn, Slight Curve - maxspeed Scenario: Partitioned turn, Slight Curve - maxspeed
@@ -952,9 +952,9 @@ Feature: Turn Lane Guidance
| dce | cross | primary | yes | | 1 | | dce | cross | primary | yes | | 1 |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | locations | | waypoints | route | turns | lanes | locations |
| a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g | | a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g |
| a,e | road,cross,cross | depart,end of road left,arrive | ;left:true right:false,left:true right:false, | a,c,e | | a,e | road,cross,cross | depart,end of road left,arrive | ,left:true right:false, | a,c,e |
Scenario: Partitioned turn, Slight Curve Scenario: Partitioned turn, Slight Curve
Given the node map Given the node map
@@ -975,9 +975,9 @@ Feature: Turn Lane Guidance
| dce | cross | primary | yes | | | dce | cross | primary | yes | |
When I route I should get When I route I should get
| waypoints | route | turns | lanes | locations | | waypoints | route | turns | lanes | locations |
| a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g | | a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g |
| a,e | road,cross,cross | depart,end of road left,arrive | ;left:true right:false,left:true right:false, | a,c,e | | a,e | road,cross,cross | depart,end of road left,arrive | ,left:true right:false, | a,c,e |
Scenario: Lane Parsing Issue #2694 Scenario: Lane Parsing Issue #2694
Given the node map Given the node map
@@ -1193,7 +1193,7 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,e | road,cross,cross | depart,turn right,arrive | ,left:false none:false none:true, | | a,e | road,cross,cross | depart,turn right,arrive | ,left:false none:false none:true, |
| a,c | road,road | depart,arrive | ;left:false none:true none:true, | | a,c | road,road | depart,arrive | , |
@3379 @3379
Scenario: Don't Turn through potential through lanes Scenario: Don't Turn through potential through lanes
@@ -1214,33 +1214,4 @@ Feature: Turn Lane Guidance
When I route I should get When I route I should get
| waypoints | route | turns | lanes | | waypoints | route | turns | lanes |
| a,d | road,cross,cross | depart,turn left,arrive | ,none:true none:false right:false, | | a,d | road,cross,cross | depart,turn left,arrive | ,none:true none:false right:false, |
| a,c | road,road | depart,arrive | ;none:true none:true right:false, | | a,c | road,road | depart,arrive | , |
@4189
Scenario: U-turn after a traffic light
Given the node map
"""
j k
: :
f---g-h-i
: :
a-b-c-d-e
: :
l m
"""
And the nodes
| node | highway |
| b | traffic_signals |
And the ways
| nodes | name | lanes | turn:lanes | oneway |
| ab | road1 | 3 | left\|through\|through;right | yes |
| bcde | road1 | 2 | | yes |
| ihgf | road1 | 2 | | yes |
| jgcl | road2 | 2 | | yes |
| mdhk | road2 | 2 | | yes |
When I route I should get
| waypoints | route | turns | lanes | locations |
| a,f | road1,road1,road1 | depart,continue uturn,arrive | ;left:false straight:true straight;right:false,left:true straight:false straight;right:false;;, | a,d,f |
-89
View File
@@ -1260,92 +1260,3 @@ Feature: Simple Turns
| waypoints | route | turns | | waypoints | route | turns |
| a,d | Goethe,Fried,Fried | depart,continue left,arrive | | a,d | Goethe,Fried,Fried | depart,continue left,arrive |
| a,g | Goethe,Fried,Fried | depart,turn right,arrive | | a,g | Goethe,Fried,Fried | depart,turn right,arrive |
# Conflicting roads (https://www.openstreetmap.org/export#map=19/37.57805/-77.46049)
Scenario: Turning at forklike structure
Given the node map
"""
c d
- - - b - - - a
-
e
"""
And the ways
| nodes | name | oneway | highway |
| abc | foo | no | residential |
| bd | bar | yes | residential |
| eb | some | yes | tertiary_link |
When I route I should get
| waypoints | route | turns |
| a,d | foo,bar,bar | depart,turn slight right,arrive |
Scenario: UTurn onto ramp
Given the node map
"""
a - - - b - c
.|
_________________ de
h-g-----------------------f
"""
And the ways
| nodes | name | ref | oneway | highway |
| abc | Road | | yes | primary |
| ce | other | | yes | primary |
| cdg | | | yes | motorway_link |
| fgh | | C 42 | yes | motorway |
When I route I should get
| waypoints | route | ref | turns |
| a,h | Road,,, | ,,C 42,C 42 | depart,on ramp right,merge slight left,arrive |
Scenario: UTurn onto ramp (same ref)
Given the node map
"""
a - - - b - c
.|
_________________ de
h-g-----------------------f
"""
And the ways
| nodes | name | ref | oneway | highway |
| abc | Road | C 42 | yes | primary |
| ce | other | | yes | primary |
| cdg | | | yes | motorway_link |
| fgh | | C 42 | yes | motorway |
When I route I should get
| waypoints | route | ref | turns |
| a,h | Road,,, | C 42,,C 42,C 42 | depart,on ramp right,merge slight left,arrive |
Scenario: End of road, T-intersection, no obvious turn, only one road allowed
Given the node map
"""
d
.
a . b . . c
' .
'e
.
f
"""
And the ways
| nodes | highway | oneway | ref |
| ab | primary | | B 191 |
| bc | primary | | B 191 |
| be | primary_link | yes | |
| dc | primary | | B 4;B 191 |
| ce | primary | | B 4 |
| ef | primary | | B 4 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | ce | c | no_right_turn |
| restriction | be | ef | e | only_right_turn |
When I route I should get
| waypoints | route | turns |
| a,d | ab,dc,dc | depart,turn left,arrive |
@@ -20,31 +20,11 @@ Feature: osrm-contract command line option: edge-weight-updates-over-factor
And the data has been saved to disk And the data has been saved to disk
Scenario: Logging weight with updates over factor of 2, long segment Scenario: Logging weight with updates over factor of 2, long segment
When I run "osrm-extract --profile {profile_file} {osm_file}" When I run "osrm-extract --profile {profile_file} {osm_file} --generate-edge-lookup"
And the data has been partitioned
When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}" When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}"
Then stderr should not contain "Speed values were used to update 2 segment(s)"
And stderr should contain "Segment: 1,2" And stderr should contain "Segment: 1,2"
And stderr should contain "Segment: 1,3" And stderr should contain "Segment: 1,3"
And I route I should get And I route I should get
| from | to | route | speed | | from | to | route | speed |
| a | b | ab,ab | 100 km/h | | a | b | ab,ab | 100 km/h |
| a | c | ac,ac | 100 km/h | | a | c | ac,ac | 100 km/h |
Scenario: Logging using weigts as durations for non-duration profile
Given the profile file "testbot" extended with
"""
properties.weight_name = 'steps'
function way_function(way, result)
result.forward_mode = mode.driving
result.backward_mode = mode.driving
result.weight = 1
result.duration = 1
end
"""
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
When I run "osrm-contract --edge-weight-updates-over-factor 2 --segment-speed-file {speeds_file} {processed_file}"
Then stderr should contain "Speed values were used to update 2 segments for 'steps' profile"
+3 -3
View File
@@ -10,11 +10,11 @@ Feature: osrm-partition command line options: help
And stdout should contain "--help" And stdout should contain "--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 "--min-cell-size"
And stdout should contain "--balance" And stdout should contain "--balance"
And stdout should contain "--boundary" And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts" And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size" And stdout should contain "--small-component-size"
And stdout should contain "--max-cell-sizes"
And it should exit with an error And it should exit with an error
Scenario: osrm-partition - Help, short Scenario: osrm-partition - Help, short
@@ -26,11 +26,11 @@ Feature: osrm-partition command line options: help
And stdout should contain "--help" And stdout should contain "--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 "--min-cell-size"
And stdout should contain "--balance" And stdout should contain "--balance"
And stdout should contain "--boundary" And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts" And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size" And stdout should contain "--small-component-size"
And stdout should contain "--max-cell-sizes"
And it should exit successfully And it should exit successfully
Scenario: osrm-partition - Help, long Scenario: osrm-partition - Help, long
@@ -42,9 +42,9 @@ Feature: osrm-partition command line options: help
And stdout should contain "--help" And stdout should contain "--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 "--min-cell-size"
And stdout should contain "--balance" And stdout should contain "--balance"
And stdout should contain "--boundary" And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts" And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size" And stdout should contain "--small-component-size"
And stdout should contain "--max-cell-sizes"
And it should exit successfully And it should exit successfully
@@ -18,15 +18,3 @@ Feature: osrm-partition command line options: invalid options
And stderr should contain "option" And stderr should contain "option"
And stderr should contain "fly-me-to-the-moon" And stderr should contain "fly-me-to-the-moon"
And it should exit with an error And it should exit with an error
Scenario: osrm-partition - Check invalid values
When I try to run "osrm-partition --max-cell-sizes 4,6@4,16 fly-me-to-the-moon.osrm"
Then stdout should be empty
And stderr should contain "is invalid"
And it should exit with an error
Scenario: osrm-partition - Check non-descending order
When I try to run "osrm-partition --max-cell-sizes 4,64,16 fly-me-to-the-moon.osrm"
Then stdout should be empty
And stderr should contain "must be sorted in non-descending order"
And it should exit with an error
+1 -1
View File
@@ -14,5 +14,5 @@ Feature: osrm-routed command line options: invalid options
Scenario: osrm-routed - Missing file Scenario: osrm-routed - Missing file
When I try to run "osrm-routed over-the-rainbow.osrm" When I try to run "osrm-routed over-the-rainbow.osrm"
Then stderr should contain "over-the-rainbow.osrm" Then stderr should contain "over-the-rainbow.osrm"
And stderr should contain "Required files are missing" And stderr should contain "not found"
And it should exit with an error And it should exit with an error
+4 -6
View File
@@ -2,10 +2,10 @@
Feature: osrm-extract with a profile containing raster source Feature: osrm-extract with a profile containing raster source
Scenario: osrm-extract on a valid profile Scenario: osrm-extract on a valid profile
Given the profile "rasterbot" Given the profile "rasterbot"
And the node locations And the node map
| node | lat | lon | """
| a | 0.1 | 0.1 | a b
| b | 0.05 | 0.1 | """
And the ways And the ways
| nodes | | nodes |
| ab | | ab |
@@ -20,6 +20,4 @@ Feature: osrm-extract with a profile containing raster source
And the data has been saved to disk And the data has been saved to disk
When I run "osrm-extract {osm_file} -p {profile_file}" When I run "osrm-extract {osm_file} -p {profile_file}"
Then stdout should contain "source loader" Then stdout should contain "source loader"
Then stdout should contain "slope: 0.0899"
Then stdout should contain "slope: -0.0899"
And it should exit successfully And it should exit successfully
+25 -18
View File
@@ -32,7 +32,9 @@ Feature: Raster - weights
Scenario: Weighting not based on raster sources Scenario: Weighting not based on raster sources
Given the profile "testbot" Given the profile "testbot"
When I route I should get When I run "osrm-extract {osm_file} -p {profile_file}"
And I run "osrm-contract {processed_file}"
And I route I should get
| from | to | route | speed | | from | to | route | speed |
| a | b | ab,ab | 36 km/h | | a | b | ab,ab | 36 km/h |
| a | c | ab,bc,bc | 36 km/h | | a | c | ab,bc,bc | 36 km/h |
@@ -42,23 +44,28 @@ Feature: Raster - weights
Scenario: Weighting based on raster sources Scenario: Weighting based on raster sources
Given the profile "rasterbot" Given the profile "rasterbot"
When I route I should get When I run "osrm-extract {osm_file} -p {profile_file}"
| from | to | route | speed | Then stdout should contain "evaluating segment"
| a | b | ab,ab | 8 km/h | And I run "osrm-contract {processed_file}"
| b | a | ab,ab | 22 km/h | And I route I should get
| a | c | ab,bc,bc | 12 km/h | | from | to | route | speed |
| b | c | bc,bc | 22 km/h | | a | b | ab,ab | 8 km/h |
| a | d | ad,ad | 15 km/h | | a | c | ad,dc,dc | 15 km/h |
| d | c | dc,dc | 15 km/h | | b | c | bc,bc | 8 km/h |
| d | e | de,de | 10 km/h | | a | d | ad,ad | 15 km/h |
| e | b | eb,eb | 10 km/h | | d | c | dc,dc | 15 km/h |
| d | f | df,df | 15 km/h | | d | e | de,de | 10 km/h |
| f | b | fb,fb | 7 km/h | | e | b | eb,eb | 10 km/h |
| d | b | de,eb,eb | 10 km/h | | d | f | df,df | 15 km/h |
| f | b | fb,fb | 7 km/h |
Scenario: Weighting based on raster sources | d | b | de,eb,eb | 10 km/h |
Given the profile "rasterbotinterp"
When I route I should get Scenario: Weighting based on raster sources
Given the profile "rasterbotinterp"
When I run "osrm-extract {osm_file} -p {profile_file}"
Then stdout should contain "evaluating segment"
And I run "osrm-contract {processed_file}"
And I route I should get
| from | to | route | speed | | from | to | route | speed |
| a | b | ab,ab | 8 km/h | | a | b | ab,ab | 8 km/h |
| a | c | ad,dc,dc | 15 km/h | | a | c | ad,dc,dc | 15 km/h |
+7 -7
View File
@@ -38,7 +38,7 @@ module.exports = function () {
callback(); callback();
}); });
this.Given(/^the origin ([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)$/, (lon, lat, callback) => { this.Given(/^the origin ([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)$/, (lat, lon, callback) => {
this.setOrigin([parseFloat(lon), parseFloat(lat)]); this.setOrigin([parseFloat(lon), parseFloat(lat)]);
callback(); callback();
}); });
@@ -67,7 +67,7 @@ module.exports = function () {
if (this.nameNodeHash[name]) throw new Error(util.format('*** duplicate node %s', name)); if (this.nameNodeHash[name]) throw new Error(util.format('*** duplicate node %s', name));
this.addOSMNode(name, lonLat[0], lonLat[1], null); this.addOSMNode(name, lonLat[0], lonLat[1], null);
} else if (name.match(/[0-9]/) ) { } else if (name.match(/[0-9]/) ) {
if (this.locationHash[name]) throw new Error(util.format('*** duplicate node %s', name)); if (this.locationHash[name]) throw new Error(util.format('*** duplicate node %s'), name);
this.addLocation(name, lonLat[0], lonLat[1], null); this.addLocation(name, lonLat[0], lonLat[1], null);
} }
cb(); cb();
@@ -89,7 +89,7 @@ module.exports = function () {
let addNodeLocations = (row, cb) => { let addNodeLocations = (row, cb) => {
let name = row.node; let name = row.node;
if (this.findNodeByName(name)) throw new Error(util.format('*** duplicate node %s', name)); if (this.findNodeByName(name)) throw new Error(util.format('*** duplicate node %s'), name);
if (name.match(/[a-z]/)) { if (name.match(/[a-z]/)) {
let id = row.id && parseInt(row.id); let id = row.id && parseInt(row.id);
@@ -194,19 +194,19 @@ module.exports = function () {
isColonSeparated = key.match(/^(.*):(.*)/); isColonSeparated = key.match(/^(.*):(.*)/);
if (isNode) { if (isNode) {
row[key].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) {
row[key].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 (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, row[key]); relation.addTag(key, row[key]);
} }
+4 -6
View File
@@ -16,13 +16,10 @@ module.exports = function () {
var headers = new Set(table.raw()[0]); var headers = new Set(table.raw()[0]);
got.code = 'unknown';
if (res.body.length) { if (res.body.length) {
json = JSON.parse(res.body); json = JSON.parse(res.body);
got.code = json.code;
} }
if (headers.has('status')) { if (headers.has('status')) {
got.status = json.status.toString(); got.status = json.status.toString();
} }
@@ -36,7 +33,7 @@ module.exports = function () {
got['#'] = row['#']; got['#'] = row['#'];
} }
var subMatchings = [''], var subMatchings = [],
turns = '', turns = '',
route = '', route = '',
duration = '', duration = '',
@@ -178,7 +175,8 @@ module.exports = function () {
if (headers.has('matchings')) { if (headers.has('matchings')) {
if (subMatchings.length != row.matchings.split(',').length) { if (subMatchings.length != row.matchings.split(',').length) {
return cb(new Error('*** table matchings and api response are not the same')); ok = false;
cb(new Error('*** table matchings and api response are not the same'));
} }
row.matchings.split(',').forEach((sub, si) => { row.matchings.split(',').forEach((sub, si) => {
@@ -228,7 +226,7 @@ module.exports = function () {
for (var i=0; i<row.trace.length; i++) { for (var i=0; i<row.trace.length; i++) {
var n = row.trace[i], var n = row.trace[i],
node = this.findNodeByName(n); node = this.findNodeByName(n);
if (!node) throw new Error(util.format('*** unknown waypoint node "%s"', n)); if (!node) throw new Error(util.format('*** unknown waypoint node "%s"'), n);
trace.push(node); trace.push(node);
} }
if (row.timestamps) { if (row.timestamps) {
+2 -2
View File
@@ -6,10 +6,10 @@ module.exports = function () {
if (e) return callback(e); if (e) return callback(e);
var testRow = (row, ri, cb) => { var testRow = (row, ri, cb) => {
var inNode = this.findNodeByName(row.in); var inNode = this.findNodeByName(row.in);
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in)); if (!inNode) throw new Error(util.format('*** unknown in-node "%s"'), row.in);
var outNode = this.findNodeByName(row.out); var outNode = this.findNodeByName(row.out);
if (!outNode) throw new Error(util.format('*** unknown out-node "%s"', row.out)); if (!outNode) throw new Error(util.format('*** unknown out-node "%s"'), row.out);
this.requestNearest(inNode, this.queryParams, (err, response) => { this.requestNearest(inNode, this.queryParams, (err, response) => {
if (err) return cb(err); if (err) return cb(err);
+3 -4
View File
@@ -34,7 +34,7 @@ module.exports = function () {
outputRow[rate] = result[direction].status ? outputRow[rate] = result[direction].status ?
result[direction].status.toString() : ''; result[direction].status.toString() : '';
break; break;
case /^\d+(\.\d+){0,1}$/.test(want): case /^\d+$/.test(want):
if (result[direction].rate !== undefined && !isNaN(result[direction].rate)) { if (result[direction].rate !== undefined && !isNaN(result[direction].rate)) {
outputRow[rate] = result[direction].rate.toString(); outputRow[rate] = result[direction].rate.toString();
} else { } else {
@@ -121,12 +121,11 @@ module.exports = function () {
r.which = dir; r.which = dir;
this.requestRoute((dir === 'forw' ? [a, b] : [b, a]), [], [], this.queryParams, (err, res, body) => { this.requestRoute((dir === 'forw' ? [a, b] : [b, a]), [], this.queryParams, (err, res, body) => {
if (err) return callback(err); if (err) return callback(err);
r.query = this.query; r.query = this.query;
r.json = JSON.parse(body); r.json = JSON.parse(body);
r.code = r.json.code;
r.status = res.statusCode === 200 ? 'x' : null; r.status = res.statusCode === 200 ? 'x' : null;
if (r.status) { if (r.status) {
r.route = this.wayList(r.json.routes[0]); r.route = this.wayList(r.json.routes[0]);
@@ -135,7 +134,7 @@ module.exports = function () {
if (r.route.split(',')[0] === util.format('w%d', i)) { if (r.route.split(',')[0] === util.format('w%d', i)) {
r.time = r.json.routes[0].duration; r.time = r.json.routes[0].duration;
r.distance = r.json.routes[0].distance; r.distance = r.json.routes[0].distance;
r.rate = Math.round(r.distance / r.json.routes[0].weight * 10) / 10.; r.rate = Math.round(r.distance / r.json.routes[0].weight);
r.speed = r.time > 0 ? parseInt(3.6 * r.distance / r.time) : null; r.speed = r.time > 0 ? parseInt(3.6 * r.distance / r.time) : null;
// use the mode of the first step of the route // use the mode of the first step of the route
+4 -3
View File
@@ -29,10 +29,8 @@ module.exports = function () {
} }
var json; var json;
got.code = 'unknown';
if (res.body.length) { if (res.body.length) {
json = JSON.parse(res.body); json = JSON.parse(res.body);
got.code = json.code;
} }
if (headers.has('status')) { if (headers.has('status')) {
@@ -85,7 +83,8 @@ module.exports = function () {
} }
var ok = true, var ok = true,
encodedResult = ''; encodedResult = '',
extendedTarget = '';
if (json.trips) row.trips.split(',').forEach((sub, si) => { if (json.trips) row.trips.split(',').forEach((sub, si) => {
if (si >= subTrips.length) { if (si >= subTrips.length) {
@@ -97,9 +96,11 @@ module.exports = function () {
outNode = subTrips[si][ni]; outNode = subTrips[si][ni];
if (this.FuzzyMatch.matchLocation(outNode, node)) { if (this.FuzzyMatch.matchLocation(outNode, node)) {
encodedResult += sub[ni]; encodedResult += sub[ni];
extendedTarget += sub[ni];
} else { } else {
ok = false; ok = false;
encodedResult += util.format('? [%s,%s]', outNode[0], outNode[1]); encodedResult += util.format('? [%s,%s]', outNode[0], outNode[1]);
extendedTarget += util.format('%s [%d,%d]', sub[ni], node.lat, node.lon);
} }
} }
} }
+4 -4
View File
@@ -238,13 +238,13 @@ module.exports = function () {
// a shallow copy of scenario parameters to avoid data inconsistency // a shallow copy of scenario parameters to avoid data inconsistency
// if a cucumber timeout occurs during deferred jobs // if a cucumber timeout occurs during deferred jobs
let p = {extractArgs: this.extractArgs, contractArgs: this.contractArgs, let p = {extractArgs: this.extractArgs, contractArgs: this.contractArgs,
partitionArgs: this.partitionArgs, customizeArgs: this.customizeArgs, partitionArgs: this.partitionArgs, customizeArgs: this.customizeArgs,
profileFile: this.profileFile, inputCacheFile: this.inputCacheFile, profileFile: this.profileFile, inputCacheFile: this.inputCacheFile,
processedCacheFile: this.processedCacheFile, environment: this.environment}; processedCacheFile: this.processedCacheFile, environment: this.environment};
let queue = d3.queue(1); let queue = d3.queue(1);
queue.defer(this.extractData.bind(this), p); queue.defer(this.extractData.bind(this), p);
queue.defer(this.partitionData.bind(this), p);
queue.defer(this.contractData.bind(this), p); queue.defer(this.contractData.bind(this), p);
queue.defer(this.partitionData.bind(this), p);
queue.defer(this.customizeData.bind(this), p); queue.defer(this.customizeData.bind(this), p);
queue.awaitAll(callback); queue.awaitAll(callback);
}; };
+1 -2
View File
@@ -39,8 +39,7 @@ module.exports = function () {
this.WAY_SPACING = 100; this.WAY_SPACING = 100;
this.DEFAULT_GRID_SIZE = 100; // meters this.DEFAULT_GRID_SIZE = 100; // meters
// get algorithm name from the command line profile argument // get algorithm name from the command line profile argument
this.ROUTING_ALGORITHM = process.argv[process.argv.indexOf('-p') + 1].match('mld') ? 'MLD' : 'CH'; this.ROUTING_ALGORITHM = process.argv[process.argv.indexOf('-p') + 1] === 'mld' ? 'MLD' : 'CH';
this.TIMEZONE_NAMES = this.PLATFORM_WINDOWS ? 'win' : 'iana';
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;
+12 -35
View File
@@ -46,9 +46,8 @@ module.exports = function () {
return waypoints.map(w => [w.lon, w.lat].map(ensureDecimal).join(',')); return waypoints.map(w => [w.lon, w.lat].map(ensureDecimal).join(','));
}; };
this.requestRoute = (waypoints, bearings, approaches, userParams, callback) => { this.requestRoute = (waypoints, bearings, userParams, callback) => {
if (bearings.length && bearings.length !== waypoints.length) throw new Error('*** number of bearings does not equal the number of waypoints'); if (bearings.length && bearings.length !== waypoints.length) throw new Error('*** number of bearings does not equal the number of waypoints');
if (approaches.length && approaches.length !== waypoints.length) throw new Error('*** number of approaches does not equal the number of waypoints');
var defaults = { var defaults = {
output: 'json', output: 'json',
@@ -68,9 +67,6 @@ module.exports = function () {
}).join(';'); }).join(';');
} }
if (approaches.length) {
params.approaches = approaches.join(';');
}
return this.requestPath('route', params, callback); return this.requestPath('route', params, callback);
}; };
@@ -155,10 +151,6 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.destinations || ''); return this.extractInstructionList(instructions, s => s.destinations || '');
}; };
this.exitsList = (instructions) => {
return this.extractInstructionList(instructions, s => s.exits || '');
};
this.reverseBearing = (bearing) => { this.reverseBearing = (bearing) => {
if (bearing >= 180) if (bearing >= 180)
return bearing - 180.; return bearing - 180.;
@@ -171,28 +163,6 @@ module.exports = function () {
('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0)); ('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0));
}; };
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, s => {
return s.intersections.map( i => {
if(i.lanes)
{
return i.lanes.map( l => {
let indications = l.indications.join(';');
return indications + ':' + (l.valid ? 'true' : 'false');
}).join(' ');
}
else
{
return '';
}
}).join(';');
});
};
this.approachList = (instructions) => {
return this.extractInstructionList(instructions, s => s.approaches || '');
};
this.annotationList = (instructions) => { this.annotationList = (instructions) => {
if (!('annotation' in instructions.legs[0])) if (!('annotation' in instructions.legs[0]))
return ''; return '';
@@ -215,6 +185,17 @@ module.exports = function () {
return instructions.tracepoints.map(t => t.alternatives_count.toString()).join(','); return instructions.tracepoints.map(t => t.alternatives_count.toString()).join(',');
}; };
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, instruction => {
if( 'lanes' in instruction.intersections[0] )
{
return instruction.intersections[0].lanes.map( p => { return (p.indications).join(';') + ':' + p.valid; } ).join(' ');
} else
{
return '';
}});
};
this.turnList = (instructions) => { this.turnList = (instructions) => {
return instructions.legs.reduce((m, v) => m.concat(v.steps), []) return instructions.legs.reduce((m, v) => m.concat(v.steps), [])
.map(v => { .map(v => {
@@ -267,10 +248,6 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.mode); return this.extractInstructionList(instructions, s => s.mode);
}; };
this.classesList = (instructions) => {
return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']');
};
this.timeList = (instructions) => { this.timeList = (instructions) => {
return this.extractInstructionList(instructions, s => s.duration + 's'); return this.extractInstructionList(instructions, s => s.duration + 's');
}; };
+1 -2
View File
@@ -15,8 +15,7 @@ module.exports = function () {
'{profile_file}': this.profileFile, '{profile_file}': this.profileFile,
'{rastersource_file}': this.rasterCacheFile, '{rastersource_file}': this.rasterCacheFile,
'{speeds_file}': this.speedsCacheFile, '{speeds_file}': this.speedsCacheFile,
'{penalties_file}': this.penaltiesCacheFile, '{penalties_file}': this.penaltiesCacheFile
'{timezone_names}': this.TIMEZONE_NAMES
}; };
for (let k in table) { for (let k in table) {
+92 -109
View File
@@ -34,13 +34,11 @@ module.exports = function () {
var afterRequest = (err, res, body) => { var afterRequest = (err, res, body) => {
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, pronunciations, instructions, refs, bearings, turns, modes, times,
distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches; distances, summary, intersections, lanes, locations, annotation, weight_name, weights;
let json = JSON.parse(body); let json = JSON.parse(body);
got.code = json.code;
let hasRoute = json.code === 'Ok'; let hasRoute = json.code === 'Ok';
if (hasRoute) { if (hasRoute) {
@@ -48,12 +46,10 @@ module.exports = function () {
pronunciations = this.pronunciationList(json.routes[0]); pronunciations = this.pronunciationList(json.routes[0]);
refs = this.refList(json.routes[0]); refs = this.refList(json.routes[0]);
destinations = this.destinationsList(json.routes[0]); destinations = this.destinationsList(json.routes[0]);
exits = this.exitsList(json.routes[0]);
bearings = this.bearingList(json.routes[0]); bearings = this.bearingList(json.routes[0]);
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]);
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]);
lanes = this.lanesList(json.routes[0]); lanes = this.lanesList(json.routes[0]);
@@ -62,7 +58,6 @@ module.exports = function () {
annotation = this.annotationList(json.routes[0]); annotation = this.annotationList(json.routes[0]);
weight_name = this.weightName(json.routes[0]); weight_name = this.weightName(json.routes[0]);
weights = this.weightList(json.routes[0]); weights = this.weightList(json.routes[0]);
approaches = this.approachList(json.routes[0]);
} }
if (headers.has('status')) { if (headers.has('status')) {
@@ -84,107 +79,101 @@ module.exports = function () {
if (headers.has('route')) { if (headers.has('route')) {
got.route = (instructions || '').trim(); got.route = (instructions || '').trim();
}
if (headers.has('summary')) { if (headers.has('summary')) {
got.summary = (summary || '').trim(); got.summary = (summary || '').trim();
}
if (headers.has('alternative')) {
// TODO examine more than first alternative?
got.alternative ='';
if (json.routes && json.routes.length > 1)
got.alternative = this.wayList(json.routes[1]);
}
var distance = hasRoute && json.routes[0].distance,
time = hasRoute && json.routes[0].duration,
weight = hasRoute && json.routes[0].weight;
if (headers.has('distance')) {
if (row.distance.length) {
if (!row.distance.match(/\d+m/))
return cb(new Error('*** Distance must be specified in meters. (ex: 250m)'));
got.distance = instructions ? util.format('%dm', distance) : '';
} else {
got.distance = '';
} }
}
if (headers.has('weight')) { if (headers.has('alternative')) {
if (row.weight.length) { // TODO examine more than first alternative?
if (!row.weight.match(/[\d\.]+/)) got.alternative ='';
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)')); if (json.routes && json.routes.length > 1)
got.weight = instructions ? util.format('%d', weight) : ''; got.alternative = this.wayList(json.routes[1]);
} else {
got.weight = '';
} }
}
if (headers.has('time')) { var distance = hasRoute && json.routes[0].distance,
if (!row.time.match(/\d+s/)) time = hasRoute && json.routes[0].duration,
return cb(new Error('*** Time must be specied in seconds. (ex: 60s)')); weight = hasRoute && json.routes[0].weight;
got.time = instructions ? util.format('%ds', time) : '';
}
if (headers.has('lanes')) { if (headers.has('distance')) {
got.lanes = (lanes || '').trim(); if (row.distance.length) {
} if (!row.distance.match(/\d+m/))
return cb(new Error('*** Distance must be specified in meters. (ex: 250m)'));
if (headers.has('speed')) { got.distance = instructions ? util.format('%dm', distance) : '';
if (row.speed !== '' && instructions) { } else {
if (!row.speed.match(/\d+ km\/h/)) got.distance = '';
cb(new Error('*** Speed must be specied in km/h. (ex: 50 km/h)')); }
var speed = time > 0 ? Math.round(3.6*distance/time) : null;
got.speed = util.format('%d km/h', speed);
} else {
got.speed = '';
} }
}
if (headers.has('intersections')) { if (headers.has('weight')) {
got.intersections = (intersections || '').trim(); if (row.weight.length) {
} if (!row.weight.match(/[\d\.]+/))
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
if (headers.has('locations')){ got.weight = instructions ? util.format('%d', weight) : '';
got.locations = (locations || '').trim(); } else {
} got.weight = '';
/* }
if (headers.has('approaches')){
got.approaches = (approaches || '').trim();
}*/
// if header matches 'a:*', parse out the values for *
// and return in that header
headers.forEach((k) => {
let whitelist = ['duration', 'distance', 'datasources', 'nodes', 'weight', 'speed'];
if (k.match(/^a:/)) {
let a_type = k.slice(2);
if (whitelist.indexOf(a_type) == -1)
return cb(new Error('Unrecognized annotation field', a_type));
if (annotation && !annotation[a_type])
return cb(new Error('Annotation not found in response', a_type));
got[k] = annotation && annotation[a_type] || '';
} }
});
var putValue = (key, value) => { if (headers.has('time')) {
if (headers.has(key)) got[key] = instructions ? value : ''; if (!row.time.match(/\d+s/))
}; return cb(new Error('*** Time must be specied in seconds. (ex: 60s)'));
got.time = instructions ? util.format('%ds', time) : '';
}
putValue('ref', refs); if (headers.has('lanes')) {
putValue('bearing', bearings); got.lanes = (lanes || '').trim();
putValue('turns', turns); }
putValue('modes', modes);
putValue('classes', classes); if (headers.has('speed')) {
putValue('times', times); if (row.speed !== '' && instructions) {
putValue('distances', distances); if (!row.speed.match(/\d+ km\/h/))
putValue('pronunciations', pronunciations); cb(new Error('*** Speed must be specied in km/h. (ex: 50 km/h)'));
putValue('destinations', destinations); var speed = time > 0 ? Math.round(3.6*distance/time) : null;
putValue('exits', exits); got.speed = util.format('%d km/h', speed);
putValue('weight_name', weight_name); } else {
putValue('weights', weights); got.speed = '';
putValue('weight', weight); }
putValue('approach', approaches); }
if (headers.has('intersections')) {
got.intersections = (intersections || '').trim();
}
if (headers.has('locations')){
got.locations = (locations || '').trim();
}
// if header matches 'a:*', parse out the values for *
// and return in that header
headers.forEach((k) => {
let whitelist = ['duration', 'distance', 'datasources', 'nodes', 'weight', 'speed'];
if (k.match(/^a:/)) {
let a_type = k.slice(2);
if (whitelist.indexOf(a_type) == -1)
return cb(new Error('Unrecognized annotation field', a_type));
if (annotation && !annotation[a_type])
return cb(new Error('Annotation not found in response', a_type));
got[k] = annotation && annotation[a_type] || '';
}
});
var putValue = (key, value) => {
if (headers.has(key)) got[key] = instructions ? value : '';
};
putValue('ref', refs);
putValue('bearing', bearings);
putValue('turns', turns);
putValue('modes', modes);
putValue('times', times);
putValue('distances', distances);
putValue('pronunciations', pronunciations);
putValue('destinations', destinations);
putValue('weight_name', weight_name);
putValue('weights', weights);
putValue('weight', weight);
}
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])) {
@@ -219,39 +208,33 @@ module.exports = function () {
var params = this.overwriteParams(defaultParams, userParams), var params = this.overwriteParams(defaultParams, userParams),
waypoints = [], waypoints = [],
bearings = [], bearings = [];
approaches = [];
if (row.bearings) { if (row.bearings) {
got.bearings = row.bearings; got.bearings = row.bearings;
bearings = row.bearings.split(' ').filter(b => !!b); bearings = row.bearings.split(' ').filter(b => !!b);
} }
if (row.approaches) {
got.approaches = row.approaches;
approaches = row.approaches.split(' ').filter(b => !!b);
}
if (row.from && row.to) { if (row.from && row.to) {
var fromNode = this.findNodeByName(row.from); var fromNode = this.findNodeByName(row.from);
if (!fromNode) return cb(new Error(util.format('*** unknown from-node "%s"', row.from))); if (!fromNode) return cb(new Error(util.format('*** unknown from-node "%s"'), row.from));
waypoints.push(fromNode); waypoints.push(fromNode);
var toNode = this.findNodeByName(row.to); var toNode = this.findNodeByName(row.to);
if (!toNode) return cb(new Error(util.format('*** unknown to-node "%s"', row.to))); if (!toNode) return cb(new Error(util.format('*** unknown to-node "%s"'), row.to));
waypoints.push(toNode); waypoints.push(toNode);
got.from = row.from; got.from = row.from;
got.to = row.to; got.to = row.to;
this.requestRoute(waypoints, bearings, approaches, params, afterRequest); this.requestRoute(waypoints, bearings, params, afterRequest);
} else if (row.waypoints) { } else if (row.waypoints) {
row.waypoints.split(',').forEach((n) => { row.waypoints.split(',').forEach((n) => {
var node = this.findNodeByName(n.trim()); var node = this.findNodeByName(n.trim());
if (!node) return cb(new Error(util.format('*** unknown waypoint node "%s"', n.trim()))); if (!node) return cb(new Error('*** unknown waypoint node "%s"', n.trim()));
waypoints.push(node); waypoints.push(node);
}); });
got.waypoints = row.waypoints; got.waypoints = row.waypoints;
this.requestRoute(waypoints, bearings, approaches, params, afterRequest); this.requestRoute(waypoints, bearings, params, afterRequest);
} else { } else {
return cb(new Error('*** no waypoints')); return cb(new Error('*** no waypoints'));
} }
-35
View File
@@ -30,38 +30,3 @@ Feature: Alternative route
| 3 | 4 | bd,dc,ca,ab,bd,bd | | | 3 | 4 | bd,dc,ca,ab,bd,bd | |
| 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 | |
@4111
Scenario: Alternative Loop Paths with single node path
Given the node map
"""
a1b2c3d
e f
"""
And the ways
| nodes | maxspeed |
| ab | 30 |
| bc | 3 |
| cd | 30 |
| ae | 30 |
| ef | 30 |
| fd | 30 |
And the query options
| alternatives | true |
When I route I should get
| from | to | route | alternative |
| 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
-30
View File
@@ -1,30 +0,0 @@
@routing @speed @annotations @turn_penalty
Feature: Annotations
Background:
Given the profile "turnbot"
Given a grid size of 100 meters
Scenario: Ensure that turn penalties aren't included in annotations
Given the node map
"""
h i
j k l m
"""
And the query options
| annotations | duration,speed,weight |
And the ways
| nodes | highway |
| hk | residential |
| il | residential |
| jk | residential |
| lk | residential |
| lm | residential |
When I route I should get
| from | to | route | a:speed | a:weight |
| h | j | hk,jk,jk | 6.7:6.7 | 15:15 |
| i | m | il,lm,lm | 6.7:6.7 | 15:15 |
| j | m | jk,lm | 6.7:6.7:6.7 | 15:15:15 |
-192
View File
@@ -1,192 +0,0 @@
@routing @approach @testbot
Feature: Approach parameter
Background:
Given the profile "testbot"
And a grid size of 10 meters
Scenario: Start End same approach, option unrestricted for Start and End
Given 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 unrestricted | ab,bc |
Scenario: Start End same approach, option unrestricted for Start and curb for End
Given 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,bc |
Scenario: Start End opposite approach, option unrestricted for Start and End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Start End opposite approach, option unrestricted for Start and curb for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
###############
# Oneway Test #
###############
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and curb for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
##############
# UTurn Test #
##############
Scenario: UTurn test, router can't found a route because uturn unauthorized on the segment selected
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | bc | c | no_u_turn |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | |
Scenario: UTurn test, router can found a route because he can use the roundabout
Given the node map
"""
h
s e / \
a------b------c g
\ /
f
"""
And the ways
| nodes | junction |
| ab | |
| bc | |
| cfghc | roundabout |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | bc | c | no_u_turn |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc |
-5
View File
@@ -12,7 +12,6 @@ Feature: Testbot - Handle ferry routes
i j k l i j k l
m n o p m n o p
q r s t q r s t
u v w x
""" """
And the ways And the ways
@@ -27,14 +26,11 @@ Feature: Testbot - Handle ferry routes
| op | primary | | | | op | primary | | |
| qr | primary | | | | qr | primary | | |
| st | primary | | | | st | primary | | |
| uv | primary | | |
| wx | primary | | |
| bc | | ferry | 0:01 | | bc | | ferry | 0:01 |
| fg | | ferry | 0:10 | | fg | | ferry | 0:10 |
| jk | | ferry | 1:00 | | jk | | ferry | 1:00 |
| no | | ferry | 24:00 | | no | | ferry | 24:00 |
| rs | | ferry | 96:00 | | rs | | ferry | 96:00 |
| vw | | ferry | P5D |
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
@@ -43,7 +39,6 @@ Feature: Testbot - Handle ferry routes
| j | k | jk,jk | 3600s +-1 | | j | k | jk,jk | 3600s +-1 |
| n | o | no,no | 86400s +-1 | | n | o | no,no | 86400s +-1 |
| r | s | rs,rs | 345600s +-1 | | r | s | rs,rs | 345600s +-1 |
| v | w | vw,vw | 419430s +-1|
@todo @todo
Scenario: Testbot - Week long ferry routes Scenario: Testbot - Week long ferry routes
+7 -106
View File
@@ -4,6 +4,7 @@ Feature: Basic Map Matching
Background: Background:
Given the profile "testbot" Given the profile "testbot"
Given a grid size of 10 meters Given a grid size of 10 meters
Given the extract extra arguments "--generate-edge-lookup"
Given the query options Given the query options
| geometries | geojson | | geometries | geojson |
@@ -39,84 +40,6 @@ Feature: Basic Map Matching
| trace | timestamps | matchings | | trace | timestamps | matchings |
| abcd | 0 1 62 63 | ab,cd | | abcd | 0 1 62 63 | ab,cd |
Scenario: Testbot - Map matching with trace splitting suppression
Given the query options
| gaps | ignore |
Given the node map
"""
a b c d
e
"""
And the ways
| nodes | oneway |
| abcd | no |
When I match I should get
| trace | timestamps | matchings |
| abcd | 0 1 62 63 | abcd |
Scenario: Testbot - Map matching with trace tidying. Clean case.
Given a grid size of 100 meters
Given the query options
| tidy | true |
Given the node map
"""
a b c d
e
"""
And the ways
| nodes | oneway |
| abcd | no |
When I match I should get
| trace | timestamps | matchings |
| abcd | 0 10 20 30 | abcd |
Scenario: Testbot - Map matching with trace tidying. Dirty case by ts.
Given a grid size of 100 meters
Given the query options
| tidy | true |
Given the node map
"""
a b c d
e
"""
And the ways
| nodes | oneway |
| abcd | no |
When I match I should get
| trace | timestamps | matchings |
| abacd | 0 10 12 20 30 | abcd |
Scenario: Testbot - Map matching with trace tidying. Dirty case by dist.
Given a grid size of 8 meters
Given the query options
| tidy | true |
Given the node map
"""
a q b c d
e
"""
And the ways
| nodes | oneway |
| aqbcd | no |
When I match I should get
| trace | matchings |
| abcbd | abbd |
Scenario: Testbot - Map matching with core factor Scenario: Testbot - Map matching with core factor
Given the contract extra arguments "--core 0.8" Given the contract extra arguments "--core 0.8"
Given the node map Given the node map
@@ -212,7 +135,7 @@ Feature: Basic Map Matching
And the speed file And the speed file
""" """
1,2,36,10 1,2,36
""" """
And the contract extra arguments "--segment-speed-file {speeds_file}" And the contract extra arguments "--segment-speed-file {speeds_file}"
@@ -239,7 +162,7 @@ Feature: Basic Map Matching
And the speed file And the speed file
""" """
1,2,36,10 1,2,36
""" """
And the contract extra arguments "--segment-speed-file {speeds_file}" And the contract extra arguments "--segment-speed-file {speeds_file}"
@@ -358,8 +281,8 @@ Feature: Basic Map Matching
| trace | matchings | alternatives | | trace | matchings | alternatives |
| abcdef | abcde | 0,0,0,0,1,1 | | abcdef | abcde | 0,0,0,0,1,1 |
Scenario: Testbot - Speed greater than speed threshold Scenario: Testbot - Speed greater than speed threshhold
Given a grid size of 100 meters Given a grid size of 10 meters
Given the query options Given the query options
| geometries | geojson | | geometries | geojson |
@@ -379,8 +302,8 @@ Feature: Basic Map Matching
| trace | timestamps | matchings | | trace | timestamps | matchings |
| abcd | 0 1 2 3 | ab,cd | | abcd | 0 1 2 3 | ab,cd |
Scenario: Testbot - Speed less than speed threshold Scenario: Testbot - Speed less than speed threshhold
Given a grid size of 100 meters Given a grid size of 10 meters
Given the query options Given the query options
| geometries | geojson | | geometries | geojson |
@@ -397,28 +320,6 @@ Feature: Basic Map Matching
| trace | timestamps | matchings | | trace | timestamps | matchings |
| abcd | 0 1 2 3 | abcd | | abcd | 0 1 2 3 | abcd |
Scenario: Testbot - Huge gap in the coordinates
Given a grid size of 100 meters
Given the query options
| geometries | geojson |
| gaps | ignore |
Given the node map
"""
a b c d ---- x
|
|
y ---- z ---- efjk
"""
And the ways
| nodes | oneway |
| abcdxyzefjk | no |
When I match I should get
| trace | timestamps | matchings |
| abcdefjk | 0 1 2 3 50 51 52 53 | abcdefjk |
# Regression test 1 for issue 3176 # Regression test 1 for issue 3176
Scenario: Testbot - multiple segments: properly expose OSM IDs Scenario: Testbot - multiple segments: properly expose OSM IDs
Given the query options Given the query options
+10 -68
View File
@@ -3,7 +3,7 @@ Feature: Multi level routing
Background: Background:
Given the profile "testbot" Given the profile "testbot"
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 4,16,64" And the partition extra arguments "--min-cell-size 4 --small-component-size 1"
Scenario: Testbot - Multi level routing check partition Scenario: Testbot - Multi level routing check partition
Given the node map Given the node map
@@ -31,7 +31,7 @@ Feature: Multi level routing
| be | primary | | be | primary |
And the data has been extracted And the data has been extracted
When I run "osrm-partition --max-cell-sizes 4,16 --small-component-size 1 {processed_file}" When I run "osrm-partition --min-cell-size 4 --small-component-size 1 {processed_file}"
Then it should exit successfully Then it should exit successfully
And stdout should not contain "level 1 #cells 1 bit size 1" And stdout should not contain "level 1 #cells 1 bit size 1"
@@ -48,40 +48,22 @@ Feature: Multi level routing
lkpo lkpo
""" """
And the nodes
| node | highway |
| i | traffic_signals |
| n | traffic_signals |
And the ways And the ways
| nodes | highway | | nodes | highway |
| abcda | primary | | abcda | primary |
| efghe | primary | | efghe | primary |
| ijkli | primary | | ijkli | primary |
| mnopm | primary | | nmop | primary |
| cm | primary | | cm | primary |
| hj | primary | | hj | primary |
| kp | primary | | kp | primary |
And the partition extra arguments "--min-cell-size 4 --small-component-size 1"
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | b | abcda,abcda | 20s | | a | b | abcda,abcda | 20s |
| a | f | abcda,cm,mnopm,kp,ijkli,hj,efghe,efghe | 229.4s | | a | f | abcda,cm,nmop,kp,ijkli,hj,efghe,efghe | 257.7s |
| a | l | abcda,cm,mnopm,kp,ijkli,ijkli | 144.7s | | c | m | cm,cm | 44.7s |
| a | o | abcda,cm,mnopm,mnopm,mnopm | 124.7s |
| f | l | efghe,hj,ijkli,ijkli,ijkli | 124.7s |
| f | o | efghe,hj,ijkli,kp,mnopm,mnopm | 144.7s |
| l | o | ijkli,kp,mnopm,mnopm | 60s |
| c | m | cm,cm | 44.7s |
When I request a travel time matrix I should get
| | a | f | l | o |
| a | 0 | 229.4 | 144.7 | 124.7 |
| f | 229.4 | 0 | 124.7 | 144.7 |
| l | 144.7 | 124.7 | 0 | 60 |
| o | 124.7 | 144.7 | 60 | 0 |
Scenario: Testbot - Multi level routing: horizontal road Scenario: Testbot - Multi level routing: horizontal road
Given the node map Given the node map
@@ -106,6 +88,7 @@ Feature: Multi level routing
| dim | primary | | dim | primary |
| glr | primary | | glr | primary |
| ot | secondary | | ot | secondary |
And the partition extra arguments "--min-cell-size 4 --small-component-size 1"
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
@@ -130,7 +113,6 @@ Feature: Multi level routing
lk lk
""" """
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 4,16"
And the ways And the ways
| nodes | maxspeed | | nodes | maxspeed |
| abcda | 5 | | abcda | 5 |
@@ -142,48 +124,8 @@ Feature: Multi level routing
| fi | 15 | | fi | 15 |
| gi | 15 | | gi | 15 |
| hf | 100 | | hf | 100 |
And the partition extra arguments "--min-cell-size 4 --small-component-size 1"
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | k | abcda,ch,hf,fi,ijkli,ijkli | 724.3s | | a | k | abcda,ch,hf,fi,ijkli,ijkli | 724.3s |
Scenario: Testbot - Edge case for matrix plugin with
Given the node map
"""
ab
dc
e f
h gi
"""
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 5,16,64"
And the nodes
| node | highway |
| e | traffic_signals |
| g | traffic_signals |
And the ways
| nodes | highway | maxspeed |
| abcda | primary | |
| ac | primary | |
| db | primary | |
| deh | primary | |
| cfg | primary | |
| ef | primary | 1 |
| eg | primary | 1 |
| hf | primary | 1 |
| hg | primary | 1 |
| gi | primary | |
When I route I should get
| from | to | route | time |
| h | i | deh,abcda,cfg,gi,gi | 134s |
When I request a travel time matrix I should get
| | h | i |
| h | 0 | 134 |
| i | 134 | 0 |
-1
View File
@@ -14,7 +14,6 @@ Feature: Testbot - Check assigning nil values
result.name = nil result.name = nil
result.ref = nil result.ref = nil
result.destinations = nil result.destinations = nil
result.exits = nil
result.pronunciation = nil result.pronunciation = nil
result.turn_lanes_forward = nil result.turn_lanes_forward = nil
result.turn_lanes_backward = nil result.turn_lanes_backward = nil
-35
View File
@@ -36,38 +36,3 @@ Feature: Projection to nearest point on road
| from | to | route | distance | | from | to | route | distance |
| d | b | abc,abc | 0m | | d | b | abc,abc | 0m |
| b | d | abc,abc | 0m | | b | d | abc,abc | 0m |
Scenario: Projection results negative duration
Given the profile file "testbot" extended with
"""
api_version = 1
function segment_function (segment)
segment.weight = 5.5
segment.duration = 2.8
end
"""
Given the node locations
| node | lon | lat |
| e | -51.218994 | -30.023866 |
| f | -51.218918 | -30.023741 |
| 1 | -51.219109 | -30.023766 |
| 2 | -51.219109 | -30.023764 |
| 3 | -51.219109 | -30.023763 |
| 4 | -51.219109 | -30.023762 |
| 5 | -51.219109 | -30.023761 |
| 6 | -51.219109 | -30.023756 |
And the ways
| nodes |
| ef |
When I route I should get
| waypoints | route | distance | time | weight |
| 1,4 | ef,ef | 0.4m | 0.1s | 0.1 |
| 2,4 | ef,ef | 0.1m | 0s | 0 |
| 3,4 | ef,ef | 0.1m | 0s | 0 |
| 4,4 | ef,ef | 0m | 0s | 0 |
| 5,4 | ef,ef | 0.1m | 0s | 0.1 |
| 6,4 | ef,ef | 0.6m | 0.1s | 0.2 |
+41 -56
View File
@@ -2,22 +2,15 @@
Feature: Traffic - speeds Feature: Traffic - speeds
Background: Use specific speeds Background: Use specific speeds
# __ a
# / /
#c----b / g
# \ |\/
# \ e/\_.f
# \ | /
# d./
Given the node locations Given the node locations
| node | lat | lon | id | | node | lat | lon |
| a | 0.1 | 0.1 | 1 | | a | 0.1 | 0.1 |
| b | 0.05 | 0.1 | 2 | | b | 0.05 | 0.1 |
| c | 0.0 | 0.1 | 3 | | c | 0.0 | 0.1 |
| d | 0.05 | 0.03 | 4 | | d | 0.05 | 0.03 |
| e | 0.05 | 0.066 | 5 | | e | 0.05 | 0.066 |
| f | 0.075 | 0.066 | 6 | | f | 0.075 | 0.066 |
| g | 0.075 | 0.1 | 7 | | g | 0.075 | 0.1 |
And the ways And the ways
| nodes | highway | | nodes | highway |
| ab | primary | | ab | primary |
@@ -29,6 +22,7 @@ Feature: Traffic - speeds
| df | primary | | df | primary |
| fb | primary | | fb | primary |
And the profile "testbot" And the profile "testbot"
And the extract extra arguments "--generate-edge-lookup"
Scenario: Weighting based on speed file Scenario: Weighting based on speed file
@@ -36,12 +30,12 @@ Feature: Traffic - speeds
And the customize extra arguments "--segment-speed-file {speeds_file}" And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file And the speed file
""" """
1,2,0,0 1,2,0
2,1,0,0 2,1,0
2,3,27,7.5 2,3,27
3,2,27,7.5 3,2,27
1,4,27,7.5 1,4,27
4,1,27,7.5 4,1,27
""" """
And the query options And the query options
| annotations | datasources | | annotations | datasources |
@@ -62,12 +56,12 @@ Feature: Traffic - speeds
And the customize extra arguments "--segment-speed-file {speeds_file}" And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file And the speed file
""" """
1,2,1,0.2777777 1,2,1,20020.7
2,1,1 2,1,1,20020.7
2,3,27 2,3,27,741.5
3,2,27,7.5 3,2,27,741.5
1,4,27,7.5 1,4,27,1275.7
4,1,27,7.5 4,1,27,1275.7
""" """
And the query options And the query options
| annotations | datasources | | annotations | datasources |
@@ -89,32 +83,32 @@ Feature: Traffic - speeds
api_version = 1 api_version = 1
properties.traffic_signal_penalty = 0 properties.traffic_signal_penalty = 0
properties.u_turn_penalty = 0 properties.u_turn_penalty = 0
properties.weight_precision = 2 properties.weight_precision = 3
""" """
And the contract extra arguments "--segment-speed-file {speeds_file}" And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}" And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file And the speed file
""" """
1,2,1,0.27777777 1,2,1,20020.789
2,1,1,0.27777777 2,1,1,20020.123
2,3,27,7.5 2,3,27,741.56789
3,2,27 3,2,27,741.3
1,4,1 1,4,1,34445.12
4,1,1 4,1,1,34445.3
""" """
And the query options And the query options
| annotations | datasources | | annotations | datasources |
When I route I should get When I route I should get
| from | to | route | speed | weights | a:datasources | | from | to | route | speed | weights | a:datasources |
| a | b | ab,ab | 1 km/h | 20020.73,0 | 1:0 | | a | b | ab,ab | 1 km/h | 20020.789,0 | 1:0 |
| a | c | ab,bc,bc | 2 km/h | 20020.73,741.51,0 | 1:1:0 | | a | c | ab,bc,bc | 2 km/h | 20020.789,741.568,0 | 1:1:0 |
| b | c | bc,bc | 27 km/h | 741.51,0 | 1:0 | | b | c | bc,bc | 27 km/h | 741.568,0 | 1:0 |
| a | d | ab,eb,de,de | 2 km/h | 20020.73,378.17,400.41,0 | 1:0:0 | | a | d | ab,eb,de,de | 2 km/h | 20020.789,378.169,400.415,0 | 1:0:0 |
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 | | d | c | dc,dc | 36 km/h | 956.805,0 | 0 |
| g | b | ab,ab | 1 km/h | 10010.37,0 | 1:0 | | g | b | ab,ab | 1 km/h | 10010.392,0 | 1:0 |
| a | g | ab,ab | 1 km/h | 10010.36,0 | 1 | | a | g | ab,ab | 1 km/h | 10010.397,0 | 1 |
| g | a | ab,ab | 1 km/h | 10010.36,0 | 1:1 | | g | a | ab,ab | 1 km/h | 10010.064,0 | 1:1 |
Scenario: Speeds that isolate a single node (a) Scenario: Speeds that isolate a single node (a)
@@ -127,10 +121,10 @@ Feature: Traffic - speeds
""" """
1,2,0 1,2,0
2,1,0 2,1,0
2,3,27,7.5 2,3,27
3,2,27,7.5 3,2,27
1,4,0,0 1,4,0
4,1,0,0 4,1,0
""" """
And the query options And the query options
| annotations | true | | annotations | true |
@@ -160,12 +154,3 @@ Feature: Traffic - speeds
When I try to run "osrm-contract --segment-speed-file {speeds_file} {processed_file}" When I try to run "osrm-contract --segment-speed-file {speeds_file} {processed_file}"
And stderr should contain "malformed" And stderr should contain "malformed"
And it should exit with an error And it should exit with an error
Scenario: Check with an empty speed file
Given the speed file
"""
"""
And the data has been extracted
When I try to run "osrm-contract --segment-speed-file {speeds_file} {processed_file}"
And it should exit successfully
@@ -1,30 +0,0 @@
@routing @speed @traffic
Feature: Traffic - speeds edge cases
Scenario: Weighting based on speed file weights that cause segment weight overflows
Given the node map
"""
a-----b
"""
And the ways
| nodes | highway |
| ab | primary |
And the profile file "testbot" extended with
"""
api_version = 1
properties.traffic_signal_penalty = 0
properties.u_turn_penalty = 0
properties.weight_precision = 2
"""
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,1,0.001
2,1,1,0.001
"""
And the query options
| annotations | datasources |
When I route I should get
| from | to | route | speed | weights | a:datasources |
| a | b | ab,ab | 1 km/h | 41943.02,0 | 1 |
@@ -31,6 +31,7 @@ Feature: Traffic - turn penalties applied to turn onto which a phantom node snap
| dg | primary | | dg | primary |
And the profile "testbot" And the profile "testbot"
# Since testbot doesn't have turn penalties, a penalty from file of 0 should produce a neutral effect # Since testbot doesn't have turn penalties, a penalty from file of 0 should produce a neutral effect
And the extract extra arguments "--generate-edge-lookup"
Scenario: Weighting based on turn penalty file, with an extreme negative value -- clamps and does not fail Scenario: Weighting based on turn penalty file, with an extreme negative value -- clamps and does not fail
Given the turn penalty file Given the turn penalty file
-36
View File
@@ -1,36 +0,0 @@
@routing @testbot @turn_penalty
Feature: Turn Penalties
Background:
Given the profile "turnbot"
Given a grid size of 200 meters
Scenario: Turns should incur a delay that depend on the angle
Given the node map
"""
c d e
b j f
a s g
"""
And the ways
| nodes |
| sj |
| ja |
| jb |
| jc |
| jd |
| je |
| jf |
| jg |
When I route I should get
| from | to | route | time | distance |
| s | a | sj,ja,ja | 63s +-1 | 483m +-1 |
| s | b | sj,jb,jb | 50s +-1 | 400m +-1 |
| s | c | sj,jc,jc | 54s +-1 | 483m +-1 |
| s | d | sj,jd,jd | 40s +-1 | 400m +-1 |
| s | e | sj,je,je | 53s +-1 | 483m +-1 |
| s | f | sj,jf,jf | 50s +-1 | 400m +-1 |
| s | g | sj,jg,jg | 63s +-1 | 483m +-1 |
+31 -64
View File
@@ -224,6 +224,34 @@ Feature: Via points
| a,d,c | abc,bd,bd,bd,abc,abc | | a,d,c | abc,bd,bd,bd,abc,abc |
| c,d,a | abc,bd,bd,bd,abc,abc | | c,d,a | abc,bd,bd,bd,abc,abc |
# See issue #1896
Scenario: Via point at a dead end with barrier
Given the profile "car"
Given the node map
"""
a b c
1
d
f e
"""
And the nodes
| node | barrier |
| d | bollard |
And the ways
| nodes |
| abc |
| bd |
| afed |
When I route I should get
| waypoints | route |
| a,1,c | abc,bd,bd,bd,bd,abc,abc |
| c,1,a | abc,bd,bd,bd,bd,abc,abc |
Scenario: Via points on ring on the same oneway, forces one of the vertices to be top node Scenario: Via points on ring on the same oneway, forces one of the vertices to be top node
Given the node map Given the node map
""" """
@@ -321,67 +349,6 @@ Feature: Via points
| ab | | ab |
When I route I should get When I route I should get
| waypoints | bearings | route | turns | | waypoints | bearings | route | turns |
| 1,a | 90,2 270,2 | ab,ab,ab | depart,continue uturn,arrive | | 1,a | 90,2 270,2 | ab,ab,ab | depart,turn uturn,arrive |
| 1,b | 270,2 90,2 | ab,ab,ab | depart,continue uturn,arrive | | 1,b | 270,2 90,2 | ab,ab,ab | depart,turn uturn,arrive |
Scenario: Continue Straight in presence of Bearings
Given the node map
"""
h - a 1 b -- g
| |
| |- 2 c - f
| 3
e ------ d - i
|
j
"""
And the query options
| continue_straight | false |
And the ways
| nodes | oneway |
| ab | no |
| bc | no |
| cdea | no |
| ah | yes |
| bg | yes |
| cf | yes |
| di | yes |
| dj | yes |
When I route I should get
| waypoints | bearings | route |
| 1,2,3 | 270,90 180,180 180,180 | ab,cdea,cdea,bc,bc,bc,cdea,cdea |
Scenario: Continue Straight in presence of Bearings
Given the node map
"""
h - a 1 b -- g
| |
| |- 2 c - f
| 3
e ------ d - i
|
j
"""
And the query options
| continue_straight | true |
And the ways
| nodes | oneway |
| ab | no |
| bc | no |
| cdea | no |
| ah | yes |
| bg | yes |
| cf | yes |
| di | yes |
| dj | yes |
When I route I should get
| waypoints | bearings | route |
| 1,2,3 | 270,90 180,180 180,180 | ab,cdea,cdea,bc,bc,bc,ab,cdea,cdea,cdea |
+5 -4
View File
@@ -4,6 +4,7 @@ Feature: Weight tests
Background: Background:
Given the profile "testbot" Given the profile "testbot"
Given a grid size of 10 meters Given a grid size of 10 meters
Given the extract extra arguments "--generate-edge-lookup"
Given the query options Given the query options
| geometries | geojson | | geometries | geojson |
@@ -283,8 +284,8 @@ Feature: Weight tests
When I route I should get When I route I should get
| waypoints | route | distance | weights | times | | waypoints | route | distance | weights | times |
| a,d | , | 59.9m | 20.5,0 | 24s,0s | | a,d | , | 59.9m | 62,0 | 24s,0s |
| a,e | ,, | 60.1m | 27.2,10,0 | 38.5s,11s,0s | | a,e | ,, | 60.1m | 68.7,10,0 | 38.5s,11s,0s |
| d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s | | d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s |
@traffic @speed @traffic @speed
@@ -319,6 +320,6 @@ Feature: Weight tests
When I route I should get When I route I should get
| waypoints | route | distance | weights | times | | waypoints | route | distance | weights | times |
| a,d | abcd,abcd | 59.9m | 6.996,0 | 7s,0s | | a,d | abcd,abcd | 59.9m | 6.993,0 | 7s,0s |
| a,e | abcd,ce,ce | 60.1m | 6.005,2.002,0 | 6s,2s,0s | | a,e | abcd,ce,ce | 60.1m | 6.002,2.002,0 | 6s,2s,0s |
| d,e | abcd,ce,ce | 39.9m | 1.991,2.002,0 | 2s,2s,0s | | d,e | abcd,ce,ce | 39.9m | 1.991,2.002,0 | 2s,2s,0s |
-166
View File
@@ -1,166 +0,0 @@
Feature: Check zero speed updates
Background:
Given the profile "testbot"
Scenario: Matching on restricted way, single segment
Given the query options
| geometries | geojson |
| annotations | true |
Given the node map
"""
a-1--b--c-2-d
"""
And the ways
| nodes |
| abcd |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,3,0
"""
When I match I should get
| trace | code |
| 12 | NoMatch |
Scenario: Matching restricted way, both segments
Given the node map
"""
a-1--b-2-c
"""
And the ways
| nodes | oneway |
| abc | no |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,3,0
3,2,0
"""
When I match I should get
| trace | code |
| 12 | NoMatch |
Scenario: Matching on restricted oneway
Given the node map
"""
a-1--b-2-c
"""
And the ways
| nodes | oneway |
| abc | yes |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,3,0
"""
When I match I should get
| trace | code |
| 12 | NoMatch |
Scenario: Routing on restricted way
Given the node map
"""
a-1-b-2-c
"""
And the ways
| nodes | oneway |
| abc | no |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,3,0
3,2,0
"""
When I route I should get
| from | to | code |
| 1 | 2 | NoRoute |
Scenario: Routing on restricted oneway
Given the node map
"""
a-1-b-2-c
"""
And the ways
| nodes | oneway |
| abc | yes |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,3,0
3,2,0
"""
When I route I should get
| from | to | bearings | code |
| 1 | 2 | 270 270 | NoSegment |
Scenario: Via routing on restricted oneway
Given the node map
"""
a-1-b-2-c-3-d
"""
And the ways
| nodes | oneway |
| abc | no |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,3,0
3,2,0
"""
When I route I should get
| waypoints | code |
| 1,2,3 | NoRoute |
| 3,2,1 | NoRoute |
@trip
Scenario: Trip
Given the node map
"""
a b
c d
"""
And the ways
| nodes |
| ab |
| bc |
| cb |
| da |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,0
2,1,0
"""
When I plan a trip I should get
| waypoints | trips | code |
| a,b,c,d | abcda | NoTrips |
| d,b,c,a | dbcad | NoTrips |
+14 -1
View File
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "contractor/contractor_config.hpp" #include "contractor/contractor_config.hpp"
#include "contractor/query_edge.hpp" #include "contractor/query_edge.hpp"
#include "extractor/edge_based_edge.hpp" #include "extractor/edge_based_edge.hpp"
#include "extractor/edge_based_node_segment.hpp" #include "extractor/edge_based_node.hpp"
#include "util/deallocating_vector.hpp" #include "util/deallocating_vector.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
@@ -65,9 +65,22 @@ class Contractor
std::vector<EdgeWeight> &&node_weights, std::vector<EdgeWeight> &&node_weights,
std::vector<bool> &is_core_node, std::vector<bool> &is_core_node,
std::vector<float> &inout_node_levels) const; std::vector<float> &inout_node_levels) const;
void WriteCoreNodeMarker(std::vector<bool> &&is_core_node) const;
void WriteNodeLevels(std::vector<float> &&node_levels) const;
void ReadNodeLevels(std::vector<float> &contraction_order) const;
std::size_t
WriteContractedGraph(unsigned number_of_edge_based_nodes,
const util::DeallocatingVector<QueryEdge> &contracted_edge_list);
void FindComponents(unsigned max_edge_id,
const util::DeallocatingVector<extractor::EdgeBasedEdge> &edges,
std::vector<extractor::EdgeBasedNode> &nodes) const;
private: private:
ContractorConfig config; ContractorConfig config;
EdgeID LoadEdgeExpandedGraph(const ContractorConfig &config,
std::vector<extractor::EdgeBasedEdge> &edge_based_edge_list,
std::vector<EdgeWeight> &node_weights);
}; };
} }
} }
+6 -6
View File
@@ -1,7 +1,7 @@
#ifndef OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_ #ifndef OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_
#define OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_ #define OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_
#include "util/query_heap.hpp" #include "util/binary_heap.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include "util/xor_fast_hash_storage.hpp" #include "util/xor_fast_hash_storage.hpp"
@@ -18,11 +18,11 @@ struct ContractorHeapData
bool target = false; bool target = false;
}; };
using ContractorHeap = util::QueryHeap<NodeID, using ContractorHeap = util::BinaryHeap<NodeID,
NodeID, NodeID,
EdgeWeight, EdgeWeight,
ContractorHeapData, ContractorHeapData,
util::XORFastHashStorage<NodeID, NodeID>>; util::XORFastHashStorage<NodeID, NodeID>>;
} // namespace contractor } // namespace contractor
} // namespace osrm } // namespace osrm
-90
View File
@@ -1,90 +0,0 @@
#ifndef OSRM_CONTRACTOR_FILES_HPP
#define OSRM_CONTRACTOR_FILES_HPP
#include "contractor/query_graph.hpp"
#include "util/serialization.hpp"
#include "storage/io.hpp"
#include "storage/serialization.hpp"
namespace osrm
{
namespace contractor
{
namespace files
{
// reads .osrm.core
template <typename CoreVectorT>
void readCoreMarker(const boost::filesystem::path &path, CoreVectorT &is_core_node)
{
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
"is_core_node must be a vector");
storage::io::FileReader reader(path, storage::io::FileReader::VerifyFingerprint);
storage::serialization::read(reader, is_core_node);
}
// writes .osrm.core
template <typename CoreVectorT>
void writeCoreMarker(const boost::filesystem::path &path, const CoreVectorT &is_core_node)
{
static_assert(util::is_view_or_vector<bool, CoreVectorT>::value,
"is_core_node must be a vector");
storage::io::FileWriter writer(path, storage::io::FileWriter::GenerateFingerprint);
storage::serialization::write(writer, is_core_node);
}
// reads .osrm.hsgr file
template <typename QueryGraphT>
inline void readGraph(const boost::filesystem::path &path, unsigned &checksum, QueryGraphT &graph)
{
static_assert(std::is_same<QueryGraphView, QueryGraphT>::value ||
std::is_same<QueryGraph, QueryGraphT>::value,
"graph must be of type QueryGraph<>");
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
reader.ReadInto(checksum);
util::serialization::read(reader, graph);
}
// writes .osrm.hsgr file
template <typename QueryGraphT>
inline void
writeGraph(const boost::filesystem::path &path, unsigned checksum, const QueryGraphT &graph)
{
static_assert(std::is_same<QueryGraphView, QueryGraphT>::value ||
std::is_same<QueryGraph, QueryGraphT>::value,
"graph must be of type QueryGraph<>");
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};
writer.WriteOne(checksum);
util::serialization::write(writer, graph);
}
// 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);
}
}
}
}
#endif
+8 -25
View File
@@ -14,6 +14,8 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <stxxl/vector>
#include <tbb/enumerable_thread_specific.h> #include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h> #include <tbb/parallel_sort.h>
@@ -23,10 +25,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm namespace osrm
{ {
namespace contractor namespace contractor
@@ -35,12 +33,6 @@ namespace contractor
class GraphContractor class GraphContractor
{ {
private: private:
#if USE_STXXL_LIBRARY
template <typename T> using ExternalVector = stxxl::vector<T>;
#else
template <typename T> using ExternalVector = std::vector<T>;
#endif
struct ContractorThreadData struct ContractorThreadData
{ {
ContractorDijkstra dijkstra; ContractorDijkstra dijkstra;
@@ -99,8 +91,8 @@ class GraphContractor
GraphContractor(int nodes, GraphContractor(int nodes,
std::vector<ContractorEdge> edges, std::vector<ContractorEdge> edges,
std::vector<float> node_levels_, std::vector<float> &&node_levels_,
std::vector<EdgeWeight> node_weights_); std::vector<EdgeWeight> &&node_weights_);
/* Flush all data from the contraction to disc and reorder stuff for better locality */ /* Flush all data from the contraction to disc and reorder stuff for better locality */
void FlushDataAndRebuildContractorGraph(ThreadDataContainer &thread_data_list, void FlushDataAndRebuildContractorGraph(ThreadDataContainer &thread_data_list,
@@ -109,14 +101,12 @@ class GraphContractor
void Run(double core_factor = 1.0); void Run(double core_factor = 1.0);
std::vector<bool> GetCoreMarker(); void GetCoreMarker(std::vector<bool> &out_is_core_node);
std::vector<float> GetNodeLevels(); void GetNodeLevels(std::vector<float> &out_node_levels);
template <class Edge> inline util::DeallocatingVector<Edge> GetEdges() template <class Edge> inline void GetEdges(util::DeallocatingVector<Edge> &edges)
{ {
util::DeallocatingVector<Edge> edges;
util::UnbufferedLog log; util::UnbufferedLog log;
log << "Getting edges of minimized graph "; log << "Getting edges of minimized graph ";
util::Percent p(log, contractor_graph->GetNumberOfNodes()); util::Percent p(log, contractor_graph->GetNumberOfNodes());
@@ -171,13 +161,6 @@ class GraphContractor
edges.append(external_edge_list.begin(), external_edge_list.end()); edges.append(external_edge_list.begin(), external_edge_list.end());
external_edge_list.clear(); external_edge_list.clear();
// sort and remove duplicates
tbb::parallel_sort(edges.begin(), edges.end());
auto new_end = std::unique(edges.begin(), edges.end());
edges.resize(new_end - edges.begin());
return edges;
} }
private: private:
@@ -409,7 +392,7 @@ class GraphContractor
bool Bias(const NodeID a, const NodeID b) const; bool Bias(const NodeID a, const NodeID b) const;
std::shared_ptr<ContractorGraph> contractor_graph; std::shared_ptr<ContractorGraph> contractor_graph;
ExternalVector<QueryEdge> external_edge_list; stxxl::vector<QueryEdge> external_edge_list;
std::vector<NodeID> orig_node_id_from_new_node_id_map; std::vector<NodeID> orig_node_id_from_new_node_id_map;
std::vector<float> node_levels; std::vector<float> node_levels;
-25
View File
@@ -1,25 +0,0 @@
#ifndef OSRM_CONTRACTOR_QUERY_GRAPH_HPP
#define OSRM_CONTRACTOR_QUERY_GRAPH_HPP
#include "contractor/query_edge.hpp"
#include "util/static_graph.hpp"
#include "util/typedefs.hpp"
namespace osrm
{
namespace contractor
{
namespace detail
{
template <storage::Ownership Ownership>
using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>;
}
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
}
}
#endif // QUERYEDGE_HPP
+41 -76
View File
@@ -3,10 +3,9 @@
#include "partition/cell_storage.hpp" #include "partition/cell_storage.hpp"
#include "partition/multi_level_partition.hpp" #include "partition/multi_level_partition.hpp"
#include "util/query_heap.hpp" #include "util/binary_heap.hpp"
#include <tbb/enumerable_thread_specific.h>
#include <boost/thread/tss.hpp>
#include <unordered_set> #include <unordered_set>
namespace osrm namespace osrm
@@ -16,23 +15,12 @@ namespace customizer
class CellCustomizer class CellCustomizer
{ {
private:
struct HeapData
{
bool from_clique;
EdgeDuration duration;
};
public: public:
using Heap =
util::QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
using HeapPtr = tbb::enumerable_thread_specific<Heap>;
CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {} CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {}
template <typename GraphT> template <typename GraphT>
void Customize( void Customize(const GraphT &graph, partition::CellStorage &cells, LevelID level, CellID id)
const GraphT &graph, Heap &heap, partition::CellStorage &cells, LevelID level, CellID id)
{ {
auto cell = cells.GetCell(level, id); auto cell = cells.GetCell(level, id);
auto destinations = cell.GetDestinationNodes(); auto destinations = cell.GetDestinationNodes();
@@ -41,111 +29,89 @@ class CellCustomizer
for (auto source : cell.GetSourceNodes()) for (auto source : cell.GetSourceNodes())
{ {
std::unordered_set<NodeID> destinations_set(destinations.begin(), destinations.end()); std::unordered_set<NodeID> destinations_set(destinations.begin(), destinations.end());
heap.Clear(); Heap heap(graph.GetNumberOfNodes());
heap.Insert(source, 0, {false, 0}); heap.Insert(source, 0, {});
// explore search space // explore search space
while (!heap.Empty() && !destinations_set.empty()) while (!heap.Empty() && !destinations_set.empty())
{ {
const NodeID node = heap.DeleteMin(); const NodeID node = heap.DeleteMin();
const EdgeWeight weight = heap.GetKey(node); const EdgeWeight weight = heap.GetKey(node);
const EdgeDuration duration = heap.GetData(node).duration;
if (level == 1) if (level == 1)
RelaxNode<true>(graph, cells, heap, level, node, weight, duration); RelaxNode<true>(graph, cells, heap, level, id, node, weight);
else else
RelaxNode<false>(graph, cells, heap, level, node, weight, duration); RelaxNode<false>(graph, cells, heap, level, id, node, weight);
destinations_set.erase(node); destinations_set.erase(node);
} }
// fill a map of destination nodes to placeholder pointers // fill a map of destination nodes to placeholder pointers
auto weights = cell.GetOutWeight(source); auto destination_iter = destinations.begin();
auto durations = cell.GetOutDuration(source); for (auto &weight : cell.GetOutWeight(source))
for (auto &destination : destinations)
{ {
BOOST_ASSERT(!weights.empty()); BOOST_ASSERT(destination_iter != destinations.end());
BOOST_ASSERT(!durations.empty()); const auto destination = *destination_iter++;
weight =
const bool inserted = heap.WasInserted(destination); heap.WasInserted(destination) ? heap.GetKey(destination) : INVALID_EDGE_WEIGHT;
weights.front() = inserted ? heap.GetKey(destination) : INVALID_EDGE_WEIGHT;
durations.front() =
inserted ? heap.GetData(destination).duration : MAXIMAL_EDGE_DURATION;
weights.advance_begin(1);
durations.advance_begin(1);
} }
BOOST_ASSERT(weights.empty());
BOOST_ASSERT(durations.empty());
} }
} }
template <typename GraphT> void Customize(const GraphT &graph, partition::CellStorage &cells) template <typename GraphT> void Customize(const GraphT &graph, partition::CellStorage &cells)
{ {
Heap heap_exemplar(graph.GetNumberOfNodes());
HeapPtr heaps(heap_exemplar);
for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level) for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level)
{ {
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, partition.GetNumberOfCells(level)), tbb::parallel_for(tbb::blocked_range<std::size_t>(0, partition.GetNumberOfCells(level)),
[&](const tbb::blocked_range<std::size_t> &range) { [&](const tbb::blocked_range<std::size_t> &range) {
auto &heap = heaps.local();
for (auto id = range.begin(), end = range.end(); id != end; ++id) for (auto id = range.begin(), end = range.end(); id != end; ++id)
{ {
Customize(graph, heap, cells, level, id); Customize(graph, cells, level, id);
} }
}); });
} }
} }
private: private:
struct HeapData
{
};
using Heap = util::
BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
using HeapPtr = boost::thread_specific_ptr<Heap>;
template <bool first_level, typename GraphT> template <bool first_level, typename GraphT>
void RelaxNode(const GraphT &graph, void RelaxNode(const GraphT &graph,
const partition::CellStorage &cells, const partition::CellStorage &cells,
Heap &heap, Heap &heap,
LevelID level, LevelID level,
CellID id,
NodeID node, NodeID node,
EdgeWeight weight, EdgeWeight weight) const
EdgeDuration duration) const
{ {
BOOST_ASSERT(heap.WasInserted(node));
if (!first_level) if (!first_level)
{ {
// if we reaches this node from a clique arc we don't need to scan // Relax sub-cell nodes
// the clique arcs again because of the triangle inequality auto subcell_id = partition.GetCell(level - 1, node);
// auto subcell = cells.GetCell(level - 1, subcell_id);
// d(parent, node) + d(node, v) >= d(parent, v) auto subcell_destination = subcell.GetDestinationNodes().begin();
// for (auto subcell_weight : subcell.GetOutWeight(node))
// And if there is a path (parent, node, v) there must also be a
// clique arc (parent, v) with d(parent, v).
if (!heap.GetData(node).from_clique)
{ {
// Relax sub-cell nodes if (subcell_weight != INVALID_EDGE_WEIGHT)
auto subcell_id = partition.GetCell(level - 1, node);
auto subcell = cells.GetCell(level - 1, subcell_id);
auto subcell_destination = subcell.GetDestinationNodes().begin();
auto subcell_duration = subcell.GetOutDuration(node).begin();
for (auto subcell_weight : subcell.GetOutWeight(node))
{ {
if (subcell_weight != INVALID_EDGE_WEIGHT) const NodeID to = *subcell_destination;
const EdgeWeight to_weight = subcell_weight + weight;
if (!heap.WasInserted(to))
{ {
const NodeID to = *subcell_destination; heap.Insert(to, to_weight, {});
const EdgeWeight to_weight = weight + subcell_weight; }
if (!heap.WasInserted(to)) else if (to_weight < heap.GetKey(to))
{ {
heap.Insert(to, to_weight, {true, duration + *subcell_duration}); heap.DecreaseKey(to, to_weight);
}
else if (to_weight < heap.GetKey(to))
{
heap.DecreaseKey(to, to_weight);
heap.GetData(to) = {true, duration + *subcell_duration};
}
} }
++subcell_destination;
++subcell_duration;
} }
++subcell_destination;
} }
} }
@@ -158,15 +124,14 @@ class CellCustomizer
(first_level || (first_level ||
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 = data.weight + weight;
if (!heap.WasInserted(to)) if (!heap.WasInserted(to))
{ {
heap.Insert(to, to_weight, {false, duration + data.duration}); heap.Insert(to, to_weight, {});
} }
else if (to_weight < heap.GetKey(to)) else if (to_weight < heap.GetKey(to))
{ {
heap.DecreaseKey(to, to_weight); heap.DecreaseKey(to, to_weight);
heap.GetData(to) = {false, duration + data.duration};
} }
} }
} }
+4 -7
View File
@@ -7,8 +7,6 @@
#include "util/static_graph.hpp" #include "util/static_graph.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include "storage/shared_memory_ownership.hpp"
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
namespace osrm namespace osrm
@@ -18,17 +16,16 @@ namespace customizer
using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData; using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
struct MultiLevelEdgeBasedGraph struct MultiLevelEdgeBasedGraph : public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, false>
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>
{ {
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>; using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, false>;
using Base::Base; using Base::Base;
}; };
struct MultiLevelEdgeBasedGraphView struct MultiLevelEdgeBasedGraphView
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View> : public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, true>
{ {
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>; using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, true>;
using Base::Base; using Base::Base;
}; };
+18
View File
@@ -0,0 +1,18 @@
#ifndef OSRM_CUSTOMIZER_IO_HPP
#define OSRM_CUSTOMIZER_IO_HPP
#include "customizer/edge_based_graph.hpp"
#include "storage/io.hpp"
namespace osrm
{
namespace customizer
{
namespace io
{
}
}
}
#endif
+35 -37
View File
@@ -7,36 +7,30 @@ namespace osrm
{ {
namespace engine namespace engine
{ {
namespace routing_algorithms namespace algorithm
{ {
// Contraction Hiearchy // Contraction Hiearchy
namespace ch struct CH final
{
struct Algorithm final
{ {
}; };
}
// Contraction Hiearchy with core // Contraction Hiearchy with core
namespace corech struct CoreCH final
{
struct Algorithm final
{ {
}; };
}
// Multi-Level Dijkstra // Multi-Level Dijkstra
namespace mld struct MLD final
{
struct Algorithm final
{ {
}; };
template <typename AlgorithmT> const char *name();
template <> inline const char *name<CH>() { return "CH"; }
template <> inline const char *name<CoreCH>() { return "CoreCH"; }
template <> inline const char *name<MLD>() { return "MLD"; }
} }
// Algorithm names namespace algorithm_trais
template <typename AlgorithmT> const char *name(); {
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 <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type
{ {
@@ -57,58 +51,62 @@ template <typename AlgorithmT> struct HasGetTileTurns final : std::false_type
{ {
}; };
// Algorithms supported by Contraction Hierarchies template <> struct HasAlternativePathSearch<algorithm::CH> final : std::true_type
template <> struct HasAlternativePathSearch<ch::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasShortestPathSearch<ch::Algorithm> final : std::true_type template <> struct HasShortestPathSearch<algorithm::CH> final : std::true_type
{ {
}; };
template <> struct HasDirectShortestPathSearch<ch::Algorithm> final : std::true_type template <> struct HasDirectShortestPathSearch<algorithm::CH> final : std::true_type
{ {
}; };
template <> struct HasMapMatching<ch::Algorithm> final : std::true_type template <> struct HasMapMatching<algorithm::CH> final : std::true_type
{ {
}; };
template <> struct HasManyToManySearch<ch::Algorithm> final : std::true_type template <> struct HasManyToManySearch<algorithm::CH> final : std::true_type
{ {
}; };
template <> struct HasGetTileTurns<ch::Algorithm> final : std::true_type template <> struct HasGetTileTurns<algorithm::CH> final : std::true_type
{ {
}; };
// Algorithms supported by Contraction Hierarchies with core // disbaled because of perfomance reasons
// the rest is disabled because of performance reasons template <> struct HasAlternativePathSearch<algorithm::CoreCH> final : std::false_type
template <> struct HasShortestPathSearch<corech::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasDirectShortestPathSearch<corech::Algorithm> final : std::true_type template <> struct HasManyToManySearch<algorithm::CoreCH> final : std::false_type
{ {
}; };
template <> struct HasMapMatching<corech::Algorithm> final : std::true_type template <> struct HasShortestPathSearch<algorithm::CoreCH> final : std::true_type
{ {
}; };
template <> struct HasGetTileTurns<corech::Algorithm> final : std::true_type template <> struct HasDirectShortestPathSearch<algorithm::CoreCH> final : std::true_type
{
};
template <> struct HasMapMatching<algorithm::CoreCH> final : std::true_type
{
};
template <> struct HasGetTileTurns<algorithm::CoreCH> final : std::true_type
{ {
}; };
// Algorithms supported by Multi-Level Dijkstra // disbaled because of perfomance reasons
template <> struct HasAlternativePathSearch<mld::Algorithm> final : std::true_type template <> struct HasAlternativePathSearch<algorithm::MLD> final : std::false_type
{ {
}; };
template <> struct HasDirectShortestPathSearch<mld::Algorithm> final : std::true_type template <> struct HasManyToManySearch<algorithm::MLD> final : std::false_type
{ {
}; };
template <> struct HasShortestPathSearch<mld::Algorithm> final : std::true_type template <> struct HasShortestPathSearch<algorithm::MLD> final : std::false_type
{ {
}; };
template <> struct HasMapMatching<mld::Algorithm> final : std::true_type template <> struct HasDirectShortestPathSearch<algorithm::MLD> final : std::true_type
{ {
}; };
template <> struct HasManyToManySearch<mld::Algorithm> final : std::true_type template <> struct HasMapMatching<algorithm::MLD> final : std::false_type
{ {
}; };
template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type template <> struct HasGetTileTurns<algorithm::MLD> final : std::false_type
{ {
}; };
} }
+5 -10
View File
@@ -50,19 +50,14 @@ class BaseAPI
{ {
if (parameters.generate_hints) if (parameters.generate_hints)
{ {
// TODO: check forward/reverse return json::makeWaypoint(phantom.location,
return json::makeWaypoint( facade.GetNameForID(phantom.name_id).to_string(),
phantom.location, Hint{phantom, facade.GetCheckSum()});
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string(),
Hint{phantom, facade.GetCheckSum()});
} }
else else
{ {
// TODO: check forward/reverse return json::makeWaypoint(phantom.location,
return json::makeWaypoint( facade.GetNameForID(phantom.name_id).to_string());
phantom.location,
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
.to_string());
} }
} }
+1 -6
View File
@@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ENGINE_API_BASE_PARAMETERS_HPP #ifndef ENGINE_API_BASE_PARAMETERS_HPP
#define ENGINE_API_BASE_PARAMETERS_HPP #define ENGINE_API_BASE_PARAMETERS_HPP
#include "engine/approach.hpp"
#include "engine/bearing.hpp" #include "engine/bearing.hpp"
#include "engine/hint.hpp" #include "engine/hint.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"
@@ -56,7 +55,6 @@ namespace api
* optional per coordinate * optional per coordinate
* - bearings: limits the search for segments in the road network to given bearing(s) in degree * - bearings: limits the search for segments in the road network to given bearing(s) in degree
* towards true north in clockwise direction, optional per coordinate * towards true north in clockwise direction, optional per coordinate
* - approaches: force the phantom node to start towards the node with the road country side.
* *
* \see OSRM, Coordinate, Hint, Bearing, RouteParame, RouteParameters, TableParameters, * \see OSRM, Coordinate, Hint, Bearing, RouteParame, RouteParameters, TableParameters,
* NearestParameters, TripParameters, MatchParameters and TileParameters * NearestParameters, TripParameters, MatchParameters and TileParameters
@@ -67,7 +65,6 @@ struct BaseParameters
std::vector<boost::optional<Hint>> hints; std::vector<boost::optional<Hint>> hints;
std::vector<boost::optional<double>> radiuses; std::vector<boost::optional<double>> radiuses;
std::vector<boost::optional<Bearing>> bearings; std::vector<boost::optional<Bearing>> bearings;
std::vector<boost::optional<Approach>> approaches;
// Adds hints to response which can be included in subsequent requests, see `hints` above. // Adds hints to response which can be included in subsequent requests, see `hints` above.
bool generate_hints = true; bool generate_hints = true;
@@ -76,10 +73,9 @@ struct BaseParameters
const std::vector<boost::optional<Hint>> hints_ = {}, const std::vector<boost::optional<Hint>> hints_ = {},
std::vector<boost::optional<double>> radiuses_ = {}, std::vector<boost::optional<double>> radiuses_ = {},
std::vector<boost::optional<Bearing>> bearings_ = {}, std::vector<boost::optional<Bearing>> bearings_ = {},
std::vector<boost::optional<Approach>> approaches_ = {},
bool generate_hints_ = true) bool generate_hints_ = true)
: coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_), : coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_),
approaches(approaches_), generate_hints(generate_hints_) generate_hints(generate_hints_)
{ {
} }
@@ -89,7 +85,6 @@ struct BaseParameters
return (hints.empty() || hints.size() == coordinates.size()) && return (hints.empty() || hints.size() == coordinates.size()) &&
(bearings.empty() || bearings.size() == coordinates.size()) && (bearings.empty() || bearings.size() == coordinates.size()) &&
(radiuses.empty() || radiuses.size() == coordinates.size()) && (radiuses.empty() || radiuses.size() == coordinates.size()) &&
(approaches.empty() || approaches.size() == coordinates.size()) &&
std::all_of(bearings.begin(), std::all_of(bearings.begin(),
bearings.end(), bearings.end(),
[](const boost::optional<Bearing> bearing_and_range) { [](const boost::optional<Bearing> bearing_and_range) {

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