Compare commits
314 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a029d476c | |||
| d97fe2322d | |||
| baca7b70f1 | |||
| 50f5a753ea | |||
| 4ac827a849 | |||
| def699dafd | |||
| 41dda32546 | |||
| 8d3ebc64dc | |||
| c15b02ecf6 | |||
| 480807500b | |||
| e2de71bdcf | |||
| 574060418a | |||
| 9d81eb327a | |||
| 677598a8d8 | |||
| 781a2ad0f8 | |||
| a613375460 | |||
| 960269f95a | |||
| ed7b1baacc | |||
| d4e7b3d60b | |||
| bd3eb6591e | |||
| b0b8069ab0 | |||
| d9d873903f | |||
| e7acc9df76 | |||
| b6557b8cac | |||
| a05d7a8f73 | |||
| 35ff807e1d | |||
| e554624438 | |||
| 58ba3fc84f | |||
| dddf83db7b | |||
| 5266ac1635 | |||
| eb1d399f3b | |||
| 6bf68fb0c6 | |||
| 33b2a193f9 | |||
| 158d260cbb | |||
| 83b17e664c | |||
| 89a9bc9d70 | |||
| b0a4ad92c4 | |||
| 9a20e8e614 | |||
| af5efd2abb | |||
| 9ae9a1f6d7 | |||
| 370081ec14 | |||
| d340f4eabc | |||
| 0e10b94d38 | |||
| 1a5e5df6bd | |||
| 18a0f6c1f8 | |||
| 8510d6850a | |||
| 566cf785f5 | |||
| 687a3cdfbe | |||
| 50d9632ed7 | |||
| f376225080 | |||
| fcb7dd2a21 | |||
| aa06029801 | |||
| 1ce573ef35 | |||
| cf13a9714d | |||
| 8697a6b14a | |||
| 9a32722634 | |||
| 24d0af6faf | |||
| b1646622e6 | |||
| 697c2ff88d | |||
| e181cb325c | |||
| 41af9615cd | |||
| 13067844ee | |||
| ca68518763 | |||
| f6065de494 | |||
| 58fbda0483 | |||
| e693b8963a | |||
| 5b6e82fa9c | |||
| a7a088d416 | |||
| 43b920bfb5 | |||
| deacc8fb5c | |||
| a3f1c2afb0 | |||
| 7e4fbaf4a8 | |||
| dfc1bfc27e | |||
| 96acdaf0d5 | |||
| 98fd17589d | |||
| 21444ce7cb | |||
| b840c0be95 | |||
| 17eb39d0a9 | |||
| c090457f1f | |||
| 7d28b7aa3a | |||
| 1ba8aba466 | |||
| 9f80f6d64d | |||
| a8362d75b5 | |||
| df3ed43d70 | |||
| c021cea770 | |||
| 628784eb7d | |||
| 440fb61f8f | |||
| f87a324633 | |||
| 2222ee6a67 | |||
| e033e0b553 | |||
| c24f917dcf | |||
| 1e98ae7efe | |||
| 55b3260cc3 | |||
| 3451d1ec82 | |||
| 4799b46eeb | |||
| f6b313e958 | |||
| d3ab6f1fca | |||
| 523d9e9c05 | |||
| 8e81034bb2 | |||
| 4a47267455 | |||
| f545f2293e | |||
| 78160c0fe4 | |||
| a35961ca6a | |||
| 933e36190f | |||
| 03d9e7a8ce | |||
| 7e24dcfd0a | |||
| cdce2af1c9 | |||
| 3116734bec | |||
| 4d6272b030 | |||
| a7993eebac | |||
| 2d0b2ca987 | |||
| 699ca2bbd0 | |||
| 8b40c594be | |||
| 909570fd7f | |||
| df9fda177d | |||
| d2e7e6e9e6 | |||
| b9ebe0c369 | |||
| cd4e6a1fe3 | |||
| 5cac188711 | |||
| b7fa2c5981 | |||
| 106082f6f8 | |||
| 36d34073da | |||
| 57ed232423 | |||
| 24f12c9d1b | |||
| bdf2222f6a | |||
| 220ad9fe8c | |||
| ae6326719a | |||
| 0503a2fcd3 | |||
| 219f2c3aa9 | |||
| 493e821b93 | |||
| 9c3eeffe2c | |||
| 526191256c | |||
| 9861faa456 | |||
| 919fe74c40 | |||
| 365121dac4 | |||
| cbec111eb6 | |||
| 7d369b9ab9 | |||
| 2c13f2f735 | |||
| 15f0ca8dda | |||
| d59ecb321e | |||
| 404ebb1898 | |||
| 11b0a2e02a | |||
| 1ada466081 | |||
| 973722d0ec | |||
| ca5d17adab | |||
| 68dcab7c15 | |||
| 92406da194 | |||
| 6d8cf826d7 | |||
| 48be5a5622 | |||
| 46ab931c64 | |||
| 0b139ff05d | |||
| 9da6cf8764 | |||
| ee177efe41 | |||
| fd0f1b60bb | |||
| 9c1c842b79 | |||
| 17f32f4ca1 | |||
| 542c3ba872 | |||
| f36707d1fb | |||
| a587b14006 | |||
| f9ee74d78e | |||
| eef072234e | |||
| a9fce74e63 | |||
| 432d49e23d | |||
| e4aaf07879 | |||
| d316ff9d41 | |||
| 921c2f9482 | |||
| 62c8b70f78 | |||
| f520379419 | |||
| d8d9ac8686 | |||
| 016c77a4de | |||
| 0205cbc578 | |||
| 28895373fb | |||
| 018a9bc804 | |||
| 71433c67b1 | |||
| d25a530942 | |||
| a6097cdc01 | |||
| 50a1c8a08d | |||
| 6214f16552 | |||
| e97ec13064 | |||
| fa5567e669 | |||
| a9d4e28e38 | |||
| a5127539eb | |||
| 660c0cc602 | |||
| 600f48e15a | |||
| 1b47242a58 | |||
| 10c1b38139 | |||
| 81071b5af9 | |||
| 746b2e94a0 | |||
| 43f60bc69c | |||
| 145974bc92 | |||
| c9bd9a967c | |||
| 3c607a4570 | |||
| 6dfcfcb105 | |||
| e701243641 | |||
| f1a4b70a56 | |||
| df60947794 | |||
| cd7229ba06 | |||
| 624724031d | |||
| 0be87c73cf | |||
| b8182dd7ff | |||
| 80e1abba0c | |||
| ce71e08ef1 | |||
| 97270ae473 | |||
| a9c187c99b | |||
| ff46e98d21 | |||
| a196e67e1a | |||
| 1a259ccca0 | |||
| 2a1593fe05 | |||
| 5888894787 | |||
| 73f544d4da | |||
| 889c82516f | |||
| 306c047c14 | |||
| 533f1ffc6b | |||
| a44a75b211 | |||
| e26a5cc392 | |||
| 90191c9f34 | |||
| b7e9e5f2c0 | |||
| 13287d9970 | |||
| affa8a4653 | |||
| 9d7a74445d | |||
| acd3e81ab4 | |||
| ea111129dd | |||
| 7ddda105a3 | |||
| 56406e80ce | |||
| 75aadb0f3f | |||
| f6f86b2a52 | |||
| 3f34c8d88c | |||
| 59a83bd537 | |||
| 59ca7840f4 | |||
| 88979d0d86 | |||
| 2462826c20 | |||
| 9efcab2108 | |||
| 4fbf58adb3 | |||
| a7b7d77e1f | |||
| 22550d078f | |||
| a0582a3e68 | |||
| 92c7b6fbd1 | |||
| 86aebc0812 | |||
| b4f849adaa | |||
| d964d368aa | |||
| 38700e207e | |||
| 817aeace55 | |||
| 501e866992 | |||
| f2724e9e63 | |||
| 2820853fb6 | |||
| f5ebe8bc3b | |||
| 98294e3ddd | |||
| ce33f1ae98 | |||
| e86d93760f | |||
| a1e5061799 | |||
| 2c7c18fd24 | |||
| 5ddbb25237 | |||
| 9ba60d0d5c | |||
| 4f0ec785f6 | |||
| 02b50458b0 | |||
| 0a556fe450 | |||
| f2f167c95d | |||
| 8b45ff7a18 | |||
| 4c665b24d9 | |||
| 381d492a8f | |||
| e250c83c21 | |||
| e2e326d15e | |||
| 4abca85474 | |||
| 2c78d862a3 | |||
| b1451a7421 | |||
| da1c251144 | |||
| 1eab7b41d1 | |||
| 1dca8ae76a | |||
| 002e86863d | |||
| 1d82b01816 | |||
| 714719c377 | |||
| 77b4fbb69c | |||
| 11fde865f7 | |||
| 717406043a | |||
| 1ef85c57cc | |||
| d0180517a8 | |||
| 520b7ebbb6 | |||
| 2caba96076 | |||
| 81bc2f41a6 | |||
| 06e010b4d0 | |||
| 92d3ce789b | |||
| 01ca32c81c | |||
| 2e17f3010a | |||
| c4238c4ed6 | |||
| 3d781e6f28 | |||
| 4976233cff | |||
| 98ea2a0b09 | |||
| f978900ab0 | |||
| 8b6580128b | |||
| 4dde9c7bbe | |||
| 973837207b | |||
| 364e35af06 | |||
| 985ab58f45 | |||
| cb1db646f2 | |||
| a67c4bf84d | |||
| 498259b220 | |||
| 5327f8da4e | |||
| 802ccfb497 | |||
| ec369d560a | |||
| 535647e439 | |||
| 954121634f | |||
| 594a45e7e0 | |||
| 96c7b47afe | |||
| b7e7d32361 | |||
| 2f9cb44368 | |||
| d80318f8ea | |||
| b1791d1ab3 | |||
| a53da9095a | |||
| 72e03f9af9 | |||
| 5597415f28 | |||
| 5476f6ab27 | |||
| 0971f06193 | |||
| 85515f063a | |||
| 69d7825542 |
@@ -0,0 +1,2 @@
|
||||
features/support/flatbuffers.js
|
||||
features/support/fbresult_generated.js
|
||||
+4
-6
@@ -49,7 +49,7 @@ Thumbs.db
|
||||
/_build*
|
||||
/build/
|
||||
/example/build/
|
||||
/test/data/monaco*
|
||||
/test/data/monaco.osrm*
|
||||
/test/data/ch
|
||||
/test/data/corech
|
||||
/test/data/mld
|
||||
@@ -68,11 +68,9 @@ Thumbs.db
|
||||
/*.local.bat
|
||||
/CMakeSettings.json
|
||||
|
||||
# stxxl related files #
|
||||
#######################
|
||||
.stxxl
|
||||
stxxl.log
|
||||
stxxl.errlog
|
||||
# Jetbrains related files #
|
||||
###########################
|
||||
.idea/
|
||||
|
||||
# Compiled Binary Files #
|
||||
####################################
|
||||
|
||||
+245
-44
@@ -17,7 +17,7 @@ branches:
|
||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
npm: true
|
||||
ccache: true
|
||||
apt: true
|
||||
directories:
|
||||
@@ -25,8 +25,6 @@ cache:
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "hk+32aXXF5t1ApaM2Wjqooz3dx1si907L87WRMkO47WlpJmUUU/Ye+MJk9sViH8MdhOcceocVAmdYl5/WFWOIbDWNlBya9QvXDZyIu2KIre/0QyOCTZbrsif8paBXKIO5O/R4OTvIZ8rvWZsadBdmAT9GSbDhih6FzqXAEgeIYQ="
|
||||
- secure: "VE+cFkseFwW4jK6XwkP0yW3h4DixPJ8+Eb3yKcchGZ5iIJxlZ/8i1vKHYxadgPRwSYwPSB14tF70xj2OmiT2keGzZUfphmPXinBaLEhYk+Bde+GZZkoSl5ND109I/LcyNr0nG9dDgtV6pkvFchgchpyP9JnVOOS0+crEZlAz0RE="
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- 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
|
||||
@@ -34,7 +32,11 @@ env:
|
||||
- CMAKE_VERSION=3.7.2
|
||||
- MASON="$(pwd)/scripts/mason.sh"
|
||||
- ENABLE_NODE_BINDINGS=On
|
||||
- NODE="4"
|
||||
- NODE="10"
|
||||
|
||||
stages:
|
||||
- core
|
||||
- optional
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
@@ -43,22 +45,23 @@ matrix:
|
||||
include:
|
||||
|
||||
# Debug Builds
|
||||
- os: linux
|
||||
- stage: core
|
||||
os: linux
|
||||
compiler: "format-taginfo-docs"
|
||||
env: NODE=6
|
||||
env: NODE=10
|
||||
sudo: false
|
||||
before_install:
|
||||
install:
|
||||
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
- source $NVM_DIR/nvm.sh
|
||||
- nvm install $NODE
|
||||
- nvm use $NODE
|
||||
- npm --version
|
||||
- npm install --ignore-scripts
|
||||
- npm link --ignore-scripts
|
||||
- npm ci --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
|
||||
- ${MASON} install clang-format 10.0.0
|
||||
- PATH=$(${MASON} prefix clang-format 10.0.0)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh
|
||||
- node ./scripts/validate_changelog.js
|
||||
# See issue 4043
|
||||
#- npm run docs && ./scripts/error_on_dirty.sh
|
||||
@@ -116,6 +119,22 @@ matrix:
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-9-release"
|
||||
addons: &gcc9
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-9' CXXCOMPILER='g++-9' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-8-release"
|
||||
addons: &gcc8
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-8', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-8' CXXCOMPILER='g++-8' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-7-release"
|
||||
addons: &gcc7
|
||||
@@ -130,14 +149,6 @@ matrix:
|
||||
TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
|
||||
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-7-stxxl"
|
||||
addons: &gcc7
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-7', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' ENABLE_STXXL=On
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-5-release"
|
||||
addons: &gcc49
|
||||
@@ -156,19 +167,27 @@ matrix:
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode9.2
|
||||
compiler: "mason-osx-release-node-8"
|
||||
compiler: "mason-osx-release-node-10"
|
||||
# we use the xcode provides clang and don't install our own
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8"
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="10"
|
||||
after_success:
|
||||
- ./scripts/travis/publish.sh
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode9.2
|
||||
compiler: "mason-osx-release-node-4"
|
||||
compiler: "mason-osx-release-node-12"
|
||||
# we use the xcode provides clang and don't install our own
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="4"
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="12"
|
||||
after_success:
|
||||
- ./scripts/travis/publish.sh
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode9.2
|
||||
compiler: "mason-osx-release-node-14"
|
||||
# we use the xcode provides clang and don't install our own
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="14"
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
# Shared Library
|
||||
- os: linux
|
||||
@@ -182,12 +201,12 @@ matrix:
|
||||
# Node build jobs. These skip running the tests.
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-4-mason-linux-release"
|
||||
compiler: "node-14-mason-linux-release"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
|
||||
install:
|
||||
- pushd ${OSRM_BUILD_DIR}
|
||||
- |
|
||||
@@ -202,16 +221,16 @@ matrix:
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/publish.sh
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-4-mason-linux-debug"
|
||||
compiler: "node-14-mason-linux-debug"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
|
||||
install:
|
||||
- pushd ${OSRM_BUILD_DIR}
|
||||
- |
|
||||
@@ -226,16 +245,16 @@ matrix:
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/publish.sh
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-8-mason-linux-release"
|
||||
compiler: "node-12-mason-linux-release"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
|
||||
install:
|
||||
- pushd ${OSRM_BUILD_DIR}
|
||||
- |
|
||||
@@ -250,16 +269,16 @@ matrix:
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/publish.sh
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-8-mason-linux-debug"
|
||||
compiler: "node-12-mason-linux-debug"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
|
||||
install:
|
||||
- pushd ${OSRM_BUILD_DIR}
|
||||
- |
|
||||
@@ -274,9 +293,185 @@ matrix:
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/publish.sh
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-10-mason-linux-release"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10"
|
||||
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} \
|
||||
-DENABLE_GLIBC_WORKAROUND=ON
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-10-mason-linux-debug"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10"
|
||||
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} \
|
||||
-DENABLE_GLIBC_WORKAROUND=ON
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: osx
|
||||
stage: optional
|
||||
osx_image: xcode9.2
|
||||
compiler: "mason-osx-release-node-latest"
|
||||
# we use the xcode provides clang and don't install our own
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node"
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-latest-mason-linux-release"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
|
||||
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} \
|
||||
-DENABLE_GLIBC_WORKAROUND=ON
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-latest-mason-linux-debug"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
|
||||
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} \
|
||||
-DENABLE_GLIBC_WORKAROUND=ON
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode9.2
|
||||
compiler: "mason-osx-release-node-lts"
|
||||
# we use the xcode provides clang and don't install our own
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts"
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-lts-mason-linux-release"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
|
||||
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} \
|
||||
-DENABLE_GLIBC_WORKAROUND=ON
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
- os: linux
|
||||
sudo: false
|
||||
compiler: "node-lts-mason-linux-debug"
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-4.9-dev']
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
|
||||
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} \
|
||||
-DENABLE_GLIBC_WORKAROUND=ON
|
||||
- make --jobs=${JOBS}
|
||||
- popd
|
||||
script:
|
||||
- npm run nodejs-tests
|
||||
after_success:
|
||||
- ./scripts/travis/node_package.sh
|
||||
|
||||
allow_failures:
|
||||
- compiler: "mason-osx-release-node-latest"
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node"
|
||||
- compiler: "node-latest-mason-linux-release"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
|
||||
- compiler: "node-latest-mason-linux-debug"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
|
||||
- compiler: "mason-osx-release-node-lts"
|
||||
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts"
|
||||
- compiler: "node-lts-mason-linux-release"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
|
||||
- compiler: "node-lts-mason-linux-debug"
|
||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
|
||||
|
||||
before_install:
|
||||
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
- source $NVM_DIR/nvm.sh
|
||||
- nvm install $NODE
|
||||
- nvm use $NODE
|
||||
@@ -294,15 +489,10 @@ before_install:
|
||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||
sudo mdutil -i off /
|
||||
fi
|
||||
- |
|
||||
if [[ ! -f $(which yarn) ]]; then
|
||||
npm install -g yarn
|
||||
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"
|
||||
- yarn install --ignore-scripts
|
||||
- yarn check --ignore-scripts --integrity
|
||||
- npm ci --ignore-scripts
|
||||
# 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_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}"
|
||||
@@ -339,7 +529,6 @@ install:
|
||||
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
|
||||
-DBUILD_TOOLS=ON \
|
||||
-DENABLE_CCACHE=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||
@@ -375,10 +564,22 @@ script:
|
||||
- ./unit_tests/util-tests
|
||||
- ./unit_tests/server-tests
|
||||
- ./unit_tests/partitioner-tests
|
||||
- ./unit_tests/customizer-tests
|
||||
- |
|
||||
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
|
||||
npm run nodejs-tests
|
||||
fi
|
||||
- |
|
||||
- popd
|
||||
- yarn test
|
||||
- npm test
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: "Ej7tPd+XhAlBvA0SnYghYakO6QUwUI+oOtjlkPmy0UfKtIQ4bIzoIm1BDbPwrmNiCSKB7lLZYZpKz68PBRtblfqvTjhzXSzlvFk36pyywgkuNY13N3VQZo2c5CShLCy41nx4+uLkjhLfKYOALSE3OivdJJHLZEsSwx60Csx7owU="
|
||||
skip_cleanup: true
|
||||
file_glob: true
|
||||
file: build/stage/**/*.tar.gz
|
||||
on:
|
||||
tags: true
|
||||
condition: "$PUBLISH = 'On'"
|
||||
|
||||
+118
-3
@@ -1,10 +1,125 @@
|
||||
# UNRELEASED
|
||||
# 5.25.0-rc.2
|
||||
- Changes from 5.24.0
|
||||
- Build:
|
||||
- CHANGED: Node binaries now use Github Releases for hosting [#6030](https://github.com/Project-OSRM/osrm-backend/pull/6030)
|
||||
- Misc:
|
||||
- FIXED: Upgrade to @mapbox/node-pre-gyp fix various bugs with Node 12/14 [#5991](https://github.com/Project-OSRM/osrm-backend/pull/5991)
|
||||
- FIXED: `valid` type in documentation examples [#5990](https://github.com/Project-OSRM/osrm-backend/issues/5990)
|
||||
- FIXED: Remove redundant loading of .osrm.cell_metrics [#6019](https://github.com/Project-OSRM/osrm-backend/issues/6019)
|
||||
- CHANGED: Increase PackedOSMIDs size to 34 bits. This breaks the **data format** [#6020](https://github.com/Project-OSRM/osrm-backend/issues/6020)
|
||||
- Profile:
|
||||
- FIXED: Add kerb barrier exception to default car profile. [#5999](https://github.com/Project-OSRM/osrm-backend/pull/5999)
|
||||
|
||||
# 5.24.0
|
||||
- Changes from 5.23.0
|
||||
- Features
|
||||
- ADDED: Added support for multiple via-way restrictions. [#5907](https://github.com/Project-OSRM/osrm-backend/pull/5907)
|
||||
- ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
|
||||
- REMOVED: we no longer publish Node 8 binary modules (they are still buildable from source) [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
|
||||
- Routing:
|
||||
- FIXED: Avoid copying ManyToMany table results [#5923](https://github.com/Project-OSRM/osrm-backend/pull/5923)
|
||||
- FIXED: Reduce copying in API parameter constructors [#5925](https://github.com/Project-OSRM/osrm-backend/pull/5925)
|
||||
- Misc:
|
||||
- CHANGED: Cleanup NodeJS dependencies [#5945](https://github.com/Project-OSRM/osrm-backend/pull/5945)
|
||||
- CHANGED: Unify `.osrm.turn_penalites_index` dump processing same with `.osrm.turn_weight_penalties` and `.osrm.turn_duration_penalties` [#5868](https://github.com/Project-OSRM/osrm-backend/pull/5868)
|
||||
- FIXED: Properly validate source/destination validation in NodeJS table service [#5595](https://github.com/Project-OSRM/osrm-backend/pull/5595/files)
|
||||
- FIXED: turn.roads_on_the_left not containing incoming roads and turn.roads_on_the_right not containing outgoing roads on two-way roads [#5128](https://github.com/Project-OSRM/osrm-backend/issues/5128)
|
||||
- Profile:
|
||||
- ADDED: Profile debug script which fetches a way from OSM then outputs the result of the profile. [#5908](https://github.com/Project-OSRM/osrm-backend/pull/5908)
|
||||
- Infrastructure
|
||||
- CHANGED: Bundled protozero updated to v1.7.0. [#5858](https://github.com/Project-OSRM/osrm-backend/pull/5858)
|
||||
- Windows:
|
||||
- FIXED: Fix bit-shift overflow in MLD partition step. [#5878](https://github.com/Project-OSRM/osrm-backend/pull/5878)
|
||||
- FIXED: Fix vector bool permutation in graph contraction step [#5882](https://github.com/Project-OSRM/osrm-backend/pull/5882)
|
||||
- API:
|
||||
- FIXED: Undo libosrm API break by adding old interface as method overload [#5861](https://github.com/Project-OSRM/osrm-backend/pull/5861)
|
||||
- FIXED: Fixed validation of sources/destinations when accessed via node bindings [#5595](https://github.com/Project-OSRM/osrm-backend/pull/5595)
|
||||
|
||||
# 5.23.0
|
||||
- Changes from 5.22.0
|
||||
- Build:
|
||||
- FIXED: pessimistic calls to std::move [#5560](https://github.com/Project-OSRM/osrm-backend/pull/5561)
|
||||
- Features:
|
||||
- ADDED: new API parameter - `snapping=any|default` to allow snapping to previously unsnappable edges [#5361](https://github.com/Project-OSRM/osrm-backend/pull/5361)
|
||||
- ADDED: keepalive support to the osrm-routed HTTP server [#5518](https://github.com/Project-OSRM/osrm-backend/pull/5518)
|
||||
- ADDED: flatbuffers output format support [#5513](https://github.com/Project-OSRM/osrm-backend/pull/5513)
|
||||
- ADDED: Global 'skip_waypoints' option [#5556](https://github.com/Project-OSRM/osrm-backend/pull/5556)
|
||||
- FIXED: Install the libosrm_guidance library correctly [#5604](https://github.com/Project-OSRM/osrm-backend/pull/5604)
|
||||
- FIXED: Http Handler can now deal witch optional whitespace between header-key and -value [#5606](https://github.com/Project-OSRM/osrm-backend/issues/5606)
|
||||
- Routing:
|
||||
- CHANGED: allow routing past `barrier=arch` [#5352](https://github.com/Project-OSRM/osrm-backend/pull/5352)
|
||||
- CHANGED: default car weight was reduced to 2000 kg. [#5371](https://github.com/Project-OSRM/osrm-backend/pull/5371)
|
||||
- CHANGED: default car height was reduced to 2 meters. [#5389](https://github.com/Project-OSRM/osrm-backend/pull/5389)
|
||||
- FIXED: treat `bicycle=use_sidepath` as no access on the tagged way. [#5622](https://github.com/Project-OSRM/osrm-backend/pull/5622)
|
||||
- FIXED: fix table result when source and destination on same one-way segment. [#5828](https://github.com/Project-OSRM/osrm-backend/pull/5828)
|
||||
- FIXED: fix occasional segfault when swapping data with osrm-datastore and using `exclude=` [#5844](https://github.com/Project-OSRM/osrm-backend/pull/5844)
|
||||
- FIXED: fix crash in MLD alternative search if source or target are invalid [#5851](https://github.com/Project-OSRM/osrm-backend/pull/5851)
|
||||
- Misc:
|
||||
- CHANGED: Reduce memory usage for raster source handling. [#5572](https://github.com/Project-OSRM/osrm-backend/pull/5572)
|
||||
- CHANGED: Add cmake option `ENABLE_DEBUG_LOGGING` to control whether output debug logging. [#3427](https://github.com/Project-OSRM/osrm-backend/issues/3427)
|
||||
- CHANGED: updated extent of Hong Kong as left hand drive country. [#5535](https://github.com/Project-OSRM/osrm-backend/issues/5535)
|
||||
- FIXED: corrected error message when failing to snap input coordinates [#5846](https://github.com/Project-OSRM/osrm-backend/pull/5846)
|
||||
- Infrastructure
|
||||
- REMOVED: STXXL support removed as STXXL became abandonware. [#5760](https://github.com/Project-OSRM/osrm-backend/pull/5760)
|
||||
|
||||
# 5.22.0
|
||||
- Changes from 5.21.0
|
||||
- Build:
|
||||
- ADDED: optionally build Node `lts` and `latest` bindings [#5347](https://github.com/Project-OSRM/osrm-backend/pull/5347)
|
||||
- Features:
|
||||
- ADDED: new waypoints parameter to the `route` plugin, enabling silent waypoints [#5345](https://github.com/Project-OSRM/osrm-backend/pull/5345)
|
||||
- ADDED: data timestamp information in the response (saved in new file `.osrm.timestamp`). [#5115](https://github.com/Project-OSRM/osrm-backend/issues/5115)
|
||||
|
||||
# 5.21.0
|
||||
- Changes from 5.20.0
|
||||
- Features:
|
||||
- ADDED: all waypoints in responses now contain a distance property between the original coordinate and the snapped location. [#5255](https://github.com/Project-OSRM/osrm-backend/pull/5255)
|
||||
- ADDED: if `fallback_speed` is used, a new structure `fallback_speed_cells` will describe which cells contain estimated values [#5259](https://github.com/Project-OSRM/osrm-backend/pull/5259)
|
||||
- REMOVED: we no longer publish Node 4 or 6 binary modules (they are still buildable from source) [#5314](https://github.com/Project-OSRM/osrm-backend/pull/5314)
|
||||
- Table:
|
||||
- ADDED: new parameter `scale_factor` which will scale the cell `duration` values by this factor. [#5298](https://github.com/Project-OSRM/osrm-backend/pull/5298)
|
||||
- FIXED: only trigger `scale_factor` code to scan matrix when necessary. [#5303](https://github.com/Project-OSRM/osrm-backend/pull/5303)
|
||||
- FIXED: fix bug in reverse offset calculation that sometimes lead to negative (and other incorrect) values in distance table results [#5315](https://github.com/Project-OSRM/osrm-backend/pull/5315)
|
||||
- Docker:
|
||||
- FIXED: use consistent boost version between build and runtime [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311)
|
||||
- FIXED: don't override default permissions on /opt [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311)
|
||||
- Matching:
|
||||
- CHANGED: matching will now consider edges marked with is_startpoint=false, allowing matching over ferries and other previously non-matchable edge types. [#5297](https://github.com/Project-OSRM/osrm-backend/pull/5297)
|
||||
- Profile:
|
||||
- ADDED: Parse `source:maxspeed` and `maxspeed:type` tags to apply maxspeeds and add belgian flanders rural speed limit. [#5217](https://github.com/Project-OSRM/osrm-backend/pull/5217)
|
||||
- CHANGED: Refactor maxspeed parsing to use common library. [#5144](https://github.com/Project-OSRM/osrm-backend/pull/5144)
|
||||
|
||||
# 5.20.0
|
||||
- Changes from 5.19.0:
|
||||
- Table:
|
||||
- CHANGED: switch to pre-calculated distances for table responses for large speedup and 10% memory increase. [#5251](https://github.com/Project-OSRM/osrm-backend/pull/5251)
|
||||
- ADDED: new parameter `fallback_speed` which will fill `null` cells with estimated value [#5257](https://github.com/Project-OSRM/osrm-backend/pull/5257)
|
||||
- CHANGED: Remove API check for matrix sources/destination length to be less than or equal to coordinates length. [#5298](https://github.com/Project-OSRM/osrm-backend/pull/5289)
|
||||
- FIXED: Fix crashing bug when using fallback_speed parameter with more sources than destinations. [#5291](https://github.com/Project-OSRM/osrm-backend/pull/5291)
|
||||
- Features:
|
||||
- ADDED: direct mmapping of datafiles is now supported via the `--mmap` switch. [#5242](https://github.com/Project-OSRM/osrm-backend/pull/5242)
|
||||
- REMOVED: the previous `--memory_file` switch is now deprecated and will fallback to `--mmap` [#5242](https://github.com/Project-OSRM/osrm-backend/pull/5242)
|
||||
- ADDED: Now publishing Node 10.x LTS binary modules [#5246](https://github.com/Project-OSRM/osrm-backend/pull/5246)
|
||||
- Windows:
|
||||
- FIXED: Windows builds again. [#5249](https://github.com/Project-OSRM/osrm-backend/pull/5249)
|
||||
- Docker:
|
||||
- CHANGED: switch from Alpine Linux to Debian Buster base images [#5281](https://github.com/Project-OSRM/osrm-backend/pull/5281)
|
||||
|
||||
# 5.19.0
|
||||
- Changes from 5.18.0:
|
||||
- Optimizations:
|
||||
- CHANGED: Map matching is now almost twice as fast. [#5060](https://github.com/Project-OSRM/osrm-backend/pull/5060)
|
||||
- CHANGED: Use Grisu2 for serializing floating point numbers. [#5188](https://github.com/Project-OSRM/osrm-backend/pull/5188)
|
||||
- ADDED: Node bindings can return pre-rendered JSON buffer. [#5189](https://github.com/Project-OSRM/osrm-backend/pull/5189)
|
||||
- Profiles:
|
||||
- CHANGED: Bicycle profile now blacklists barriers instead of whitelisting them [#5076
|
||||
](https://github.com/Project-OSRM/osrm-backend/pull/5076/)
|
||||
- CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077
|
||||
](https://github.com/Project-OSRM/osrm-backend/pull/5077/)
|
||||
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101]
|
||||
- Bugfixes:
|
||||
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
|
||||
- FIXED: negative distances in table plugin annotation [#5106](https://github.com/Project-OSRM/osrm-backend/issues/5106)
|
||||
- Misc:
|
||||
- CHANGED: Support up to 512 named shared memory regions [#5185](https://github.com/Project-OSRM/osrm-backend/pull/5185)
|
||||
|
||||
# 5.18.0
|
||||
- Changes from 5.17.0:
|
||||
|
||||
+26
-37
@@ -23,9 +23,9 @@ option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" 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_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||
@@ -37,7 +37,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
if(ENABLE_MASON)
|
||||
# versions in use
|
||||
set(MASON_BOOST_VERSION "1.65.1")
|
||||
set(MASON_STXXL_VERSION "1.4.1-1")
|
||||
set(MASON_EXPAT_VERSION "2.2.0")
|
||||
set(MASON_LUA_VERSION "5.2.4")
|
||||
set(MASON_BZIP2_VERSION "1.0.6")
|
||||
@@ -57,6 +56,12 @@ endif()
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 OLD)
|
||||
endif()
|
||||
if (POLICY CMP0057)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
endif()
|
||||
if (POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
project(OSRM C CXX)
|
||||
|
||||
include(JSONParser)
|
||||
@@ -227,6 +232,7 @@ endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "Configuring debug mode flags")
|
||||
set(ENABLE_ASSERTIONS ON)
|
||||
set(ENABLE_DEBUG_LOGGING ON)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
@@ -439,6 +445,12 @@ include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR})
|
||||
set(VTZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vtzero/include")
|
||||
include_directories(SYSTEM ${VTZERO_INCLUDE_DIR})
|
||||
|
||||
set(FLATBUFFERS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers")
|
||||
set(FLATBUFFERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include")
|
||||
include_directories(${FLATBUFFERS_INCLUDE_DIR})
|
||||
add_subdirectory(${FLATBUFFERS_SRC_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
# if mason is enabled no find_package calls are made
|
||||
# to ensure that we are only compiling and linking against
|
||||
@@ -466,13 +478,6 @@ if(ENABLE_MASON)
|
||||
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
|
||||
|
||||
if (ENABLE_STXXL)
|
||||
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
|
||||
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
|
||||
add_definitions(-DUSE_STXXL_LIBRARY)
|
||||
endif()
|
||||
|
||||
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
|
||||
set(EXPAT_LIBRARIES ${MASON_PACKAGE_expat_STATIC_LIBS})
|
||||
@@ -518,30 +523,16 @@ else()
|
||||
|
||||
find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||
if(WIN32 AND Boost_VERSION VERSION_LESS 106200)
|
||||
message(FATAL_ERROR "Building with MSVC needs Boost 1.62 with CXX11_CONSTEXPR support")
|
||||
endif()
|
||||
|
||||
find_package(TBB REQUIRED)
|
||||
add_dependency_includes(${TBB_INCLUDE_DIR})
|
||||
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
|
||||
if(WIN32)
|
||||
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} optimized ${TBB_MALLOC_LIBRARY} debug ${TBB_LIBRARY_DEBUG} debug ${TBB_MALLOC_LIBRARY_DEBUG})
|
||||
endif()
|
||||
|
||||
find_package(EXPAT REQUIRED)
|
||||
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
|
||||
|
||||
if (ENABLE_STXXL)
|
||||
find_package(STXXL)
|
||||
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)
|
||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||
|
||||
@@ -601,15 +592,6 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
||||
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
||||
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
if (ENABLE_STXXL)
|
||||
set(OpenMP_FIND_QUIETLY ON)
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
message(STATUS "OpenMP support found. Linking just in case for stxxl")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions(${OSRM_DEFINES})
|
||||
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
|
||||
|
||||
@@ -642,7 +624,6 @@ set(EXTRACTOR_LIBRARIES
|
||||
${EXPAT_LIBRARIES}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${OSMIUM_LIBRARIES}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
@@ -676,7 +657,6 @@ set(CONTRACTOR_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
@@ -696,7 +676,6 @@ set(STORAGE_LIBRARIES
|
||||
set(UTIL_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_COVERAGE_LIBRARIES}
|
||||
${ZLIB_LIBRARY})
|
||||
@@ -728,6 +707,11 @@ if (ENABLE_ASSERTIONS)
|
||||
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
|
||||
endif()
|
||||
|
||||
if (ENABLE_DEBUG_LOGGING)
|
||||
message(STATUS "Enabling debug logging")
|
||||
add_definitions(-DENABLE_DEBUG_LOGGING)
|
||||
endif()
|
||||
|
||||
# Add RPATH info to executables so that when they are run after being installed
|
||||
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For
|
||||
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||
@@ -738,8 +722,10 @@ set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
|
||||
file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h)
|
||||
file(GLOB LibraryGlob include/osrm/*.hpp)
|
||||
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
|
||||
set(ApiHeader include/engine/api/base_result.hpp)
|
||||
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/bearing.hpp)
|
||||
set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
||||
@@ -754,7 +740,9 @@ install(FILES ${PartitionerHeader} DESTINATION include/osrm/partitioner)
|
||||
install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
|
||||
install(FILES ${LibraryGlob} DESTINATION include/osrm)
|
||||
install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
|
||||
install(FILES ${ApiHeader} DESTINATION include/osrm/engine/api)
|
||||
install(FILES ${VariantGlob} DESTINATION include/mapbox)
|
||||
install(FILES ${FlatbuffersGlob} DESTINATION include/flatbuffers)
|
||||
install(TARGETS osrm-extract DESTINATION bin)
|
||||
install(TARGETS osrm-partition DESTINATION bin)
|
||||
install(TARGETS osrm-customize DESTINATION bin)
|
||||
@@ -768,6 +756,7 @@ install(TARGETS osrm_customize DESTINATION lib)
|
||||
install(TARGETS osrm_update DESTINATION lib)
|
||||
install(TARGETS osrm_contract DESTINATION lib)
|
||||
install(TARGETS osrm_store DESTINATION lib)
|
||||
install(TARGETS osrm_guidance DESTINATION lib)
|
||||
|
||||
|
||||
# Install profiles and support library to /usr/local/share/osrm/profiles by default
|
||||
|
||||
@@ -50,7 +50,7 @@ If you want to use the CH pipeline instead replace `osrm-partition` and `osrm-cu
|
||||
|
||||
### Using Docker
|
||||
|
||||
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
|
||||
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Debian and make sure they are as lightweight as possible.
|
||||
|
||||
Download OpenStreetMap extracts for example from [Geofabrik](http://download.geofabrik.de/)
|
||||
|
||||
@@ -58,16 +58,16 @@ Download OpenStreetMap extracts for example from [Geofabrik](http://download.geo
|
||||
|
||||
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
|
||||
|
||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
||||
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
||||
|
||||
The flag `-v $(pwd):/data` creates the directory `/data` inside the docker container and makes the current working directory `$(pwd)` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `$(pwd)/berlin-latest.osm.pbf` on the host.
|
||||
The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host.
|
||||
|
||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
|
||||
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
|
||||
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
|
||||
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
|
||||
|
||||
Note that `berlin-latest.osrm` has a different file extension.
|
||||
|
||||
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
|
||||
docker run -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
|
||||
|
||||
Make requests against the HTTP server
|
||||
|
||||
|
||||
+44
-22
@@ -10,7 +10,7 @@ ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
||||
|
||||
|
||||
:: Check CMake version
|
||||
SET CMAKE_VERSION=3.9.2
|
||||
SET CMAKE_VERSION=3.16.3
|
||||
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
|
||||
ECHO cmake^: && cmake --version
|
||||
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
||||
@@ -19,7 +19,7 @@ cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK
|
||||
|
||||
:CMAKE_NOT_OK
|
||||
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
||||
powershell Invoke-WebRequest https://cmake.org/files/v3.9/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||
powershell Invoke-WebRequest https://cmake.org/files/v3.16/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
@@ -29,8 +29,8 @@ ECHO CMAKE_OK
|
||||
cmake --version
|
||||
|
||||
ECHO activating VS command prompt ...
|
||||
SET PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
SET PATH=C:\Program Files (x86)\MSBuild\15.0\Bin;%PATH%
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
|
||||
ECHO platform^: %platform%
|
||||
|
||||
@@ -40,7 +40,7 @@ ECHO msbuild version
|
||||
msbuild /version
|
||||
|
||||
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
|
||||
SET DEPSPKG=osrm-deps-win-x64-14.0-2017.09.7z
|
||||
SET DEPSPKG=osrm-deps-win-x64-14.2-2019.01.7z
|
||||
|
||||
:: local development
|
||||
ECHO.
|
||||
@@ -52,7 +52,7 @@ IF EXIST %DEPSPKG% DEL %DEPSPKG%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
ECHO downloading %DEPSPKG%
|
||||
powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG
|
||||
powershell Invoke-WebRequest http://project-osrm.wolt.com/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
:SKIPDL
|
||||
@@ -74,27 +74,35 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps
|
||||
set PREFIX=%OSRMDEPSDIR%/libs
|
||||
set BOOST_ROOT=%OSRMDEPSDIR%/boost
|
||||
set BOOST_ROOT=%OSRMDEPSDIR%
|
||||
set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib
|
||||
set TBB_INSTALL_DIR=%OSRMDEPSDIR%/tbb
|
||||
set TBB_ARCH_PLATFORM=intel64/vc14
|
||||
set TBB_INSTALL_DIR=%OSRMDEPSDIR%
|
||||
REM set TBB_ARCH_PLATFORM=intel64/vc17
|
||||
|
||||
ECHO OSRMDEPSDIR ^: %OSRMDEPSDIR%
|
||||
ECHO PREFIX ^: %PREFIX%
|
||||
ECHO BOOST_ROOT ^: %BOOST_ROOT%
|
||||
ECHO BOOST_LIBRARYDIR ^: %BOOST_LIBRARYDIR%
|
||||
ECHO TBB_INSTALL_DIR ^: %TBB_INSTALL_DIR%
|
||||
ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
|
||||
REM ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
|
||||
|
||||
|
||||
ECHO calling cmake ....
|
||||
cmake .. ^
|
||||
-G "Visual Studio 14 2015 Win64" ^
|
||||
-G "Visual Studio 16 2019" ^
|
||||
-DBOOST_ROOT=%BOOST_ROOT% ^
|
||||
-DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
|
||||
-DBoost_ADDITIONAL_VERSIONS=1.58 ^
|
||||
-DBoost_ADDITIONAL_VERSIONS=1.73.0 ^
|
||||
-DBoost_USE_MULTITHREADED=ON ^
|
||||
-DBoost_USE_STATIC_LIBS=ON ^
|
||||
-DEXPAT_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DEXPAT_LIBRARY=%OSRMDEPSDIR%/lib/libexpat.lib ^
|
||||
-DBZIP2_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DBZIP2_LIBRARIES=%OSRMDEPSDIR%/lib/libbz2.lib ^
|
||||
-DLUA_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DLUA_LIBRARIES=%OSRMDEPSDIR%/lib/lua5.3.5.lib ^
|
||||
-DZLIB_INCLUDE_DIR=%OSRMDEPSDIR% ^
|
||||
-DZLIB_LIBRARY=%OSRMDEPSDIR%/lib/libz.lib ^
|
||||
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
|
||||
-DCMAKE_INSTALL_PREFIX=%PREFIX%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
@@ -106,34 +114,46 @@ msbuild OSRM.sln ^
|
||||
/t:rebuild ^
|
||||
/p:BuildInParallel=true ^
|
||||
/m:%NUMBER_OF_PROCESSORS% ^
|
||||
/toolsversion:14.0 ^
|
||||
/p:PlatformToolset=v140 ^
|
||||
/toolsversion:Current ^
|
||||
/p:PlatformToolset=v142 ^
|
||||
/clp:Verbosity=normal ^
|
||||
/nologo ^
|
||||
/flp1:logfile=build_errors.txt;errorsonly ^
|
||||
/flp2:logfile=build_warnings.txt;warningsonly
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
CD %PROJECT_DIR%\build
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH%
|
||||
SET PATH=%PROJECT_DIR%\osrm-deps\lib;%PATH%
|
||||
|
||||
ECHO running extractor-tests.exe ...
|
||||
unit_tests\%Configuration%\extractor-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running contractor-tests.exe ...
|
||||
unit_tests\%Configuration%\contractor-tests.exe
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running engine-tests.exe ...
|
||||
unit_tests\%Configuration%\engine-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running util-tests.exe ...
|
||||
unit_tests\%Configuration%\util-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running server-tests.exe ...
|
||||
unit_tests\%Configuration%\server-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running partitioner-tests.exe ...
|
||||
unit_tests\%Configuration%\partitioner-tests.exe
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running customizer-tests.exe ...
|
||||
unit_tests\%Configuration%\customizer-tests.exe
|
||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
||||
|
||||
ECHO running library-tests.exe ...
|
||||
SET test_region=monaco
|
||||
@@ -141,7 +161,9 @@ SET test_region_ch=ch\monaco
|
||||
SET test_region_corech=corech\monaco
|
||||
SET test_region_mld=mld\monaco
|
||||
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 http://project-osrm.wolt.com/testing/monaco.osm.pbf -OutFile %test_osm%
|
||||
ECHO running %Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
|
||||
%Configuration%\osrm-extract.exe
|
||||
%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
|
||||
MKDIR ch
|
||||
XCOPY %test_region%.osrm.* ch\
|
||||
|
||||
+4
-3
@@ -10,7 +10,7 @@ install:
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
os: Visual Studio 2015
|
||||
os: Visual Studio 2019
|
||||
|
||||
# clone directory
|
||||
clone_folder: c:\projects\osrm
|
||||
@@ -25,9 +25,10 @@ before_test:
|
||||
- npm --version
|
||||
- npm install --ignore-scripts
|
||||
- npm link --ignore-scripts
|
||||
- SET PATH=%CD%\osrm-deps\libs\bin;%PATH%
|
||||
- SET PATH=%CD%\osrm-deps\lib;%PATH%
|
||||
- SET OSRM_BUILD_DIR=build\%Configuration%
|
||||
- npm test
|
||||
# TODO tests fail with "JavaScript heap out of memory", need a better host?
|
||||
# - npm test
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
||||
@@ -11,7 +11,6 @@ SET CONFIGURATION=Release
|
||||
FOR /F "tokens=*" %%i in ('git rev-parse --abbrev-ref HEAD') do SET APPVEYOR_REPO_BRANCH=%%i
|
||||
ECHO APPVEYOR_REPO_BRANCH^: %APPVEYOR_REPO_BRANCH%
|
||||
|
||||
SET PATH=C:\mb\windows-builds-64\tmp-bin\cmake-3.7.0-rc2-win32-x86\bin;%PATH%
|
||||
SET PATH=C:\Program Files\7-Zip;%PATH%
|
||||
|
||||
powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
|
||||
|
||||
@@ -11,7 +11,7 @@ SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "FALSE")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Source Routing Machine (OSRM) is a high-performance routing engine. It combines sophisticated routing algorithms with the open and free data of the OpenStreetMap.")
|
||||
SET(CPACK_PACKAGE_CONTACT "Project OSRM <info@project-osrm.org>")
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENCE.TXT")
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.TXT")
|
||||
|
||||
SET(CPACK_STRIP_FILES "TRUE")
|
||||
file(GLOB_RECURSE ProfileGlob ${CMAKE_SOURCE_DIR}/profiles/*)
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
# Locate STXXL library
|
||||
# This module defines
|
||||
# STXXL_FOUND, if false, do not try to link to libstxxl
|
||||
# STXXL_LIBRARY
|
||||
# STXXL_INCLUDE_DIR, where to find stxxl.h
|
||||
#
|
||||
|
||||
|
||||
IF( NOT STXXL_FIND_QUIETLY )
|
||||
MESSAGE(STATUS "Looking for STXXL...")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(STXXL_INCLUDE_DIR stxxl.h
|
||||
HINTS
|
||||
$ENV{STXXL_DIR}
|
||||
PATH_SUFFIXES stxxl include/stxxl/stxxl include/stxxl include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local # DarwinPorts
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(STXXL_LIBRARY
|
||||
NAMES stxxl stxxl_debug
|
||||
HINTS
|
||||
$ENV{STXXL_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt
|
||||
)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set STXXL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(STXXL DEFAULT_MSG STXXL_LIBRARY STXXL_INCLUDE_DIR)
|
||||
|
||||
IF( NOT STXXL_FIND_QUIETLY )
|
||||
IF( STXXL_FOUND )
|
||||
MESSAGE(STATUS "Found STXXL: ${STXXL_LIBRARY}" )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(STXXL_INCLUDE_DIR STXXL_LIBRARY)
|
||||
+2586
-1646
File diff suppressed because it is too large
Load Diff
+19
-15
@@ -1,16 +1,14 @@
|
||||
FROM alpine:3.6 as buildstage
|
||||
|
||||
FROM debian:stretch-slim as builder
|
||||
ARG DOCKER_TAG
|
||||
ARG BUILD_CONCURRENCY
|
||||
RUN mkdir -p /src && mkdir -p /opt
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
|
||||
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
|
||||
echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.2-dev libtbb@testing libtbb-dev@testing && \
|
||||
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
|
||||
RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} && \
|
||||
apt-get update && \
|
||||
apt-get -y --no-install-recommends install cmake make git gcc g++ libbz2-dev libxml2-dev \
|
||||
libzip-dev libboost1.62-all-dev lua5.2 liblua5.2-dev libtbb-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 && \
|
||||
echo "Building OSRM ${DOCKER_TAG}" && \
|
||||
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
||||
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
||||
@@ -26,20 +24,26 @@ RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
|
||||
make -j${NPROC} install && \
|
||||
cd ../profiles && \
|
||||
cp -r * /opt && \
|
||||
\
|
||||
strip /usr/local/bin/* && \
|
||||
rm -rf /src /usr/local/lib/libosrm*
|
||||
|
||||
|
||||
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
||||
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
|
||||
FROM alpine:3.6 as runstage
|
||||
FROM debian:stretch-slim as runstage
|
||||
RUN mkdir -p /src && mkdir -p /opt
|
||||
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.2 expat libtbb@testing
|
||||
COPY --from=buildstage /usr/local /usr/local
|
||||
COPY --from=buildstage /opt /opt
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends libboost-program-options1.62.0 libboost-regex1.62.0 \
|
||||
libboost-date-time1.62.0 libboost-chrono1.62.0 libboost-filesystem1.62.0 \
|
||||
libboost-iostreams1.62.0 libboost-thread1.62.0 expat liblua5.2-0 libtbb2 &&\
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=builder /usr/local /usr/local
|
||||
COPY --from=builder /opt /opt
|
||||
RUN /usr/local/bin/osrm-extract --help && \
|
||||
/usr/local/bin/osrm-routed --help && \
|
||||
/usr/local/bin/osrm-contract --help && \
|
||||
/usr/local/bin/osrm-partition --help && \
|
||||
/usr/local/bin/osrm-customize --help
|
||||
WORKDIR /opt
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@
|
||||
# ensure that "COPY . /src" is referring to the repo root, not the directory
|
||||
# that contains the Dockerfile.
|
||||
# This script gets executed with a pwd of wherever the Dockerfile is.
|
||||
docker build --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..
|
||||
docker build --build-arg BUILD_CONCURRENCY=${CONCURRENCY:-1} --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..
|
||||
|
||||
+222
-22
@@ -1,3 +1,8 @@
|
||||
# OSRM HTTP server
|
||||
|
||||
Built-in HTTP server is a basic HTTP/1.0 server that supports 'keep-alive' extension. Persistent connections are limited to 512 requests per
|
||||
connection and allow no more then 5 seconds between requests.
|
||||
|
||||
## General options
|
||||
|
||||
All OSRM HTTP requests use a common structure.
|
||||
@@ -16,7 +21,7 @@ GET /{service}/{version}/{profile}/{coordinates}[.{format}]?option=value&option=
|
||||
| `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. |
|
||||
| `coordinates`| String of format `{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]` or `polyline({polyline}) or polyline6({polyline6})`. |
|
||||
| `format`| Only `json` is supported at the moment. This parameter is optional and defaults to `json`. |
|
||||
| `format`| `json` or `flatbuffers`. 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).
|
||||
|
||||
@@ -24,14 +29,16 @@ To pass parameters to each location some options support an array like encoding:
|
||||
|
||||
**Request options**
|
||||
|
||||
| Option | Values | Description |
|
||||
|----------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|
||||
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|
||||
|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. |
|
||||
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
||||
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curb side. |
|
||||
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, order does not matter. |
|
||||
| Option | Values | Description |
|
||||
|----------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|
||||
|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. |
|
||||
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
||||
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curb side. |
|
||||
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, order does not matter. |
|
||||
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|
||||
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of response and do not want to transfer waste data. |
|
||||
|
||||
Where the elements follow the following format:
|
||||
|
||||
@@ -70,6 +77,8 @@ curl 'http://router.project-osrm.org/route/v1/driving/polyline(ofp_Ik_vpAilAyu@t
|
||||
|
||||
### Responses
|
||||
|
||||
#### Code
|
||||
|
||||
Every response object has a `code` property containing one of the strings below or a service dependent code:
|
||||
|
||||
| Type | Description |
|
||||
@@ -87,12 +96,17 @@ Every response object has a `code` property containing one of the strings below
|
||||
- `message` is a **optional** human-readable error message. All other status types are service dependent.
|
||||
- In case of an error the HTTP status code will be `400`. Otherwise the HTTP status code will be `200` and `code` will be `Ok`.
|
||||
|
||||
#### Data version
|
||||
|
||||
Every response object has a `data_version` propetry containing timestamp from the original OpenStreetMap file. This field is optional. It can be ommited if data_version parametr was not set on osrm-extract stage or OSM file has not `osmosis_replication_timestamp` section.
|
||||
|
||||
#### Example response
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "Ok",
|
||||
"message": "Everything worked"
|
||||
"message": "Everything worked",
|
||||
"data_version": "2017-11-17T21:43:02Z"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -115,11 +129,13 @@ In addition to the [general options](#general-options) the following options are
|
||||
|------------|------------------------------|----------------------------------------------------|
|
||||
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
|
||||
|
||||
As `waypoints` is a single thing, returned byt that service, using it with option `skip_waypoints` set to `true` is quite useless, but still
|
||||
possible. In that case only `code` field will be returned.
|
||||
|
||||
**Response**
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `waypoints` array of `Waypoint` objects sorted by distance to the input coordinate. Each object has at least the following additional properties:
|
||||
- `distance`: Distance in meters to the supplied input coordinate.
|
||||
- `nodes`: Array of OpenStreetMap node ids.
|
||||
|
||||
#### Example Requests
|
||||
@@ -195,7 +211,8 @@ In addition to the [general options](#general-options) the following options are
|
||||
|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) |
|
||||
|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. |
|
||||
|waypoints | `{index};{index};{index}...` |Treats input coordinates indicated by given indices as waypoints in returned Match object. Default is to treat all input coordinates as waypoints. |
|
||||
|
||||
\* Please note that even if alternative routes are requested, a result cannot be guaranteed.
|
||||
|
||||
@@ -236,12 +253,16 @@ In addition to the [general options](#general-options) the following options are
|
||||
|------------|--------------------------------------------------|---------------------------------------------|
|
||||
|sources |`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as source. |
|
||||
|destinations|`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as destination.|
|
||||
|annotations |`duration` (default), `distance`, or `duration,distance`|Return the requested table or tables in response. Note that computing the `distances` table is currently only implemented for CH. If `annotations=distance` or `annotations=duration,distance` is requested when running a MLD router, a `NotImplemented` error will be returned.
|
||||
|
|
||||
|annotations |`duration` (default), `distance`, or `duration,distance`|Return the requested table or tables in response. |
|
||||
|fallback_speed|`double > 0`| If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration.|
|
||||
|fallback_coordinate|`input` (default), or `snapped`| When using a `fallback_speed`, use the user-supplied coordinate (`input`), or the snapped location (`snapped`) for calculating distances.|
|
||||
|scale_factor|`double > 0`| Use in conjunction with `annotations=durations`. Scales the table `duration` values by this number.|
|
||||
|
||||
Unlike other array encoded options, the length of `sources` and `destinations` can be **smaller or equal**
|
||||
to number of input locations;
|
||||
|
||||
With `skip_waypoints` set to `true`, both `sources` and `destinations` arrays will be skipped.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
@@ -278,11 +299,12 @@ curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397
|
||||
|
||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||
- `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. Values are given in seconds. Can be `null` if no route between `i` and `j` can be found.
|
||||
the i-th source to the j-th destination. Values are given in seconds. Can be `null` if no route between `i` and `j` can be found.
|
||||
- `distances` array of arrays that stores the matrix in row-major order. `distances[i][j]` gives the travel distance from
|
||||
the i-th waypoint to the j-th waypoint. Values are given in meters. Can be `null` if no route between `i` and `j` can be found. Note that computing the `distances` table is currently only implemented for CH. If `annotations=distance` or `annotations=duration,distance` is requested when running a MLD router, a `NotImplemented` error will be returned.
|
||||
the i-th source to the j-th destination. Values are given in meters. Can be `null` if no route between `i` and `j` can be found.
|
||||
- `sources` array of `Waypoint` objects describing all sources in order
|
||||
- `destinations` array of `Waypoint` objects describing all destinations in order
|
||||
- `fallback_speed_cells` (optional) array of arrays containing `i,j` pairs indicating which cells contain estimated values based on `fallback_speed`. Will be absent if `fallback_speed` is not used.
|
||||
|
||||
In case of error the following `code`s are supported in addition to the general ones:
|
||||
|
||||
@@ -383,6 +405,10 @@ All other properties might be undefined.
|
||||
2361.73,
|
||||
0
|
||||
]
|
||||
],
|
||||
"fallback_speed_cells": [
|
||||
[ 0, 1 ],
|
||||
[ 1, 0 ]
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -551,6 +577,7 @@ Vector tiles contain two layers:
|
||||
| `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 |
|
||||
| `rate` | `float` | the value of `length/weight` - analagous to `speed`, but using the `weight` value rather than `duration`, rounded to the nearest integer |
|
||||
| `is_startpoint` | `boolean` | whether this segment can be used as a start/endpoint for routes |
|
||||
|
||||
`turns` layer:
|
||||
|
||||
@@ -735,8 +762,8 @@ step.
|
||||
{ "bearings" : [ 10, 92, 184, 270 ],
|
||||
"lanes" : [
|
||||
{ "indications" : [ "left", "straight" ],
|
||||
"valid" : "false" },
|
||||
{ "valid" : "true",
|
||||
"valid" : false },
|
||||
{ "valid" : true,
|
||||
"indications" : [ "right" ] }
|
||||
],
|
||||
"out" : 2,
|
||||
@@ -747,9 +774,9 @@ step.
|
||||
{ "out" : 1,
|
||||
"lanes" : [
|
||||
{ "indications" : [ "straight" ],
|
||||
"valid" : "true" },
|
||||
"valid" : true },
|
||||
{ "indications" : [ "right" ],
|
||||
"valid" : "false" }
|
||||
"valid" : false }
|
||||
],
|
||||
"bearings" : [ 60, 240, 330 ],
|
||||
"in" : 0,
|
||||
@@ -857,7 +884,7 @@ A `Lane` represents a turn lane at the corresponding turn location.
|
||||
```json
|
||||
{
|
||||
"indications": ["left", "straight"],
|
||||
"valid": "false"
|
||||
"valid": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -892,7 +919,7 @@ location of the StepManeuver. Further intersections are listed for every cross-w
|
||||
"classes": ["toll", "restricted"],
|
||||
"lanes":{
|
||||
"indications": ["left", "straight"],
|
||||
"valid": "false"
|
||||
"valid": false
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -905,6 +932,7 @@ Object used to describe waypoint on a route.
|
||||
|
||||
- `name` Name of the street the coordinate snapped to
|
||||
- `location` Array that contains the `[longitude, latitude]` pair of the snapped coordinate
|
||||
- `distance` The distance, in metres, from the input coordinate to the snapped coordinate
|
||||
- `hint` Unique internal identifier of the segment (ephemeral, not constant over data updates)
|
||||
This can be used on subsequent request to significantly speed up the query and to connect multiple services.
|
||||
E.g. you can use the `hint` value obtained by the `nearest` query as `hint` values for `route` inputs.
|
||||
@@ -922,3 +950,175 @@ Object used to describe waypoint on a route.
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Flatbuffers format
|
||||
|
||||
Default response format is `json`, but OSRM supports binary [`flatbuffers`](https://google.github.io/flatbuffers/) format, which
|
||||
is much faster in serialization/deserialization, comparing to `json`.
|
||||
|
||||
The format itself is described in message descriptors, located at `include/engine/api/flatbuffers directory`. Those descriptors could
|
||||
be compiled to provide protocol parsers in Go/Javascript/Typescript/Java/Dart/C#/Python/Lobster/Lua/Rust/PHP/Kotlin. Precompiled
|
||||
protocol parser for C++ is supplied with OSRM.
|
||||
|
||||
`Flatbuffers` format provides exactly same data, as `json` format with a slightly different layout, which was optimized to minimize
|
||||
in-transfer size.
|
||||
|
||||
### Root object
|
||||
|
||||
Root object is the only object, available from a 'raw' `flatbuffers` buffer. It can be constructed with a following call:
|
||||
|
||||
auto osrm = osrm::engine::api::fbresult::GetFBResult(some_input_buffer);
|
||||
|
||||
**Properties**
|
||||
|
||||
- `error`: `bool` Marks response as erroneous. Erroneus response should include `code` field set, all the other field may not present.
|
||||
- `code`: `Error` Error description object, only present, when `error` is `true`
|
||||
- `waypoints`: `[Waypoint]` Array of `Waypoint` objects. Should present for every service call, unless `skip_waypoints` is set to `true`. Table service will put `sources` array here.
|
||||
- `routes`: `[RouteObject]` Array of `RouteObject` objects. May be empty or absent. Should present for Route/Trip/Match services call.
|
||||
- `table`: `Table` Table object, may absent. Should be present in case of Table service call.
|
||||
|
||||
### Error object
|
||||
|
||||
Contains error information.
|
||||
|
||||
**Properties**
|
||||
|
||||
- `code`: `string` Error code
|
||||
- `message`: `string` Detailed error message
|
||||
|
||||
### Waypoint object
|
||||
|
||||
Almost same as `json` Waypoint object. The following properties differ:
|
||||
|
||||
- `location`: `Position` Same as `json` location field, but different format.
|
||||
- `nodes`: `Uint64Pair` Same as `json` nodes field, but different format.
|
||||
|
||||
### RouteObject object
|
||||
|
||||
Almost same as `json` Route object. The following properties differ:
|
||||
|
||||
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
|
||||
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
||||
- `legs`: `[Leg]` Array of `Leg` objects.
|
||||
|
||||
### Leg object
|
||||
|
||||
Almost same as `json` Leg object. The following properties differ:
|
||||
|
||||
- `annotations`: `Annotation` Same as `json` annotation field, but different format.
|
||||
- `steps`: `[Step]` Same as `step` annotation field, but different format.
|
||||
|
||||
### Step object
|
||||
|
||||
Almost same as `json` Step object. The following properties differ:
|
||||
|
||||
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
|
||||
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
||||
- `maneuver`: `StepManeuver` Same as `json` maneuver field, but different format.
|
||||
|
||||
| `type` | Description |
|
||||
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `Turn` | a basic turn into direction of the `modifier` |
|
||||
| `NewName` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
|
||||
| `Depart` | indicates the departure of the leg |
|
||||
| `Arrive` | indicates the destination of the leg |
|
||||
| `Merge` | merge onto a street (e.g. getting on the highway from a ramp, the `modifier specifies the direction of the merge`) |
|
||||
| `OnRamp` | take a ramp to enter a highway (direction given my `modifier`) |
|
||||
| `OffRamp` | take a ramp to exit a highway (direction given my `modifier`) |
|
||||
| `Fork` | take the left/right side at a fork depending on `modifier` |
|
||||
| `EndOfRoad` | road ends in a T intersection turn in direction of `modifier` |
|
||||
| `Continue` | Turn in direction of `modifier` to stay on the same road |
|
||||
| `Roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
|
||||
| `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). |
|
||||
| `RoundaboutTurn` | 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 |
|
||||
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceeded by a `roundabout` instruction) |
|
||||
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||
|
||||
- `driving_side`: `bool` Ttrue stands for the left side driving.
|
||||
- `intersections`: `[Intersection]` Same as `json` intersections field, but different format.
|
||||
|
||||
### Intersection object
|
||||
|
||||
Almost same as `json` Intersection object. The following properties differ:
|
||||
|
||||
- `location`: `Position` Same as `json` location property, but in different format.
|
||||
- `lanes`: `[Lane]` Array of `Lane` objects.
|
||||
|
||||
### Lane object
|
||||
|
||||
Almost same as `json` Lane object. The following properties differ:
|
||||
|
||||
- `indications`: `Turn` Array of `Turn` enum values.
|
||||
|
||||
| `value` | Description |
|
||||
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `None` | No dedicated indication is shown. |
|
||||
| `UTurn` | An indication signaling the possibility to reverse (i.e. fully bend arrow). |
|
||||
| `SharpRight` | An indication indicating a sharp right turn (i.e. strongly bend arrow). |
|
||||
| `Right` | An indication indicating a right turn (i.e. bend arrow). |
|
||||
| `SlightRight` | An indication indicating a slight right turn (i.e. slightly bend arrow). |
|
||||
| `Straight` | No dedicated indication is shown (i.e. straight arrow). |
|
||||
| `SlightLeft` | An indication indicating a slight left turn (i.e. slightly bend arrow). |
|
||||
| `Left` | An indication indicating a left turn (i.e. bend arrow). |
|
||||
| `SharpLeft` | An indication indicating a sharp left turn (i.e. strongly bend arrow). |
|
||||
|
||||
### StepManeuver object
|
||||
|
||||
Almost same as `json` StepManeuver object. The following properties differ:
|
||||
|
||||
- `location`: `Position` Same as `json` location property, but in different format.
|
||||
- `type`: `ManeuverType` Type of a maneuver (enum)
|
||||
|
||||
| `type` | Description |
|
||||
|------------------|--------------------------------------------------------------|
|
||||
| `Turn` | a basic turn into direction of the `modifier` |
|
||||
| `NewName` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
|
||||
| `Depart` | indicates the departure of the leg |
|
||||
| `Arrive` | indicates the destination of the leg |
|
||||
| `Merge` | merge onto a street (e.g. getting on the highway from a ramp, the `modifier specifies the direction of the merge`) |
|
||||
| `OnRamp` | take a ramp to enter a highway (direction given my `modifier`) |
|
||||
| `OffRamp` | take a ramp to exit a highway (direction given my `modifier`) |
|
||||
| `Fork` | take the left/right side at a fork depending on `modifier` |
|
||||
| `EndOfRoad` | road ends in a T intersection turn in direction of `modifier`|
|
||||
| `Continue` | Turn in direction of `modifier` to stay on the same road |
|
||||
| `Roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
|
||||
| `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). |
|
||||
| `RoundaboutTurn` | 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 |
|
||||
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceeded by a `roundabout` instruction) |
|
||||
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||
|
||||
- `modifier`: `Turn` Maneuver turn (enum)
|
||||
|
||||
### Annotation object
|
||||
|
||||
Exactly same as `json` annotation object.
|
||||
|
||||
|
||||
### Position object
|
||||
|
||||
A point on Earth.
|
||||
|
||||
***Properties***
|
||||
- `longitute`: `float` Point's longitude
|
||||
- `latitude`: `float` Point's latitude
|
||||
|
||||
### Uint64Pair
|
||||
|
||||
A pair of long long integers. Used only by `Waypoint` object.
|
||||
|
||||
***Properties***
|
||||
- `first`: `uint64` First pair value.
|
||||
- `second`: `uint64` Second pair value.
|
||||
|
||||
### Table object
|
||||
|
||||
Almost same as `json` Table object. The main difference is that 'sources' field is absent and root's object 'waypoints' field is
|
||||
used instead. All the other differences follow:
|
||||
|
||||
- `durations`: `[float]` Flat representation of a durations matrix. Element at row;col can be adressed as [row * cols + col]
|
||||
- `distances`: `[float]` Flat representation of a destinations matrix. Element at row;col can be adressed as [row * cols + col]
|
||||
- `destinations`: `[Waypoint]` Array of `Waypoint` objects. Will be `null` if `skip_waypoints` will be set to `true`
|
||||
- `rows`: `ushort` Number of rows in durations/destinations matrices.
|
||||
- `cols`: `ushort` Number of cols in durations/destinations matrices.
|
||||
|
||||
+62
-19
@@ -25,7 +25,11 @@ var osrm = new OSRM('network.osrm');
|
||||
Make sure you prepared the dataset with the correct toolchain.
|
||||
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
|
||||
This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
|
||||
- `options.memory_file` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Path to a file on disk to store the memory using mmap.
|
||||
- `options.dataset_name` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Connects to the persistent shared memory datastore defined by `--dataset_name` option when running `osrm-datastore`
|
||||
This requires you to run `osrm-datastore --dataset_name` prior to creating an `OSRM` object.
|
||||
- `options.memory_file` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** *DEPRECATED*
|
||||
Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`.
|
||||
- `options.mmap_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
|
||||
- `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.
|
||||
- `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).
|
||||
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
|
||||
@@ -46,6 +50,7 @@ Returns the fastest route between two or more coordinates while visiting the way
|
||||
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.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
|
||||
- `options.alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes.
|
||||
_Please note that even if alternative routes are requested, a result cannot be guaranteed._ (optional, default `0`)
|
||||
@@ -55,8 +60,10 @@ Returns the fastest route between two or more coordinates while visiting the way
|
||||
- `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.
|
||||
- `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`.
|
||||
- `options.waypoints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
|
||||
`null`/`true`/`false`
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
|
||||
@@ -85,10 +92,12 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
|
||||
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.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `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`)
|
||||
- `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)**
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
|
||||
@@ -121,13 +130,20 @@ tables. Optionally returns distance table.
|
||||
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.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `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.
|
||||
- `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.
|
||||
- `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)**
|
||||
- `options.fallback_speed` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
|
||||
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies diestance between two points.
|
||||
- `options.scale_factor` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `options.annotations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default) or `['duration', distance']` (return both the duration matrix and the distance matrix).
|
||||
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
|
||||
@@ -152,6 +168,7 @@ Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer
|
||||
Values are given in seconds.
|
||||
**`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order.
|
||||
**`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order.
|
||||
**`fallback_speed_cells`**: (optional) if `fallback_speed` is used, will be an array of arrays of `row,column` values, indicating which cells contain estimated values.
|
||||
|
||||
### tile
|
||||
|
||||
@@ -167,7 +184,7 @@ and what weights they have applied.
|
||||
- `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)
|
||||
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**
|
||||
|
||||
@@ -196,6 +213,7 @@ if they can not be matched successfully.
|
||||
- `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.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.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `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.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`)
|
||||
@@ -204,7 +222,9 @@ if they can not be matched successfully.
|
||||
- `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)**
|
||||
- `options.waypoints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
|
||||
@@ -260,6 +280,7 @@ Right now, the following combinations are possible:
|
||||
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 `double >= 0` or `null` (unlimited, default).
|
||||
- `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.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `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.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`)
|
||||
@@ -268,7 +289,8 @@ Right now, the following combinations are possible:
|
||||
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return 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)** Return 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)**
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
|
||||
@@ -297,9 +319,30 @@ Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer
|
||||
2) `waypoint_index`: index of the point in the trip.
|
||||
**`trips`**: an array of [`Route`](#route) objects that assemble the trace.
|
||||
|
||||
## Responses
|
||||
## Plugin behaviour
|
||||
|
||||
Responses
|
||||
All plugins support a second additional object that is available to configure some NodeJS specific behaviours.
|
||||
|
||||
- `plugin_config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
|
||||
- `plugin_config.format` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls. Valid options are `object` (default), which returns a standard Javascript object, as described above, and `json_buffer`, which will return a NodeJS **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string. The latter has the advantage that it can be immediately serialized to disk/sent over the network, and the generation of the string is performed outside the main NodeJS event loop. This option is ignored by the `tile` plugin.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var osrm = new OSRM('network.osrm');
|
||||
var options = {
|
||||
coordinates: [
|
||||
[13.36761474609375, 52.51663871100423],
|
||||
[13.374481201171875, 52.506191342034576]
|
||||
]
|
||||
};
|
||||
osrm.route(options, { format: "json_buffer" }, function(err, response) {
|
||||
if (err) throw err;
|
||||
console.log(response.toString("utf-8"));
|
||||
});
|
||||
```
|
||||
|
||||
## Responses
|
||||
|
||||
### Route
|
||||
|
||||
@@ -307,8 +350,8 @@ Represents a route through (potentially multiple) waypoints.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `exteral` **documentation** in
|
||||
[`osrm-backend`](../http.md#route)
|
||||
- **documentation** in
|
||||
[`osrm-backend`](../http.md#route-object)
|
||||
|
||||
### RouteLeg
|
||||
|
||||
@@ -316,8 +359,8 @@ Represents a route between two waypoints.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `exteral` **documentation** in
|
||||
[`osrm-backend`](../http.md#routeleg)
|
||||
- **documentation** in
|
||||
[`osrm-backend`](../http.md#routeleg-object)
|
||||
|
||||
### RouteStep
|
||||
|
||||
@@ -326,15 +369,15 @@ single way to the subsequent step.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `exteral` **documentation** in
|
||||
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#routestep)
|
||||
- **documentation** in
|
||||
[`osrm-backend`](../http.md#routestep-object)
|
||||
|
||||
### StepManeuver
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `exteral` **documentation** in
|
||||
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#stepmaneuver)
|
||||
- **documentation** in
|
||||
[`osrm-backend`](../http.md#stepmaneuver-object)
|
||||
|
||||
### Waypoint
|
||||
|
||||
@@ -342,5 +385,5 @@ Object used to describe waypoint on a route.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `exteral` **documentation** in
|
||||
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint)
|
||||
- **documentation** in
|
||||
[`osrm-backend`](../http.md#waypoint-object)
|
||||
|
||||
+6
-6
@@ -89,7 +89,7 @@ They all return a table of functions when you use `require` to load them. You ca
|
||||
### setup()
|
||||
The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing.
|
||||
|
||||
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have its own set of globals.
|
||||
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA interpreter will have its own set of globals.
|
||||
|
||||
The following global properties can be set under `properties` in the hash you return in the `setup` function:
|
||||
|
||||
@@ -98,7 +98,7 @@ 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`)
|
||||
use_turn_restrictions | Boolean | Are turn restrictions 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
|
||||
@@ -178,7 +178,7 @@ exits | String | The ramp's exit numbers or
|
||||
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.road_priority_class | Enum | Guidance: order in priority list. Defined in `include/extractor/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
|
||||
|
||||
@@ -223,7 +223,7 @@ source_number_of_lanes | Read | Integer |
|
||||
source_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
source_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
source_speed | Read | Integer | Speed on this source road in km/h
|
||||
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/road_classification.hpp`
|
||||
target_restricted | Read | Boolean | Is the target a restricted access road? (See definition in `process_way`)
|
||||
target_mode | Read | Enum | Travel mode after the turn. Defined in `include/extractor/travel_mode.hpp`
|
||||
target_is_motorway | Read | Boolean | Is the target road a motorway?
|
||||
@@ -232,7 +232,7 @@ target_number_of_lanes | Read | Integer |
|
||||
target_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
target_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
|
||||
target_speed | Read | Integer | Speed on this target road in km/h
|
||||
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/road_classification.hpp`
|
||||
roads_on_the_right | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the right of the turn that are also connected at the intersection
|
||||
roads_on_the_left | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the left of the turn that are also connected at the intersection. If turn is a u turn, this is empty.
|
||||
weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
|
||||
@@ -252,7 +252,7 @@ number_of_lanes | Read | Integer | How many lanes does th
|
||||
highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
|
||||
access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
|
||||
speed | Read | Integer | Speed on this road in km/h
|
||||
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/guidance/road_classification.hpp`
|
||||
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/road_classification.hpp`
|
||||
is_incoming | Read | Boolean | Is the road an incoming road of the intersection
|
||||
is_outgoing | Read | Boolean | Is the road an outgoing road of the intersection
|
||||
|
||||
|
||||
+2
-1
@@ -50,7 +50,8 @@ We may introduce forward-compatible changes: query parameters and response prope
|
||||
7. Push tags and commits: `git push; git push --tags`
|
||||
8. On https://github.com/Project-OSRM/osrm-backend/releases press `Draft a new release`,
|
||||
write the release tag `vx.y.z` in the `Tag version` field, write the changelog entries in the `Describe this release` field
|
||||
and press `Publish release`.
|
||||
and press `Publish release`. Note that Travis deployments will create a release when publishing node binaries, so the release
|
||||
may already exist. In which case the description should be updated with the changelog entries.
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Building OSRM for Windows
|
||||
|
||||
## Dependencies
|
||||
|
||||
Get a decent Windows with decent Visual Studio (14 at least for C++11 support). The published binaries are build with
|
||||
VS2019 and Windows SDK8.1.
|
||||
|
||||
In case you are using [prepacked Windows VM with VS2019](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/), you
|
||||
have to install [Windows SDK 8.1](https://go.microsoft.com/fwlink/p/?LinkId=323507)
|
||||
|
||||
Prepare directories for dependencies, build and target file location.Target directory ($target starting from that moment) should have /include and /lib subdirectories.
|
||||
|
||||
### Bzip2
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/bzip2-1.0.8.tar.gz
|
||||
* https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
|
||||
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Issue `nmake /f makefile.msc`
|
||||
4. Copy bzlib.h to $target\include and libbz2.lib to $target\lib
|
||||
|
||||
### ZLib
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/zlib-1.2.11.tar.gz
|
||||
* https://www.zlib.net/zlib-1.2.11.tar.gz
|
||||
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Switch to `contrib\vstudio\vc14`
|
||||
4. If needed, open `zlibvc.sln` with Visual Studio and retarget to your version of compiler and SDK.
|
||||
5. Issue `msbuild zlibvc.sln /p:BuildInParallel=true /p:Configuration=Release /p:Platform=x64 /m:<Number of cpu cores>`
|
||||
6. Copy x64\ZlibStatRelease\zlibstat.lib to $target\lib\libz.lib, copy zlib.h and zconf.h to $target\include
|
||||
|
||||
### ICU
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://wolt-project.wolt.com/deps/icu4c-66_1-src.zip
|
||||
* https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.zip
|
||||
* https://wolt-project.wolt.com/deps/icu4c-66_1-data.zip
|
||||
* https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-data.zip
|
||||
2. Do retarget if neededby openinig .\source\allinone\allinone.sln and editing projects
|
||||
3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
4. Run build:
|
||||
msbuild .\source\allinone\allinone.sln /nologo /p:BuildInParallel=true /p:Configuration=Release /p:Platform=x64 /m:<Number of cpu cores>
|
||||
5. Copy lib64\*.lib to $target\lib, copy include contents to $target\include
|
||||
6. Copy bin64\*dll to any dir withing your $PATH. At the same time copy them to $target\lib
|
||||
|
||||
### Boost
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/boost_1_73_0.zip
|
||||
* https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip
|
||||
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Build b2:
|
||||
bootstrap.bat --with-toolset=msvc-14.2
|
||||
4. Build boost:
|
||||
b2 -a -d release state --build-type=minimal toolset=msvc-14.2 -q runtime-link=shared link=static address-model=64 --with-iostreams --with-test --with-thread --with-filesystem --with-date_time --with-system --with-program_options --with-regex --disable-filesystem2 -sHAVE_ICU=1 include=<target>\include library-path=<target>\lib -sZLIB_SOURCE=<builddir>/zlib -zBZIP2_BINARY=libbz2 -sBZIP2_INCLUDE=<target>\include -sBZIP2_LIBPATH=<target>\lib -sICU_ICUUC_NAME=icuuc -sICU_ICUDT_NAME=icudt -sICU_ICUIN_NAME=icuin -sBUILD=boost_unit_test_framework -j<number of cpu cores>
|
||||
5. Copy `boost` subdirectory to <target>\include and contents of `stage` to <target>\lib
|
||||
|
||||
### Expat
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/libexpat-2_2_9.zip
|
||||
* https://github.com/libexpat/libexpat/archive/R_2_2_9.zip
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Configure build my calling cmake:
|
||||
mkdir expat\build
|
||||
cd expat\build
|
||||
cmake -G"Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DEXPAT_MSVC_STATIC_CRT=ON -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_BUILD_TESTS=OFF -DEXPAT_SHARED_LIBS=OFF ..
|
||||
4. Build expat: `msbuild expat.sln /nologo /p:Configuration=Release /p:Platform=x64`
|
||||
5. Copy `Release\libexpat.*` to <target>/lib. Copy `expat/lib/expat.h` and `expat/lib/expat_external.h` to <target>/include
|
||||
|
||||
### LUA
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/lua-5.3.5.tar.gz
|
||||
* https://www.lua.org/ftp/lua-5.3.5.tar.gz
|
||||
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
3. Lua doesn't have native MSVC support, so you have to compile it by hand:
|
||||
cd src
|
||||
cl /MD /O2 /c /DLUA_COMPAT_5_2 *.c
|
||||
ren lua.obj lua.o
|
||||
ren luac.obj luac.o
|
||||
link /LIB /OUT:lua5.3.5.dll *.obj
|
||||
4. Copy `lua5.3.5.lib` to <target>/lib. Copy `lua.h`,`lauxlib,h`,`lua.hpp`,`lualib.h`,`luaconf.h` to <target>/include
|
||||
|
||||
### TBB
|
||||
|
||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
||||
* https://project-osrm.wolt.com/deps/oneTBB-v2020.2.zip
|
||||
* https://github.com/oneapi-src/oneTBB/archive/v2020.2.zip
|
||||
2. Retarget by opening build\vs2013\makefile.sln
|
||||
3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||
4. Switch to build\vs2013 and build: `msbuild makefle.sln /nologo /p:Configuration=Release /p:Platform=x64`
|
||||
5. Copy x64/Release/*.{dll,lib} files to <target>/lib and copy contents of include directory to <target>/include
|
||||
+5
-4
@@ -52,14 +52,15 @@ int main(int argc, const char *argv[])
|
||||
params.coordinates.push_back({util::FloatLongitude{7.419505}, util::FloatLatitude{43.736825}});
|
||||
|
||||
// Response is in JSON format
|
||||
json::Object result;
|
||||
engine::api::ResultT result = json::Object();
|
||||
|
||||
// Execute routing request, this does the heavy lifting
|
||||
const auto status = osrm.Route(params, result);
|
||||
|
||||
auto &json_result = result.get<json::Object>();
|
||||
if (status == Status::Ok)
|
||||
{
|
||||
auto &routes = result.values["routes"].get<json::Array>();
|
||||
auto &routes = json_result.values["routes"].get<json::Array>();
|
||||
|
||||
// Let's just use the first route
|
||||
auto &route = routes.values.at(0).get<json::Object>();
|
||||
@@ -79,8 +80,8 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
else if (status == Status::Error)
|
||||
{
|
||||
const auto code = result.values["code"].get<json::String>().value;
|
||||
const auto message = result.values["message"].get<json::String>().value;
|
||||
const auto code = json_result.values["code"].get<json::String>().value;
|
||||
const auto message = json_result.values["message"].get<json::String>().value;
|
||||
|
||||
std::cout << "Code: " << code << "\n";
|
||||
std::cout << "Message: " << code << "\n";
|
||||
|
||||
@@ -127,6 +127,7 @@ Feature: Bike - Access tags on ways
|
||||
| | | agricultural | |
|
||||
| | | forestry | |
|
||||
| | | delivery | |
|
||||
| | | use_sidepath | |
|
||||
|
||||
Scenario: Bike - Access tags on both node and way
|
||||
Then routability should be
|
||||
|
||||
@@ -46,6 +46,18 @@ Feature: Car - Barriers
|
||||
| bollard | rising | x |
|
||||
| bollard | removable | |
|
||||
|
||||
# https://github.com/Project-OSRM/osrm-backend/issues/5996
|
||||
Scenario: Car - Kerb exception for barriers
|
||||
Then routability should be
|
||||
| node/barrier | node/highway | node/kerb | bothw |
|
||||
| kerb | | | |
|
||||
| kerb | crossing | | x |
|
||||
| kerb | crossing | yes | x |
|
||||
| kerb | | lowered | x |
|
||||
| kerb | | flush | x |
|
||||
| kerb | | raised | |
|
||||
| kerb | | yes | |
|
||||
|
||||
Scenario: Car - Height restrictions
|
||||
Then routability should be
|
||||
| node/barrier | node/maxheight | bothw |
|
||||
|
||||
@@ -387,217 +387,37 @@ Feature: Car - Turn restrictions
|
||||
| m | p | mj,jp,jp |
|
||||
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - only_right_turn
|
||||
Scenario: Car - Multiple conditional restrictions applicable to same 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
|
||||
"""
|
||||
a
|
||||
d j b
|
||||
c
|
||||
j
|
||||
|
|
||||
k - l - m
|
||||
|
|
||||
n
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| bj | yes |
|
||||
| jd | yes |
|
||||
| nodes |
|
||||
| kl |
|
||||
| jl |
|
||||
| ln |
|
||||
| lm |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
|
||||
| restriction | kl | lj | l | only_left_turn @ (Sa-Su 07:00-10:30) |
|
||||
| restriction | kl | ln | l | only_right_turn @ (Mo-Fr 07:00-10:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| b | c | bj,aj,aj,jc,jc |
|
||||
| b | a | bj,aj,aj |
|
||||
| b | d | bj,aj,aj,jd,jd |
|
||||
| k | m | kl,ln,ln,lm,lm |
|
||||
|
||||
@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
|
||||
"""
|
||||
a
|
||||
d j b
|
||||
c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| bj | yes |
|
||||
| jd | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | # |
|
||||
| b | c | bj,jc,jc | normal turn |
|
||||
| b | a | bj,jc,jc,aj,aj | avoids right turn |
|
||||
| b | d | bj,jd,jd | 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
|
||||
"""
|
||||
a
|
||||
d j b
|
||||
c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| bj | yes |
|
||||
| jd | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| b | c | bj,jc,jc |
|
||||
| b | a | bj,jc,jc,aj,aj |
|
||||
| b | d | bj,jc,jc,jd,jd |
|
||||
|
||||
@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
|
||||
"""
|
||||
a
|
||||
d j b
|
||||
c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| bj | yes |
|
||||
| jd | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| b | c | bj,aj,aj,jc,jc |
|
||||
| b | a | bj,aj,aj |
|
||||
| b | d | bj,jd,jd |
|
||||
|
||||
@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
|
||||
"""
|
||||
a
|
||||
d j b
|
||||
c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| bj | yes |
|
||||
| jd | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| b | c | bj,jc,jc |
|
||||
| b | a | bj,aj,aj |
|
||||
| b | d | bj,jd,jd |
|
||||
|
||||
@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
|
||||
"""
|
||||
a
|
||||
d j b
|
||||
c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| bj | yes |
|
||||
| jd | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| b | c | bj,jc,jc |
|
||||
| b | a | bj,jc,jc,aj,aj |
|
||||
| b | d | bj,jd,jd |
|
||||
|
||||
@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
|
||||
"""
|
||||
a
|
||||
p |
|
||||
\ |
|
||||
j
|
||||
| \
|
||||
c m
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| aj | no |
|
||||
| jc | no |
|
||||
| jp | yes |
|
||||
| mj | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | p | aj,jc,jc,jp,jp |
|
||||
| m | p | mj,jp,jp |
|
||||
|
||||
@restriction-way
|
||||
Scenario: Car - prohibit turn
|
||||
@@ -719,7 +539,7 @@ Feature: Car - Turn restrictions
|
||||
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 nw,florida nw | depart,turn left,arrive |
|
||||
| f | d | cap north,florida nw,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
|
||||
@@ -796,8 +616,8 @@ Feature: Car - Turn restrictions
|
||||
| nodes | name |
|
||||
| ab | albic |
|
||||
| bc | albic |
|
||||
| db | dobe |
|
||||
| be | dobe |
|
||||
| db | dobe |
|
||||
| be | dobe |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
@@ -1047,7 +867,7 @@ Feature: Car - Turn restrictions
|
||||
| type | way:from | node:via | way:to | restriction:conditional |
|
||||
| restriction | be | e | de | no_right_turn @ (Mo-Fr 07:00-11:00) |
|
||||
|
||||
# node restrictino is off, way restriction is on
|
||||
# node restriction is off, way restriction is on
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
|
||||
@@ -109,3 +109,12 @@ Feature: Car - Handle ferry routes
|
||||
When I route I should get
|
||||
| from | to | route | modes | time |
|
||||
| c | d | bcde,bcde | ferry,ferry | 600s |
|
||||
|
||||
Given the query options
|
||||
| geometries | geojson |
|
||||
| overview | full |
|
||||
|
||||
# Note that matching *should* work across unsnappable ferries
|
||||
When I match I should get
|
||||
| trace | geometry | duration |
|
||||
| abcdef| 1,1,1.000899,1,1.000899,1,1.002697,1,1.002697,1,1.003596,1,1.003596,1,1.005394,1,1.005394,1,1.006293,1 | 610.9 |
|
||||
|
||||
@@ -137,3 +137,28 @@ OSRM will use 4/5 of the projected free-flow speed.
|
||||
| primary | | | 30 | -1 | | 23 km/h | | 6.7 |
|
||||
| primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 |
|
||||
| primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 |
|
||||
|
||||
|
||||
Scenario: Car - Respect source:maxspeed
|
||||
Given the node map
|
||||
"""
|
||||
a b c d e f g
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | source:maxspeed | maxspeed |
|
||||
| ab | trunk | | |
|
||||
| bc | trunk | | 60 |
|
||||
| cd | trunk | FR:urban | |
|
||||
| de | trunk | CH:rural | |
|
||||
| ef | trunk | CH:trunk | |
|
||||
| fg | trunk | CH:motorway | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | speed |
|
||||
| a | b | ab,ab | 85 km/h |
|
||||
| b | c | bc,bc | 48 km/h |
|
||||
| c | d | cd,cd | 40 km/h |
|
||||
| d | e | de,de | 64 km/h |
|
||||
| e | f | ef,ef | 80 km/h |
|
||||
| f | g | fg,fg | 96 km/h |
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,7 @@ Feature: Car - Handle physical limitation
|
||||
| primary | 1 | | |
|
||||
| primary | 3 | | x |
|
||||
| primary | | 1 | |
|
||||
| primary | | 8' | x |
|
||||
| primary | | 3 | x |
|
||||
| primary | | default | x |
|
||||
| primary | | none | x |
|
||||
@@ -62,6 +63,7 @@ Feature: Car - Handle physical limitation
|
||||
| highway | maxweight | bothw |
|
||||
| primary | | x |
|
||||
| primary | 1 | |
|
||||
| primary | 2 | x |
|
||||
| primary | 3.5 | x |
|
||||
| primary | 35000 kg | x |
|
||||
| primary | 8.9t | x |
|
||||
|
||||
@@ -798,82 +798,6 @@ Feature: Car - Turn restrictions
|
||||
| from | to | route |
|
||||
| a | d | ab,be,de,de |
|
||||
|
||||
@restriction-way
|
||||
Scenario: Multi Way restriction
|
||||
Given the node map
|
||||
"""
|
||||
k j
|
||||
| |
|
||||
h - - g - f - - e
|
||||
| |
|
||||
| |
|
||||
a - - b - c - - d
|
||||
| |
|
||||
l i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | oneway |
|
||||
| ab | horiz | yes |
|
||||
| bc | horiz | yes |
|
||||
| cd | horiz | yes |
|
||||
| ef | horiz | yes |
|
||||
| fg | horiz | yes |
|
||||
| gh | horiz | yes |
|
||||
| ic | vert | yes |
|
||||
| cf | vert | yes |
|
||||
| fj | vert | yes |
|
||||
| kg | vert | yes |
|
||||
| gb | vert | yes |
|
||||
| bl | vert | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bc,cf,fg | gh | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | h | horiz,vert,horiz,horiz |
|
||||
|
||||
@restriction-way
|
||||
Scenario: Multi-Way overlapping single-way
|
||||
Given the node map
|
||||
"""
|
||||
e
|
||||
|
|
||||
a - b - c - d
|
||||
|
|
||||
f - g
|
||||
|
|
||||
h
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name |
|
||||
| ab | abcd |
|
||||
| bc | abcd |
|
||||
| cd | abcd |
|
||||
| hf | hfb |
|
||||
| fb | hfb |
|
||||
| gf | gf |
|
||||
| ce | ce |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bc | ce | only_left_turn |
|
||||
| restriction | gf | fb,bc | cd | only_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | abcd,ce,ce,abcd,abcd | depart,turn left,continue uturn,turn left,arrive | a,c,e,c,d |
|
||||
| a | e | abcd,ce,ce | depart,turn left,arrive | a,c,e |
|
||||
| a | f | abcd,hfb,hfb | depart,turn right,arrive | a,b,f |
|
||||
| g | e | gf,hfb,abcd,ce,ce | depart,turn right,turn right,turn left,arrive | g,f,b,c,e |
|
||||
| g | d | gf,hfb,abcd,abcd | depart,turn right,turn right,arrive | g,f,b,d |
|
||||
| h | e | hfb,abcd,ce,ce | depart,end of road right,turn left,arrive | h,b,c,e |
|
||||
| h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d |
|
||||
|
||||
|
||||
@restriction-way
|
||||
Scenario: Car - prohibit turn, traffic lights
|
||||
Given the node map
|
||||
@@ -984,8 +908,6 @@ Feature: Car - Turn restrictions
|
||||
| restriction | ab | bge | de | no_right_turn |
|
||||
| restriction | bc | bge | ef | no_left_turn |
|
||||
|
||||
# this case is currently not handling the via-way restrictions and we need support for looking across traffic signals.
|
||||
# It is mainly included to show limitations and to prove that we don't crash hard here
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,bge,ef,ef,de,de |
|
||||
|
||||
@@ -35,3 +35,91 @@ Feature: Car - Allowed start/end modes
|
||||
| from | to | route | modes |
|
||||
| 1 | 2 | ab,ab | driving,driving |
|
||||
| 2 | 1 | ab,ab | driving,driving |
|
||||
|
||||
Scenario: Car - URL override of non-startpoints
|
||||
Given the node map
|
||||
"""
|
||||
a 1 b c 2 d
|
||||
"""
|
||||
|
||||
Given the query options
|
||||
| snapping | any |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | access |
|
||||
| ab | service | private |
|
||||
| bc | primary | |
|
||||
| cd | service | private |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 2 | c |
|
||||
| 1 | 59.1 | 35.1 |
|
||||
| b | 35.1 | 11.1 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| 1 | 2 | ab,bc,cd |
|
||||
| 2 | 1 | cd,bc,ab |
|
||||
|
||||
Scenario: Car - URL override of non-startpoints
|
||||
Given the node map
|
||||
"""
|
||||
a 1 b c 2 d
|
||||
"""
|
||||
|
||||
Given the query options
|
||||
| snapping | any |
|
||||
| bearings | 90,180; |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | access |
|
||||
| ab | service | private |
|
||||
| bc | primary | |
|
||||
| cd | service | private |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| 1 | 2 | ab,bc,cd |
|
||||
| 2 | 1 | cd,bc,ab |
|
||||
|
||||
Scenario: Car - URL override of non-startpoints
|
||||
Given the node map
|
||||
"""
|
||||
a 1 b c 2 d
|
||||
"""
|
||||
|
||||
Given the query options
|
||||
| snapping | any |
|
||||
| radiuses | 100;unlimited |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | access |
|
||||
| ab | service | private |
|
||||
| bc | primary | |
|
||||
| cd | service | private |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| 1 | 2 | ab,bc,cd |
|
||||
| 2 | 1 | cd,bc,ab |
|
||||
|
||||
Scenario: Car - URL override of non-startpoints
|
||||
Given the node map
|
||||
"""
|
||||
a 1 b c 2 d
|
||||
"""
|
||||
|
||||
Given the query options
|
||||
| snapping | any |
|
||||
| bearings | 90,180;0,180;; |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | access |
|
||||
| ab | service | private |
|
||||
| bc | primary | |
|
||||
| cd | service | private |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 2 | c |
|
||||
| 1 | 59.1 | 35.1 |
|
||||
| b | 35.1 | 11.1 |
|
||||
@@ -84,7 +84,47 @@ class OSRMDirectLoader extends OSRMBaseLoader {
|
||||
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
|
||||
}
|
||||
});
|
||||
callback();
|
||||
|
||||
this.child.readyFunc = (data) => {
|
||||
if (/running and waiting for requests/.test(data)) {
|
||||
this.child.stdout.removeListener('data', this.child.readyFunc);
|
||||
callback();
|
||||
}
|
||||
};
|
||||
this.child.stdout.on('data',this.child.readyFunc);
|
||||
}
|
||||
};
|
||||
|
||||
class OSRMmmapLoader extends OSRMBaseLoader {
|
||||
constructor (scope) {
|
||||
super(scope);
|
||||
}
|
||||
|
||||
load (inputFile, callback) {
|
||||
this.inputFile = inputFile;
|
||||
this.shutdown(() => {
|
||||
this.launch(callback);
|
||||
});
|
||||
}
|
||||
|
||||
osrmUp (callback) {
|
||||
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
|
||||
|
||||
const command_arguments = util.format('%s -p %d -i %s -a %s --mmap', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM);
|
||||
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
|
||||
if (err && err.signal !== 'SIGINT') {
|
||||
this.child = null;
|
||||
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
|
||||
}
|
||||
});
|
||||
|
||||
this.child.readyFunc = (data) => {
|
||||
if (/running and waiting for requests/.test(data)) {
|
||||
this.child.stdout.removeListener('data', this.child.readyFunc);
|
||||
callback();
|
||||
}
|
||||
};
|
||||
this.child.stdout.on('data',this.child.readyFunc);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -135,22 +175,32 @@ class OSRMLoader {
|
||||
this.scope = scope;
|
||||
this.sharedLoader = new OSRMDatastoreLoader(this.scope);
|
||||
this.directLoader = new OSRMDirectLoader(this.scope);
|
||||
this.mmapLoader = new OSRMmmapLoader(this.scope);
|
||||
this.method = scope.DEFAULT_LOAD_METHOD;
|
||||
}
|
||||
|
||||
load (inputFile, callback) {
|
||||
if (!this.loader) {
|
||||
this.loader = {shutdown: (cb) => cb() };
|
||||
}
|
||||
if (this.method === 'datastore') {
|
||||
this.directLoader.shutdown((err) => {
|
||||
this.loader.shutdown((err) => {
|
||||
if (err) return callback(err);
|
||||
this.loader = this.sharedLoader;
|
||||
this.sharedLoader.load(inputFile, callback);
|
||||
});
|
||||
} else if (this.method === 'directly') {
|
||||
this.sharedLoader.shutdown((err) => {
|
||||
this.loader.shutdown((err) => {
|
||||
if (err) return callback(err);
|
||||
this.loader = this.directLoader;
|
||||
this.directLoader.load(inputFile, callback);
|
||||
});
|
||||
} else if (this.method === 'mmap') {
|
||||
this.loader.shutdown((err) => {
|
||||
if (err) return callback(err);
|
||||
this.loader = this.mmapLoader;
|
||||
this.mmapLoader.load(inputFile, callback);
|
||||
});
|
||||
} else {
|
||||
callback(new Error('*** Unknown load method ' + method));
|
||||
}
|
||||
|
||||
@@ -111,3 +111,28 @@ Feature: Locating Nearest node on a Way - basic projection onto way
|
||||
| 7 | b |
|
||||
| 8 | a |
|
||||
| 9 | b |
|
||||
|
||||
Scenario: Nearest - easy-west way with flatbuffers
|
||||
Given the node map
|
||||
"""
|
||||
0 1 2 3 4
|
||||
a x b
|
||||
5 6 7 8 9
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I request nearest with flatbuffers I should get
|
||||
| in | out |
|
||||
| 0 | a |
|
||||
| 1 | a |
|
||||
| 2 | x |
|
||||
| 3 | b |
|
||||
| 4 | b |
|
||||
| 5 | a |
|
||||
| 6 | a |
|
||||
| 7 | x |
|
||||
| 8 | b |
|
||||
| 9 | b |
|
||||
|
||||
@@ -180,3 +180,30 @@ Feature: Turn Function Information
|
||||
And stdout should contain /roads_on_the_right \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: false, highway_turn_classification: 3, access_turn_classification: 0/
|
||||
# turning abc, give information about about db
|
||||
And stdout should contain /roads_on_the_left \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: false, highway_turn_classification: 0, access_turn_classification: 1/
|
||||
|
||||
Scenario: Turns should have correct information of two-way roads at intersection
|
||||
Given the node map
|
||||
"""
|
||||
b
|
||||
|
|
||||
a-c-d
|
||||
|
|
||||
e
|
||||
"""
|
||||
And the ways
|
||||
| nodes | highway | oneway |
|
||||
| ac | motorway | yes |
|
||||
| cd | motorway_link | yes |
|
||||
| bc | trunk | yes |
|
||||
| cb | trunk_link | yes |
|
||||
| ce | primary | yes |
|
||||
| ec | primary_link | yes |
|
||||
And the data has been saved to disk
|
||||
|
||||
When I run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit successfully
|
||||
# Turn acd
|
||||
# on the left there should be cb (and bc)
|
||||
And stdout should contain /roads_on_the_left \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: true, highway_turn_classification: [0-9]+, access_turn_classification: 0, priority_class: 3/
|
||||
# on the right there should be ce and ec
|
||||
And stdout should contain /roads_on_the_right \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: true, highway_turn_classification: [0-9]+, access_turn_classification: 0, priority_class: 4/
|
||||
|
||||
@@ -295,7 +295,7 @@ module.exports = function () {
|
||||
this.reprocess(callback);
|
||||
});
|
||||
|
||||
this.Given(/^osrm\-routed is stopped$/, (callback) => {
|
||||
this.Given(/^osrm-routed is stopped$/, (callback) => {
|
||||
this.OSRMLoader.shutdown(callback);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,24 +1,38 @@
|
||||
var util = require('util');
|
||||
|
||||
var flatbuffers = require('../support/flatbuffers').flatbuffers;
|
||||
var FBResult = require('../support/fbresult_generated').osrm.engine.api.fbresult.FBResult;
|
||||
|
||||
module.exports = function () {
|
||||
const durationsRegex = new RegExp(/^I request a travel time matrix I should get$/);
|
||||
const distancesRegex = new RegExp(/^I request a travel distance matrix I should get$/);
|
||||
const estimatesRegex = new RegExp(/^I request a travel time matrix I should get estimates for$/);
|
||||
const durationsRegexFb = new RegExp(/^I request a travel time matrix with flatbuffers I should get$/);
|
||||
const distancesRegexFb = new RegExp(/^I request a travel distance matrix with flatbuffers I should get$/);
|
||||
|
||||
const DURATIONS_NO_ROUTE = 2147483647; // MAX_INT
|
||||
const DISTANCES_NO_ROUTE = 3.40282e+38; // MAX_FLOAT
|
||||
|
||||
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', callback);}.bind(this));
|
||||
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', callback);}.bind(this));
|
||||
const FORMAT_JSON = 'json';
|
||||
const FORMAT_FB = 'flatbuffers';
|
||||
|
||||
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_JSON, callback);}.bind(this));
|
||||
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_JSON, callback);}.bind(this));
|
||||
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', FORMAT_JSON, callback);}.bind(this));
|
||||
this.When(durationsRegexFb, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_FB, callback);}.bind(this));
|
||||
this.When(distancesRegexFb, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_FB, callback);}.bind(this));
|
||||
};
|
||||
|
||||
const durationsParse = function(v) { return isNaN(parseInt(v)); };
|
||||
const distancesParse = function(v) { return isNaN(parseFloat(v)); };
|
||||
const estimatesParse = function(v) { return isNaN(parseFloat(v)); };
|
||||
|
||||
function tableParse(table, noRoute, annotation, callback) {
|
||||
function tableParse(table, noRoute, annotation, format, callback) {
|
||||
|
||||
const parse = annotation == 'distances' ? distancesParse : durationsParse;
|
||||
const parse = annotation == 'distances' ? distancesParse : (annotation == 'durations' ? durationsParse : estimatesParse);
|
||||
const params = this.queryParams;
|
||||
params.annotations = annotation == 'distances' ? 'distance' : 'duration';
|
||||
params.annotations = ['durations','fallback_speed_cells'].indexOf(annotation) !== -1 ? 'duration' : 'distance';
|
||||
params.output = format;
|
||||
|
||||
var tableRows = table.raw();
|
||||
|
||||
@@ -59,13 +73,54 @@ function tableParse(table, noRoute, annotation, callback) {
|
||||
if (err) return callback(err);
|
||||
if (!response.body.length) return callback(new Error('Invalid response body'));
|
||||
|
||||
var json = JSON.parse(response.body);
|
||||
var result = [];
|
||||
if (format === 'json') {
|
||||
var json = JSON.parse(response.body);
|
||||
|
||||
var result = json[annotation].map(row => {
|
||||
var hashes = {};
|
||||
row.forEach((v, i) => { hashes[tableRows[0][i+1]] = parse(v) ? '' : v; });
|
||||
return hashes;
|
||||
});
|
||||
if (annotation === 'fallback_speed_cells') {
|
||||
result = table.raw().map(row => row.map(() => ''));
|
||||
json[annotation].forEach(pair => {
|
||||
result[pair[0]+1][pair[1]+1] = 'Y';
|
||||
});
|
||||
result = result.slice(1).map(row => {
|
||||
var hashes = {};
|
||||
row.slice(1).forEach((v,i) => {
|
||||
hashes[tableRows[0][i+1]] = v;
|
||||
});
|
||||
return hashes;
|
||||
});
|
||||
} else {
|
||||
result = json[annotation].map(row => {
|
||||
var hashes = {};
|
||||
row.forEach((v, i) => { hashes[tableRows[0][i+1]] = parse(v) ? '' : v; });
|
||||
return hashes;
|
||||
});
|
||||
}
|
||||
} else { //flatbuffers
|
||||
var body = response.body;
|
||||
var bytes = new Uint8Array(body.length);
|
||||
for (var indx = 0; indx < body.length; ++indx) {
|
||||
bytes[indx] = body.charCodeAt(indx);
|
||||
}
|
||||
var buf = new flatbuffers.ByteBuffer(bytes);
|
||||
var fb = FBResult.getRootAsFBResult(buf);
|
||||
|
||||
var matrix;
|
||||
if (annotation === 'durations') {
|
||||
matrix = fb.table().durationsArray();
|
||||
}
|
||||
if (annotation === 'distances') {
|
||||
matrix = fb.table().distancesArray();
|
||||
}
|
||||
var cols = fb.table().cols();
|
||||
var rows = fb.table().rows();
|
||||
for (let r = 0; r < rows; ++r) {
|
||||
result[r]={};
|
||||
for(let c=0; c < cols; ++c) {
|
||||
result[r][tableRows[0][c+1]] = matrix[r*cols + c];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testRow = (row, ri, cb) => {
|
||||
for (var k in result[ri]) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
var util = require('util');
|
||||
|
||||
var flatbuffers = require('../support/flatbuffers').flatbuffers;
|
||||
var FBResult = require('../support/fbresult_generated').osrm.engine.api.fbresult.FBResult;
|
||||
|
||||
module.exports = function () {
|
||||
this.When(/^I request nearest I should get$/, (table, callback) => {
|
||||
this.reprocessAndLoadData((e) => {
|
||||
@@ -43,4 +46,55 @@ module.exports = function () {
|
||||
this.processRowsAndDiff(table, testRow, callback);
|
||||
});
|
||||
});
|
||||
|
||||
this.When(/^I request nearest with flatbuffers I should get$/, (table, callback) => {
|
||||
this.reprocessAndLoadData((e) => {
|
||||
if (e) return callback(e);
|
||||
var testRow = (row, ri, cb) => {
|
||||
var inNode = this.findNodeByName(row.in);
|
||||
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
||||
|
||||
var outNode = this.findNodeByName(row.out);
|
||||
if (!outNode) throw new Error(util.format('*** unknown out-node "%s"', row.out));
|
||||
|
||||
this.queryParams.output = 'flatbuffers';
|
||||
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
||||
if (err) return cb(err);
|
||||
var coord;
|
||||
|
||||
if (response.statusCode === 200 && response.body.length) {
|
||||
var body = response.body;
|
||||
var bytes = new Uint8Array(body.length);
|
||||
for (var indx = 0; indx < body.length; ++indx) {
|
||||
bytes[indx] = body.charCodeAt(indx);
|
||||
}
|
||||
var buf = new flatbuffers.ByteBuffer(bytes);
|
||||
var fb = FBResult.getRootAsFBResult(buf);
|
||||
var location = fb.waypoints(0).location();
|
||||
|
||||
coord = [location.longitude(), location.latitude()];
|
||||
|
||||
var got = { in: row.in, out: row.out };
|
||||
|
||||
Object.keys(row).forEach((key) => {
|
||||
if (key === 'out') {
|
||||
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
||||
got[key] = row[key];
|
||||
} else {
|
||||
row[key] = util.format('%s [%d,%d]', row[key], outNode.lat, outNode.lon);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cb(null, got);
|
||||
}
|
||||
else {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.processRowsAndDiff(table, testRow, callback);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -21,11 +21,11 @@ module.exports = function () {
|
||||
});
|
||||
};
|
||||
|
||||
this.When(/^I run "osrm\-routed\s?(.*?)"$/, { timeout: this.TIMEOUT }, (options, callback) => {
|
||||
this.When(/^I run "osrm-routed\s?(.*?)"$/, { timeout: this.TIMEOUT }, (options, callback) => {
|
||||
this.runAndSafeOutput('osrm-routed', options, callback);
|
||||
});
|
||||
|
||||
this.When(/^I run "osrm\-(extract|contract|partition|customize)\s?(.*?)"$/, (binary, options, callback) => {
|
||||
this.When(/^I run "osrm-(extract|contract|partition|customize)\s?(.*?)"$/, (binary, options, callback) => {
|
||||
const stamp = this.processedCacheFile + '.stamp_' + binary;
|
||||
this.runAndSafeOutput('osrm-' + binary, options, (err) => {
|
||||
if (err) return callback(err);
|
||||
@@ -33,11 +33,11 @@ module.exports = function () {
|
||||
});
|
||||
});
|
||||
|
||||
this.When(/^I try to run "(osrm\-[a-z]+)\s?(.*?)"$/, (binary, options, callback) => {
|
||||
this.When(/^I try to run "(osrm-[a-z]+)\s?(.*?)"$/, (binary, options, callback) => {
|
||||
this.runAndSafeOutput(binary, options, () => { callback(); });
|
||||
});
|
||||
|
||||
this.When(/^I run "osrm\-datastore\s?(.*?)"(?: with input "([^"]*)")?$/, (options, input, callback) => {
|
||||
this.When(/^I run "osrm-datastore\s?(.*?)"(?: with input "([^"]*)")?$/, (options, input, callback) => {
|
||||
let child = this.runAndSafeOutput('osrm-datastore', options, callback);
|
||||
if (input !== undefined)
|
||||
child.stdin.write(input);
|
||||
@@ -55,13 +55,13 @@ module.exports = function () {
|
||||
this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => {
|
||||
const contains = this.stdout.indexOf(str) > -1;
|
||||
assert.ok(typeof not === 'undefined' ? contains : !contains,
|
||||
'stdout ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
|
||||
'stdout ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
|
||||
});
|
||||
|
||||
this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => {
|
||||
const contains = this.stderr.indexOf(str) > -1;
|
||||
assert.ok(typeof not === 'undefined' ? contains : !contains,
|
||||
'stderr ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
|
||||
'stderr ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
|
||||
});
|
||||
|
||||
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
|
||||
|
||||
@@ -69,7 +69,7 @@ module.exports = function () {
|
||||
outputRow[direction] = result[direction].status ?
|
||||
'x' : '';
|
||||
break;
|
||||
case /^[\d\.]+ s/.test(want):
|
||||
case /^[\d.]+ s/.test(want):
|
||||
// the result here can come back as a non-number value like
|
||||
// `diff`, but we only want to apply the unit when it comes
|
||||
// back as a number, for tableDiff's literal comparison
|
||||
|
||||
@@ -12,4 +12,9 @@ module.exports = function () {
|
||||
|
||||
q.awaitAll(callback);
|
||||
});
|
||||
|
||||
this.Given(/^skip waypoints$/, (callback) => {
|
||||
this.queryParams['skip_waypoints'] = true;
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = function() {
|
||||
|
||||
// setup cache for feature data
|
||||
// if OSRM_PROFILE is set to force a specific profile, then
|
||||
// include the profile name in the hash of the profile file
|
||||
// include the profile name in the hash of the profile file
|
||||
hash.hashOfFile(uri, this.OSRM_PROFILE, (err, hash) => {
|
||||
if (err) return callback(err);
|
||||
|
||||
@@ -45,10 +45,10 @@ module.exports = function() {
|
||||
this.featureProcessedCacheDirectories[uri] = featureProcessedCacheDirectory;
|
||||
|
||||
d3.queue(1)
|
||||
.defer(mkdirp, featureProcessedCacheDirectory)
|
||||
.defer(this.cleanupFeatureCache.bind(this), featureCacheDirectory, hash)
|
||||
.defer(this.cleanupProcessedFeatureCache.bind(this), featureProcessedCacheDirectory, this.osrmHash)
|
||||
.awaitAll(callback);
|
||||
.defer(mkdirp, featureProcessedCacheDirectory)
|
||||
.defer(this.cleanupFeatureCache.bind(this), featureCacheDirectory, hash)
|
||||
.defer(this.cleanupProcessedFeatureCache.bind(this), featureProcessedCacheDirectory, this.osrmHash)
|
||||
.awaitAll(callback);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ module.exports = function() {
|
||||
fs.readdir(parentPath, (err, files) => {
|
||||
let q = d3.queue();
|
||||
files.filter(name => { return name !== featureHash;})
|
||||
.map((f) => { q.defer(rimraf, path.join(parentPath, f)); });
|
||||
.map((f) => { q.defer(rimraf, path.join(parentPath, f)); });
|
||||
q.awaitAll(callback);
|
||||
});
|
||||
};
|
||||
@@ -145,7 +145,7 @@ module.exports = function() {
|
||||
|
||||
// converts the scenario titles in file prefixes
|
||||
this.getScenarioID = (scenario) => {
|
||||
let name = scenario.getName().toLowerCase().replace(/[\/\-'=,\(\):\*#]/g, '')
|
||||
let name = scenario.getName().toLowerCase().replace(/[/\-'=,():*#]/g, '')
|
||||
.replace(/\s/g, '_').replace(/__/g, '_').replace(/\.\./g, '.')
|
||||
.substring(0, 64);
|
||||
return util.format('%d_%s', scenario.getLine(), name);
|
||||
|
||||
@@ -17,12 +17,12 @@ module.exports = {
|
||||
return true;
|
||||
|
||||
var matchPercent = want.match(/(.*)\s+~(.+)%$/),
|
||||
matchAbs = want.match(/(.*)\s+\+\-(.+)$/),
|
||||
matchAbs = want.match(/(.*)\s+\+-(.+)$/),
|
||||
matchRe = want.match(/^\/(.*)\/$/),
|
||||
// we use this for matching before/after bearing
|
||||
matchBearingListAbs = want.match(/^((\d+)->(\d+))(,(\d+)->(\d+))*\s+\+\-(.+)$/),
|
||||
matchIntersectionListAbs = want.match(/^(((((true|false):\d+)\s{0,1})+,{0,1})+;{0,1})+\s+\+\-(.+)$/),
|
||||
matchRangeNumbers = want.match(/\d+\+\-\d+/);
|
||||
matchBearingListAbs = want.match(/^((\d+)->(\d+))(,(\d+)->(\d+))*\s+\+-(.+)$/),
|
||||
matchIntersectionListAbs = want.match(/^(((((true|false):\d+)\s{0,1})+,{0,1})+;{0,1})+\s+\+-(.+)$/),
|
||||
matchRangeNumbers = want.match(/\d+\+-\d+/);
|
||||
|
||||
function inRange(margin, got, want) {
|
||||
var fromR = parseFloat(want) - margin,
|
||||
@@ -31,12 +31,12 @@ module.exports = {
|
||||
}
|
||||
function parseIntersectionString(str) {
|
||||
return str.split(';')
|
||||
.map((turn_intersections) => turn_intersections
|
||||
.split(',')
|
||||
.map((intersection) => intersection
|
||||
.split(' ')
|
||||
.map((entry_bearing_pair) => entry_bearing_pair
|
||||
.split(':'))));
|
||||
.map((turn_intersections) => turn_intersections
|
||||
.split(',')
|
||||
.map((intersection) => intersection
|
||||
.split(' ')
|
||||
.map((entry_bearing_pair) => entry_bearing_pair
|
||||
.split(':'))));
|
||||
}
|
||||
|
||||
if (got === want) {
|
||||
|
||||
@@ -22,17 +22,12 @@ module.exports = function () {
|
||||
this.PROFILES_PATH = path.resolve(this.ROOT_PATH, 'profiles');
|
||||
this.FIXTURES_PATH = path.resolve(this.ROOT_PATH, 'unit_tests/fixtures');
|
||||
this.BIN_PATH = process.env.OSRM_BUILD_DIR && process.env.OSRM_BUILD_DIR || path.resolve(this.ROOT_PATH, 'build');
|
||||
var stxxl_config = path.resolve(this.ROOT_PATH, 'test/.stxxl');
|
||||
if (!fs.existsSync(stxxl_config)) {
|
||||
return callback(new Error('*** '+stxxl_config+ 'does not exist'));
|
||||
}
|
||||
|
||||
this.DATASET_NAME = 'cucumber';
|
||||
this.PLATFORM_WINDOWS = process.platform.match(/^win.*/);
|
||||
this.DEFAULT_ENVIRONMENT = Object.assign({STXXLCFG: stxxl_config}, process.env);
|
||||
this.DEFAULT_ENVIRONMENT = process.env;
|
||||
this.DEFAULT_PROFILE = 'bicycle';
|
||||
this.DEFAULT_INPUT_FORMAT = 'osm';
|
||||
this.DEFAULT_LOAD_METHOD = 'datastore';
|
||||
this.DEFAULT_LOAD_METHOD = process.argv[process.argv.indexOf('-m') +1].match('mmap') ? 'mmap' : 'datastore';
|
||||
this.DEFAULT_ORIGIN = [1,1];
|
||||
this.OSM_USER = 'osrm';
|
||||
this.OSM_UID = 1;
|
||||
@@ -80,7 +75,7 @@ module.exports = function () {
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(util.format('Node Version', process.version));
|
||||
if (parseInt(process.version.match(/v(\d)/)[1]) < 4) throw new Error('*** Please upgrade to Node 4.+ to run OSRM cucumber tests');
|
||||
if (parseInt(process.version.match(/v(\d+)/)[1]) < 4) throw new Error('*** Please upgrade to Node 4.+ to run OSRM cucumber tests');
|
||||
|
||||
fs.exists(this.TEST_PATH, (exists) => {
|
||||
if (exists)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -75,6 +75,10 @@ module.exports = function () {
|
||||
got.message = json.message || '';
|
||||
}
|
||||
|
||||
if (headers.has('data_version')) {
|
||||
got.data_version = json.data_version || '';
|
||||
}
|
||||
|
||||
if (headers.has('#')) {
|
||||
// comment column
|
||||
got['#'] = row['#'];
|
||||
@@ -115,7 +119,7 @@ module.exports = function () {
|
||||
|
||||
if (headers.has('weight')) {
|
||||
if (row.weight.length) {
|
||||
if (!row.weight.match(/[\d\.]+/))
|
||||
if (!row.weight.match(/[\d.]+/))
|
||||
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
|
||||
got.weight = instructions ? util.format('%d', weight) : '';
|
||||
} else {
|
||||
@@ -151,7 +155,14 @@ module.exports = function () {
|
||||
if (headers.has('locations')){
|
||||
got.locations = (locations || '').trim();
|
||||
}
|
||||
/*
|
||||
if (headers.has('waypoints_count')) {
|
||||
if ('waypoints' in json) {
|
||||
got.waypoints_count = json.waypoints.length;
|
||||
} else{
|
||||
got.waypoints_count = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (headers.has('approaches')){
|
||||
got.approaches = (approaches || '').trim();
|
||||
}*/
|
||||
|
||||
@@ -17,9 +17,43 @@ Feature: Basic Routing
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| b | a | ab,ab |
|
||||
| from | to | route | data_version | waypoints_count |
|
||||
| a | b | ab,ab | | 2 |
|
||||
| b | a | ab,ab | | 2 |
|
||||
|
||||
Scenario: Data_version test
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the extract extra arguments "--data_version cucumber_data_version"
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | data_version |
|
||||
| a | b | ab,ab | cucumber_data_version |
|
||||
| b | a | ab,ab | cucumber_data_version |
|
||||
|
||||
Scenario: Skip_waypoints test
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And skip waypoints
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | waypoints_count |
|
||||
| a | b | ab,ab | 0 |
|
||||
| b | a | ab,ab | 0 |
|
||||
|
||||
Scenario: Routing in between two nodes of way
|
||||
Given the node map
|
||||
|
||||
@@ -5,21 +5,49 @@ Feature: Basic Distance Matrix
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
And the partition extra arguments "--small-component-size 1 --max-cell-sizes 2,4,8,16"
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of minimal network
|
||||
Scenario: Testbot - Travel distance matrix of small grid
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
a b c
|
||||
d e f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| abc |
|
||||
| def |
|
||||
| ad |
|
||||
| be |
|
||||
| cf |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 100+-1 |
|
||||
| b | 100+-1 | 0 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
||||
| f | 299.5 | 199.5 | 100.1 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of minimal network exact distances
|
||||
Given the node map
|
||||
"""
|
||||
a z
|
||||
b
|
||||
c
|
||||
d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| az |
|
||||
| zbcd |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | z | b | c | d |
|
||||
| a | 0 | 100.1 | 199.5 | 298.9 | 398.3 |
|
||||
| z | 100.1 | 0 | 99.4 | 198.8 | 298.2 |
|
||||
| b | 199.5 | 99.4 | 0 | 99.4 | 198.8 |
|
||||
| c | 298.9 | 198.8 | 99.4 | 0 | 99.4 |
|
||||
| d | 398.3 | 298.2 | 198.8 | 99.4 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of minimal network with toll exclude
|
||||
Given the query options
|
||||
@@ -39,11 +67,11 @@ Feature: Basic Distance Matrix
|
||||
| bd | motorway | yes | not drivable for exclude=toll and exclude=motorway,toll |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100+-1 | | |
|
||||
| b | 100+-1 | 0 | | |
|
||||
| c | | | 0 | 100+-1 |
|
||||
| d | | | 100+-1 | 0 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100.1 | | |
|
||||
| b | 100.1 | 0 | | |
|
||||
| c | | | 0 | 100.1 |
|
||||
| d | | | 100.1 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of minimal network with motorway exclude
|
||||
Given the query options
|
||||
@@ -63,8 +91,8 @@ Feature: Basic Distance Matrix
|
||||
| bd | residential | |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 300+-2 | 100+-2 | 200+-2 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 298.9 | 99.4 | 199.5 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
|
||||
Given the query options
|
||||
@@ -84,8 +112,8 @@ Feature: Basic Distance Matrix
|
||||
| efgh | residential | |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e |
|
||||
| a | 0 | 50+-1 | |
|
||||
| | a | b | e |
|
||||
| a | 0 | 50.1 | |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of minimal network with motorway and toll excludes
|
||||
Given the query options
|
||||
@@ -106,7 +134,7 @@ Feature: Basic Distance Matrix
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e | g |
|
||||
| a | 0 | 100+-1 | | |
|
||||
| a | 0 | 100.1 | | |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix with different way speeds
|
||||
Given the node map
|
||||
@@ -121,22 +149,22 @@ Feature: Basic Distance Matrix
|
||||
| cd | tertiary |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| b | 100+-1 | 0 | 100+-1 | 200+-1 |
|
||||
| c | 200+-1 | 100+-1 | 0 | 100+-1 |
|
||||
| d | 300+-1 | 200+-1 | 100+-1 | 0 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100.1 | 200.1 | 300.2 |
|
||||
| b | 100.1 | 0 | 100.1 | 200.1 |
|
||||
| c | 200.1 | 100.1 | 0 | 100.1 |
|
||||
| d | 300.2 | 200.1 | 100.1 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100.1 | 200.1 | 300.2 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 100+-1 |
|
||||
| c | 200+-1 |
|
||||
| d | 300+-1 |
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 100.1 |
|
||||
| c | 200.1 |
|
||||
| d | 300.2 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of small grid
|
||||
Given the node map
|
||||
@@ -154,11 +182,11 @@ Feature: Basic Distance Matrix
|
||||
| cf |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| b | 100+-1 | 0 | 100+-1 | 200+-1 |
|
||||
| e | 200+-1 | 100+-1 | 0 | 100+-1 |
|
||||
| f | 300+-1 | 200+-1 | 100+-1 | 0 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
||||
| f | 299.5 | 199.5 | 100.1 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of network with unroutable parts
|
||||
Given the node map
|
||||
@@ -172,7 +200,7 @@ Feature: Basic Distance Matrix
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 100+-1 |
|
||||
| a | 0 | 100.1 |
|
||||
| b | | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix of network with oneways
|
||||
@@ -189,11 +217,11 @@ Feature: Basic Distance Matrix
|
||||
| by | |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | x | y | d | e |
|
||||
| x | 0 | 300+-2 | 400+-2 | 300+-2 |
|
||||
| y | 500+-2 | 0 | 300+-2 | 200+-2 |
|
||||
| d | 200+-2 | 300+-2 | 0 | 300+-2 |
|
||||
| e | 300+-2 | 400+-2 | 100+-2 | 0 |
|
||||
| | x | y | d | e |
|
||||
| x | 0 | 300.2 | 399.6 | 299.5 |
|
||||
| y | 499 | 0 | 299.5 | 199.5 |
|
||||
| d | 199.5 | 299.5 | 0 | 298.9 |
|
||||
| e | 299.5 | 399.6 | 100.1 | 0 |
|
||||
|
||||
Scenario: Testbot - Rectangular travel distance matrix
|
||||
Given the node map
|
||||
@@ -212,53 +240,53 @@ Feature: Basic Distance Matrix
|
||||
|
||||
When I route I should get
|
||||
| from | to | distance |
|
||||
| e | a | 200m +- 1 |
|
||||
| e | b | 100m +- 1 |
|
||||
| f | a | 300m +- 1 |
|
||||
| f | b | 200m +- 1 |
|
||||
| e | a | 200m |
|
||||
| e | b | 100m |
|
||||
| f | a | 299.9m |
|
||||
| f | b | 200m |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 100+-1 |
|
||||
| e | 200+-1 |
|
||||
| f | 300+-1 |
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 100.1 |
|
||||
| e | 199.5 |
|
||||
| f | 299.5 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| b | 100+-1 | 0 | 100+-1 | 200+-1 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 100+-1 |
|
||||
| b | 100+-1 | 0 |
|
||||
| e | 200+-1 | 100+-1 |
|
||||
| f | 300+-1 | 200+-1 |
|
||||
| | a | b |
|
||||
| a | 0 | 100.1 |
|
||||
| b | 100.1 | 0 |
|
||||
| e | 199.5 | 99.4 |
|
||||
| f | 299.5 | 199.5 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| b | 100+-1 | 0 | 100+-1 | 200+-1 |
|
||||
| e | 200+-1 | 100+-1 | 0 | 100+-1 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e |
|
||||
| a | 0 | 100+-1 | 200+-1 |
|
||||
| b | 100+-1 | 0 | 100+-1 |
|
||||
| e | 200+-1 | 100+-1 | 0 |
|
||||
| f | 300+-1 | 200+-1 | 100+-1 |
|
||||
| | a | b | e |
|
||||
| a | 0 | 100.1 | 199.5 |
|
||||
| b | 100.1 | 0 | 99.4 |
|
||||
| e | 199.5 | 99.4 | 0 |
|
||||
| f | 299.5 | 199.5 | 100.1 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
|
||||
| b | 100+-1 | 0 | 100+-1 | 200+-1 |
|
||||
| e | 200+-1 | 100+-1 | 0 | 100+-1 |
|
||||
| f | 300+-1 | 200+-1 | 100+-1 | 0 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
||||
| f | 299.5 | 199.5 | 100.1 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance 3x2 matrix
|
||||
Given the node map
|
||||
@@ -277,9 +305,9 @@ Feature: Basic Distance Matrix
|
||||
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | b | e | f |
|
||||
| a | 100+-1 | 200+-1 | 300+-1 |
|
||||
| b | 0 | 100+-1 | 200+-1 |
|
||||
| | b | e | f |
|
||||
| a | 100.1 | 199.5 | 299.5 |
|
||||
| b | 0 | 99.4 | 199.5 |
|
||||
|
||||
Scenario: Testbot - All coordinates are from same small component
|
||||
Given a grid size of 300 meters
|
||||
@@ -299,9 +327,9 @@ Feature: Basic Distance Matrix
|
||||
| fg |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | f | g |
|
||||
| f | 0 | 300+-2 |
|
||||
| g | 300+-2 | 0 |
|
||||
| | f | g |
|
||||
| f | 0 | 298.2 |
|
||||
| g | 298.2 | 0 |
|
||||
|
||||
Scenario: Testbot - Coordinates are from different small component and snap to big CC
|
||||
Given a grid size of 300 meters
|
||||
@@ -333,11 +361,11 @@ Feature: Basic Distance Matrix
|
||||
| i | h | 300m |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | f | g | h | i |
|
||||
| f | 0 | 300+-2 | 0 | 300+-2 |
|
||||
| g | 300+-2 | 0 | 300+-2 | 0 |
|
||||
| h | 0 | 300+-2 | 0 | 300+-2 |
|
||||
| i | 300+-2 | 0 | 300+-2 | 0 |
|
||||
| | f | g | h | i |
|
||||
| f | 0 | 298.2 | 0 | 298.2 |
|
||||
| g | 298.2 | 0 | 298.2 | 0 |
|
||||
| h | 0 | 298.2 | 0 | 298.2 |
|
||||
| i | 298.2 | 0 | 298.2 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix with loops
|
||||
Given the node map
|
||||
@@ -354,11 +382,11 @@ Feature: Basic Distance Matrix
|
||||
| da | yes |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 | 2 | 3 | 4 |
|
||||
| 1 | 0 | 100+-1 | 400+-1 | 500+-1 |
|
||||
| 2 | 700+-1 | 0 | 300+-1 | 400+-1 |
|
||||
| 3 | 400+-1 | 500+-1 | 0 | 100+-1 |
|
||||
| 4 | 300+-1 | 400+-1 | 700+-1 | 0 |
|
||||
| | 1 | 2 | 3 | 4 |
|
||||
| 1 | 0 | 100.1 | 399.6 | 499.7 |
|
||||
| 2 | 699.1 | 0 | 299.5 | 399.6 |
|
||||
| 3 | 399.6 | 499.7 | 0 | 100.1 |
|
||||
| 4 | 299.5 | 399.6 | 699.1 | 0 |
|
||||
|
||||
|
||||
Scenario: Testbot - Travel distance matrix based on segment durations
|
||||
@@ -395,12 +423,12 @@ Feature: Basic Distance Matrix
|
||||
| ce |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d | e |
|
||||
| a | 0 | 100+-2 | 200+-2 | 300+-2 | 400+-2 |
|
||||
| b | 100+-2 | 0 | 100+-2 | 200+-2 | 300+-2 |
|
||||
| c | 200+-2 | 100+-2 | 0 | 100+-2 | 200+-2 |
|
||||
| d | 300+-2 | 200+-2 | 100+-2 | 0 | 300+-2 |
|
||||
| e | 400+-2 | 300+-2 | 200+-2 | 300+-2 | 0 |
|
||||
| | a | b | c | d | e |
|
||||
| a | 0 | 100.1 | 200.1 | 300.2 | 398.9 |
|
||||
| b | 100.1 | 0 | 100.1 | 200.1 | 298.9 |
|
||||
| c | 200.1 | 100.1 | 0 | 100.1 | 198.8 |
|
||||
| d | 300.2 | 200.1 | 100.1 | 0 | 298.9 |
|
||||
| e | 398.9 | 298.9 | 198.8 | 298.9 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix for alternative loop paths
|
||||
Given the profile file
|
||||
@@ -439,26 +467,26 @@ Feature: Basic Distance Matrix
|
||||
| ca | yes |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
||||
| 1 | 0 | 1100+-5 | 300+-5 | 200+-5 | 600+-5 | 500+-5 | 900+-5 | 800+-5 |
|
||||
| 2 | 100+-5 | 0 | 400+-5 | 300+-5 | 700+-5 | 600+-5 | 1000+-5 | 900+-5 |
|
||||
| 3 | 900+-5 | 800+-5 | 0 | 1100+-5 | 300+-5 | 200+-5 | 600+-5 | 500+-5 |
|
||||
| 4 | 1000+-5 | 900+-5 | 100+-5 | 0 | 400+-5 | 300+-5 | 700+-5 | 600+-5 |
|
||||
| 5 | 600+-5 | 500+-5 | 900+-5 | 800+-5 | 0 | 1100+-5 | 300+-5 | 200+-5 |
|
||||
| 6 | 700+-5 | 600+-5 | 1000+-5 | 900+-5 | 100+-5 | 0 | 400+-5 | 300+-5 |
|
||||
| 7 | 300+-5 | 200+-5 | 600+-5 | 500+-5 | 900+-5 | 800+-5 | 0 | 1100+-5 |
|
||||
| 8 | 400+-5 | 300+-5 | 700+-5 | 600+-5 | 1000+-5 | 900+-5 | 100+-5 | 0 |
|
||||
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
||||
| 1 | 0 | 1096.7 | 298.9 | 199.5 | 598.4 | 498.3 | 897.3 | 797.9 |
|
||||
| 2 | 100.1 | 0 | 398.9 | 299.5 | 698.5 | 598.4 | 997.3 | 897.9 |
|
||||
| 3 | 897.9 | 797.9 | 0 | 1097.4 | 299.5 | 199.5 | 598.4 | 499 |
|
||||
| 4 | 997.3 | 897.3 | 99.4 | 0 | 398.9 | 298.9 | 697.8 | 598.4 |
|
||||
| 5 | 598.4 | 498.3 | 897.3 | 797.9 | 0 | 1096.7 | 298.9 | 199.5 |
|
||||
| 6 | 698.5 | 598.4 | 997.3 | 897.9 | 100.1 | 0 | 398.9 | 299.5 |
|
||||
| 7 | 299.5 | 199.5 | 598.4 | 499 | 897.9 | 797.9 | 0 | 1097.4 |
|
||||
| 8 | 398.9 | 298.9 | 697.8 | 598.4 | 997.3 | 897.3 | 99.4 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 |
|
||||
| 1 | 0 |
|
||||
| 2 | 100+-5 |
|
||||
| 3 | 900+-5 |
|
||||
| 4 | 1000+-5 |
|
||||
| 5 | 600+-5 |
|
||||
| 6 | 700+-5 |
|
||||
| 7 | 300+-5 |
|
||||
| 8 | 400+-5 |
|
||||
| | 1 |
|
||||
| 1 | 0 |
|
||||
| 2 | 100.1 |
|
||||
| 3 | 897.9 |
|
||||
| 4 | 997.3 |
|
||||
| 5 | 598.4 |
|
||||
| 6 | 698.5 |
|
||||
| 7 | 299.5 |
|
||||
| 8 | 398.9 |
|
||||
|
||||
Scenario: Testbot - Travel distance matrix with ties
|
||||
Given the node map
|
||||
@@ -480,26 +508,26 @@ Feature: Basic Distance Matrix
|
||||
| a | c | ac,ac | 200m | 20s | 20 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | distance |
|
||||
| a | b | ab,ab | 450m |
|
||||
| a | c | ac,ac | 200m |
|
||||
| a | d | ac,dc,dc | 500m +- 1 |
|
||||
| from | to | route | distance |
|
||||
| a | b | ab,ab | 450m |
|
||||
| a | c | ac,ac | 200m |
|
||||
| a | d | ac,dc,dc | 499.9m |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 450+-2 | 200+-2 | 500+-2 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 450.3 | 198.8 | 499 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 450+-2 |
|
||||
| c | 200+-2 |
|
||||
| d | 500+-2 |
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 450.3 |
|
||||
| c | 198.8 |
|
||||
| d | 499 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | c |
|
||||
| a | 0 | 200+-2 |
|
||||
| c | 200+-2 | 0 |
|
||||
| | a | c |
|
||||
| a | 0 | 198.8 |
|
||||
| c | 198.8 | 0 |
|
||||
|
||||
|
||||
# Check rounding errors
|
||||
@@ -515,8 +543,8 @@ Feature: Basic Distance Matrix
|
||||
| abcd |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 1000+-3 | 2000+-3 | 3000+-3 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 1000.7 | 2001.4 | 3002.1 |
|
||||
|
||||
|
||||
Scenario: Testbot - OneToMany vs ManyToOne
|
||||
@@ -560,10 +588,138 @@ Feature: Basic Distance Matrix
|
||||
| fd | |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | c | d | e | f |
|
||||
| a | 0 | 100+-1 | 300+-1 | 650+-1 | 1930+-1 | 1533+-1 |
|
||||
| b | 760+-1 | 0 | 200+-1 | 550+-1 | 1830+-1 | 1433+-1 |
|
||||
| c | 560+-2 | 660+-2 | 0 | 350+-1 | 1630+-1 | 1233+-1 |
|
||||
| d | 1480+-2 | 1580+-1 | 1780+-1 | 0 | 1280+-1 | 883+-1 |
|
||||
| e | 200+-2 | 300+-2 | 500+-1 | 710+-1 | 0 | 1593+-1 |
|
||||
| f | 597+-1 | 696+-1 | 896+-1 | 1108+-1 | 400+-3 | 0 |
|
||||
| | a | b | c | d | e | f |
|
||||
| a | 0 | 100.1 | 300.2 | 650.5 | 1930.6 | 1533 |
|
||||
| b | 759 | 0 | 200.1 | 550.4 | 1830.5 | 1432.9 |
|
||||
| c | 558.8 | 658.9 | 0 | 350.3 | 1630.4 | 1232.8 |
|
||||
| d | 1478.9 | 1579 | 1779.1 | 0 | 1280.1 | 882.5 |
|
||||
| e | 198.8 | 298.9 | 499 | 710.3 | 0 | 1592.8 |
|
||||
| f | 596.4 | 696.5 | 896.6 | 1107.9 | 397.6 | 0 |
|
||||
|
||||
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| fallback_speed | 5 |
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
||||
| b | 300.2 | 0 | 600.5 | 1200.9 |
|
||||
| f | 900.7 | 600.5 | 0 | 300.2 |
|
||||
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 300.2 |
|
||||
| f | 900.7 |
|
||||
| 1 | 1501.1 |
|
||||
|
||||
Scenario: Testbot - Fise input coordinate
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| fallback_speed | 5 |
|
||||
| fallback_coordinate | input |
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
||||
| b | 300.2 | 0 | 600.5 | 1200.9 |
|
||||
| f | 900.7 | 600.5 | 0 | 300.2 |
|
||||
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 300.2 |
|
||||
| f | 900.7 |
|
||||
| 1 | 1501.1 |
|
||||
|
||||
|
||||
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| fallback_speed | 5 |
|
||||
| fallback_coordinate | snapped |
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 300.2 | 900.7 | 1200.9 |
|
||||
| b | 300.2 | 0 | 600.5 | 900.7 |
|
||||
| f | 900.7 | 600.5 | 0 | 300.2 |
|
||||
| 1 | 1200.9 | 900.7 | 300.2 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 300.2 | 900.7 | 1200.9 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 300.2 |
|
||||
| f | 900.7 |
|
||||
| 1 | 1200.9 |
|
||||
|
||||
Scenario: Ensure consistency with route, and make sure offsets work in both directions
|
||||
Given a grid size of 100 meters
|
||||
Given the node map
|
||||
"""
|
||||
a b c d e f g h i j
|
||||
1 2
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abcdef |
|
||||
| fghij |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | distance |
|
||||
| 1 | 2 | abcdef,fghij,fghij | 999.9m |
|
||||
|
||||
# TODO: this is "correct", but inconsistent with viaroute
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 | 2 |
|
||||
| 1 | 0 | 1000.7 |
|
||||
| 2 | 1000.7 | 0 |
|
||||
@@ -21,6 +21,21 @@ Feature: Basic Duration Matrix
|
||||
| a | 0 | 10 |
|
||||
| b | 10 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix of minimal network requested with flatbuffer format
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I request a travel time matrix with flatbuffers I should get
|
||||
| | a | b |
|
||||
| a | 0 | 10 |
|
||||
| b | 10 | 0 |
|
||||
|
||||
@ch
|
||||
Scenario: Testbot - Travel time matrix of minimal network with toll exclude
|
||||
Given the query options
|
||||
@@ -510,3 +525,268 @@ Feature: Basic Duration Matrix
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 24.1 |
|
||||
|
||||
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| fallback_speed | 5 |
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 30 | 18 | 30 |
|
||||
| b | 30 | 0 | 12 | 24 |
|
||||
| f | 18 | 12 | 0 | 30 |
|
||||
| 1 | 30 | 24 | 30 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 30 | 18 | 30 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 30 |
|
||||
| f | 18 |
|
||||
| 1 | 30 |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
| b | | | Y | Y |
|
||||
| f | Y | Y | | |
|
||||
| 1 | Y | Y | | |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a |
|
||||
| a | |
|
||||
| b | |
|
||||
| f | Y |
|
||||
| 1 | Y |
|
||||
|
||||
Scenario: Testbot - Filling in noroutes with estimates - use input coordinate
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| fallback_speed | 5 |
|
||||
| fallback_coordinate | input |
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 30 | 18 | 30 |
|
||||
| b | 30 | 0 | 12 | 24 |
|
||||
| f | 18 | 12 | 0 | 30 |
|
||||
| 1 | 30 | 24 | 30 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 30 | 18 | 30 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 30 |
|
||||
| f | 18 |
|
||||
| 1 | 30 |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
| b | | | Y | Y |
|
||||
| f | Y | Y | | |
|
||||
| 1 | Y | Y | | |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a |
|
||||
| a | |
|
||||
| b | |
|
||||
| f | Y |
|
||||
| 1 | Y |
|
||||
|
||||
|
||||
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| fallback_speed | 5 |
|
||||
| fallback_coordinate | snapped |
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 30 | 18 | 24 |
|
||||
| b | 30 | 0 | 12 | 18 |
|
||||
| f | 18 | 12 | 0 | 30 |
|
||||
| 1 | 24 | 18 | 30 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 30 | 18 | 24 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 30 |
|
||||
| f | 18 |
|
||||
| 1 | 24 |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
| b | | | Y | Y |
|
||||
| f | Y | Y | | |
|
||||
| 1 | Y | Y | | |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a |
|
||||
| a | |
|
||||
| b | |
|
||||
| f | Y |
|
||||
| 1 | Y |
|
||||
|
||||
Scenario: Testbot - Travel time matrix of minimal network with scale factor
|
||||
Given the query options
|
||||
| scale_factor | 2 |
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 20 |
|
||||
| b | 20 | 0 |
|
||||
Scenario: Testbot - Test fallback speeds and scale factor
|
||||
Given a grid size of 300 meters
|
||||
Given the extract extra arguments "--small-component-size 4"
|
||||
Given the query options
|
||||
| scale_factor | 2 |
|
||||
| fallback_speed | 5 |
|
||||
| fallback_coordinate | snapped |
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
a b f h 1
|
||||
d e g i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abeda |
|
||||
| fhigf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 60 | 36 | 48 |
|
||||
| b | 60 | 0 | 24 | 36 |
|
||||
| f | 36 | 24 | 0 | 60 |
|
||||
| 1 | 48 | 36 | 60 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | f | 1 |
|
||||
| a | 0 | 60 | 36 | 48 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| b | 60 |
|
||||
| f | 36 |
|
||||
| 1 | 48 |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
| b | | | Y | Y |
|
||||
| f | Y | Y | | |
|
||||
| 1 | Y | Y | | |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a | b | f | 1 |
|
||||
| a | | | Y | Y |
|
||||
|
||||
When I request a travel time matrix I should get estimates for
|
||||
| | a |
|
||||
| a | |
|
||||
| b | |
|
||||
| f | Y |
|
||||
| 1 | Y |
|
||||
|
||||
|
||||
Scenario: Testbot - Travel time matrix of minimal network with overflow scale factor
|
||||
Given the query options
|
||||
| scale_factor | 2147483647 |
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 214748364.6 |
|
||||
| b | 214748364.6 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix of minimal network with fraction scale factor
|
||||
Given the query options
|
||||
| scale_factor | 0.5 |
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 5 |
|
||||
| b | 5 | 0 |
|
||||
|
||||
@@ -792,4 +792,4 @@ Feature: Basic Map Matching
|
||||
When I match I should get
|
||||
| trace | geometry | a:distance | a:duration | a:weight | duration |
|
||||
| 2345 | 1.00018,1,1.000315,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
|
||||
| 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
|
||||
| 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
|
||||
@@ -38,15 +38,15 @@ Feature: Multi level routing
|
||||
Scenario: Testbot - Multi level routing
|
||||
Given the node map
|
||||
"""
|
||||
a───b e───f
|
||||
│ │ │ │
|
||||
a────b e─────f
|
||||
\ │ │ /
|
||||
d───c h───g
|
||||
╲ ╱
|
||||
╳
|
||||
╱ ╲
|
||||
i───j m───n
|
||||
│ │ │ │
|
||||
l───k───p───o
|
||||
/ │ │ \
|
||||
l─────k───p─────o
|
||||
"""
|
||||
|
||||
And the nodes
|
||||
@@ -67,78 +67,76 @@ Feature: Multi level routing
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | abcda,abcda | 20s |
|
||||
| a | f | abcda,cm,mnopm,kp,ijkli,hj,efghe,efghe | 229.4s |
|
||||
| a | l | abcda,cm,mnopm,kp,ijkli,ijkli | 144.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 |
|
||||
| a | b | abcda,abcda | 25s |
|
||||
| a | f | abcda,cm,mnopm,kp,ijkli,hj,efghe,efghe | 239.2s |
|
||||
| a | l | abcda,cm,mnopm,kp,ijkli,ijkli | 157.1s |
|
||||
| a | o | abcda,cm,mnopm,mnopm,mnopm | 137.1s |
|
||||
| f | l | efghe,hj,ijkli,ijkli | 136.7s |
|
||||
| f | o | efghe,hj,ijkli,kp,mnopm,mnopm | 162.1s |
|
||||
| l | o | ijkli,kp,mnopm,mnopm | 80s |
|
||||
| c | m | cm,cm | 44.7s |
|
||||
| f | a | efghe,hj,ijkli,kp,mnopm,cm,abcda,abcda | 239.2s |
|
||||
| l | a | ijkli,kp,mnopm,cm,abcda,abcda | 157.1s |
|
||||
|
||||
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 |
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 239.2 | 157.1 | 137.1 |
|
||||
| f | 239.2 | 0 | 136.7 | 162.1 |
|
||||
| l | 157.1 | 136.7 | 0 | 80 |
|
||||
| o | 137.1 | 162.1 | 80 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 229.4 | 144.7 | 124.7 |
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 239.2 | 157.1 | 137.1 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| f | 229.4 |
|
||||
| l | 144.7 |
|
||||
| o | 124.7 |
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| f | 239.2 |
|
||||
| l | 157.1 |
|
||||
| o | 137.1 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 229.4 | 144.7 | 124.7 |
|
||||
| o | 124.7 | 144.7 | 60 | 0 |
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 239.2 | 157.1 | 137.1 |
|
||||
| o | 137.1 | 162.1 | 80 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | o |
|
||||
| a | 0 | 124.7 |
|
||||
| f | 229.4 | 144.7 |
|
||||
| l | 144.7 | 60 |
|
||||
| o | 124.7 | 0 |
|
||||
|
||||
| a | 0 | 137.1 |
|
||||
| f | 239.2 | 162.1 |
|
||||
| l | 157.1 | 80 |
|
||||
| o | 137.1 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | f | l | o |
|
||||
| a | 0+-2 | 2287+-2 | 1443+-2 | 1243+-2 |
|
||||
| f | 2284+-2 | 0+-2 | 1241+-2 | 1443+-2 |
|
||||
| l | 1443+-2 | 1244+-2 | 0+-2 | 600+-2 |
|
||||
| o | 1243+-2 | 1444+-2 | 600+-2 | 0+-2 |
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
|
||||
| f | 2383.7 | 0 | 1293.3 | 1617.3 |
|
||||
| l | 1566.9 | 1293.3 | 0 | 800.5 |
|
||||
| o | 1366.8 | 1617.3 | 800.5 | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 2287.2+-2 | 1443+-2 | 1243+-2 |
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| f | 2284.5+-2 |
|
||||
| l | 1443.1 |
|
||||
| o | 1243 |
|
||||
| | a |
|
||||
| a | 0 |
|
||||
| f | 2383.7 |
|
||||
| l | 1566.9 |
|
||||
| o | 1366.8 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 2287+-2 | 1443+-2 | 1243+-2 |
|
||||
| o | 1243 | 1444+-2 | 600+-2 | 0+-2 |
|
||||
|
||||
| | a | f | l | o |
|
||||
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
|
||||
| f | 2383.7 | 0 | 1293.3 | 1617.3 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | a | o |
|
||||
| a | 0+-2 | 1243+-2 |
|
||||
| f | 2284+-2 | 1443+-2 |
|
||||
| l | 1443+-2 | 600+-2 |
|
||||
| o | 1243+-2 | 0+-2 |
|
||||
|
||||
|
||||
| | a | o |
|
||||
| a | 0 | 1366.8 |
|
||||
| f | 2383.7 | 1617.3 |
|
||||
| l | 1566.9 | 800.5 |
|
||||
| o | 1366.8 | 0 |
|
||||
|
||||
Scenario: Testbot - Multi level routing: horizontal road
|
||||
Given the node map
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
@routing @testbot @nil
|
||||
Feature: Testbot - Check assigning nil values
|
||||
Scenario: Assign nil values to all way strings
|
||||
Feature: Testbot - Check assigning empty values
|
||||
Scenario: Assign empty values to all way strings
|
||||
Given the profile file
|
||||
"""
|
||||
functions = require('testbot')
|
||||
|
||||
function way_function(profile, way, result)
|
||||
result.name = nil
|
||||
result.ref = nil
|
||||
result.destinations = nil
|
||||
result.exits = nil
|
||||
result.pronunciation = nil
|
||||
result.turn_lanes_forward = nil
|
||||
result.turn_lanes_backward = nil
|
||||
result.name = ""
|
||||
result.ref = ""
|
||||
result.destinations = ""
|
||||
result.exits = ""
|
||||
result.pronunciation = ""
|
||||
result.turn_lanes_forward = ""
|
||||
result.turn_lanes_backward = ""
|
||||
|
||||
result.forward_speed = 10
|
||||
result.backward_speed = 10
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
@routing @testbot @oneway
|
||||
Feature: Handle multiple phantom nodes in one-way segment
|
||||
|
||||
# Check we handle routes where source and destination are
|
||||
# phantom nodes on the same one-way segment.
|
||||
# See: https://github.com/Project-OSRM/osrm-backend/issues/5788
|
||||
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
|
||||
Scenario: One-way segment with adjacent phantom nodes
|
||||
Given the node map
|
||||
"""
|
||||
d c
|
||||
|
||||
a12b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | no |
|
||||
| cd | no |
|
||||
| da | no |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time | distance |
|
||||
| 1 | 2 | ab,ab | 5s +-0.1 | 50m ~1% |
|
||||
| 1 | c | ab,bc,bc | 30s +-0.1 | 300m ~1% |
|
||||
| 2 | 1 | ab,bc,cd,da,ab | 65s +-0.1 | 650m ~1% |
|
||||
| 2 | c | ab,bc,bc | 25s +-0.1 | 250m ~1% |
|
||||
| c | 1 | cd,da,ab | 40s +-0.1 | 400m ~1% |
|
||||
| c | 2 | cd,da,ab | 45s +-0.1 | 450m ~1% |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 1 | 2 | c |
|
||||
| 1 | 0 | 5 +-0.1 | 30 +-0.1 |
|
||||
| 2 | 65 +-0.1 | 0 | 25 +-0.1 |
|
||||
| c | 40 +-0.1 | 45 +-0.1 | 0 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 1 | 2 | c |
|
||||
| 1 | 0 | 5 +-0.1 | 30 +-0.1 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 1 | 2 | c |
|
||||
| 2 | 65 +-0.1 | 0 | 25 +-0.1 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 1 |
|
||||
| 1 | 0 |
|
||||
| 2 | 65 +-0.1 |
|
||||
| c | 40 +-0.1 |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 2 |
|
||||
| 1 | 5 +-0.1 |
|
||||
| 2 | 0 |
|
||||
| c | 45 +-0.1 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 | 2 | c |
|
||||
| 1 | 0 | 50 ~1% | 300 ~1% |
|
||||
| 2 | 650 ~1% | 0 | 250 ~1% |
|
||||
| c | 400 ~1% | 450 ~1% | 0 |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 | 2 | c |
|
||||
| 1 | 0 | 50 ~1% | 300 ~1% |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 | 2 | c |
|
||||
| 2 | 650 ~1% | 0 | 250 ~1% |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 1 |
|
||||
| 1 | 0 |
|
||||
| 2 | 650 ~1% |
|
||||
| c | 400 ~1% |
|
||||
|
||||
When I request a travel distance matrix I should get
|
||||
| | 2 |
|
||||
| 1 | 50 ~1% |
|
||||
| 2 | 0 |
|
||||
| c | 450 ~1% |
|
||||
@@ -182,4 +182,4 @@ Feature: Snap start/end point to the nearest way
|
||||
| x | m | xe,xe |
|
||||
| x | n | xf,xf |
|
||||
| x | o | xg,xg |
|
||||
| x | p | xh,xh |
|
||||
| x | p | xh,xh |
|
||||
@@ -18,6 +18,53 @@ Feature: Via points
|
||||
| waypoints | route |
|
||||
| a,b,c | abc,abc,abc,abc |
|
||||
|
||||
Scenario: Simple via point with waypoints collapsing
|
||||
Given the node map
|
||||
"""
|
||||
a
|
||||
|
||||
b 1c d
|
||||
2
|
||||
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ace |
|
||||
| bcd |
|
||||
|
||||
Given the query options
|
||||
| waypoints | 0;2 |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| b,1,e | bcd,ace,ace | depart,turn right,arrive |
|
||||
| b,2,e | bcd,ace,ace | depart,turn right,arrive |
|
||||
|
||||
Scenario: Simple via point with waypoints collapsing
|
||||
Given the node map
|
||||
"""
|
||||
a 2 b
|
||||
|
||||
c d
|
||||
1 3
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bd |
|
||||
| cd |
|
||||
| ac |
|
||||
|
||||
Given the query options
|
||||
| waypoints | 0;2 |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| 1,2,3 | cd,ac,ab,bd,cd | depart,new name right,new name right,new name right,arrive |
|
||||
|
||||
Scenario: Simple via point with core factor
|
||||
Given the contract extra arguments "--core 0.8"
|
||||
Given the node map
|
||||
|
||||
@@ -93,6 +93,31 @@ Feature: Check zero speed updates
|
||||
| 1 | 2 | NoRoute |
|
||||
|
||||
|
||||
Scenario: Routing with alternatives 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
|
||||
"""
|
||||
1,2,0
|
||||
2,1,0
|
||||
"""
|
||||
And the query options
|
||||
| alternatives | true |
|
||||
|
||||
|
||||
When I route I should get
|
||||
| from | to | code | alternative |
|
||||
| 1 | 2 | NoRoute | |
|
||||
|
||||
|
||||
Scenario: Routing on restricted oneway
|
||||
Given the node map
|
||||
"""
|
||||
|
||||
@@ -94,7 +94,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
||||
return GraphAndFilter{QueryGraph{num_nodes, std::move(edge_container.edges)},
|
||||
edge_container.MakeEdgeFilters()};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -164,7 +164,7 @@ struct ContractedEdgeContainer
|
||||
std::vector<MergedFlags> flags;
|
||||
std::vector<QueryEdge> edges;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,11 +15,11 @@ template <storage::Ownership Ownership> struct ContractedMetric
|
||||
detail::QueryGraph<Ownership> graph;
|
||||
std::vector<util::ViewOrVector<bool, Ownership>> edge_filter;
|
||||
};
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
using ContractedMetric = detail::ContractedMetric<storage::Ownership::Container>;
|
||||
using ContractedMetricView = detail::ContractedMetric<storage::Ownership::View>;
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@ class Contractor
|
||||
private:
|
||||
ContractorConfig config;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif // PROCESSING_CHAIN_HPP
|
||||
|
||||
@@ -73,7 +73,7 @@ struct ContractorConfig final : storage::IOConfig
|
||||
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
|
||||
double core_factor;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif // EXTRACTOR_OPTIONS_HPP
|
||||
|
||||
@@ -12,23 +12,26 @@ namespace contractor
|
||||
struct ContractorEdgeData
|
||||
{
|
||||
ContractorEdgeData()
|
||||
: weight(0), duration(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0)
|
||||
: weight(0), duration(0), distance(0), id(0), originalEdges(0), shortcut(0), forward(0),
|
||||
backward(0)
|
||||
{
|
||||
}
|
||||
ContractorEdgeData(EdgeWeight weight,
|
||||
EdgeWeight duration,
|
||||
EdgeDistance distance,
|
||||
unsigned original_edges,
|
||||
unsigned id,
|
||||
bool shortcut,
|
||||
bool forward,
|
||||
bool backward)
|
||||
: weight(weight), duration(duration), id(id),
|
||||
: weight(weight), duration(duration), distance(distance), id(id),
|
||||
originalEdges(std::min((1u << 29) - 1u, original_edges)), shortcut(shortcut),
|
||||
forward(forward), backward(backward)
|
||||
{
|
||||
}
|
||||
EdgeWeight weight;
|
||||
EdgeWeight duration;
|
||||
EdgeDistance distance;
|
||||
unsigned id;
|
||||
unsigned originalEdges : 29;
|
||||
bool shortcut : 1;
|
||||
|
||||
@@ -125,7 +125,7 @@ struct RangebasedCRC32
|
||||
private:
|
||||
IteratorbasedCRC32 crc32;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif /* ITERATOR_BASED_CRC32_H */
|
||||
|
||||
@@ -52,8 +52,8 @@ inline void writeGraph(const boost::filesystem::path &path,
|
||||
serialization::write(writer, "/ch/metrics/" + pair.first, pair.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace files
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,6 +41,7 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
||||
input_edge.target,
|
||||
std::max(input_edge.data.weight, 1),
|
||||
input_edge.data.duration,
|
||||
input_edge.data.distance,
|
||||
1,
|
||||
input_edge.data.turn_id,
|
||||
false,
|
||||
@@ -51,6 +52,7 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
||||
input_edge.source,
|
||||
std::max(input_edge.data.weight, 1),
|
||||
input_edge.data.duration,
|
||||
input_edge.data.distance,
|
||||
1,
|
||||
input_edge.data.turn_id,
|
||||
false,
|
||||
@@ -82,6 +84,7 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
||||
forward_edge.data.originalEdges = reverse_edge.data.originalEdges = 1;
|
||||
forward_edge.data.weight = reverse_edge.data.weight = INVALID_EDGE_WEIGHT;
|
||||
forward_edge.data.duration = reverse_edge.data.duration = MAXIMAL_EDGE_DURATION;
|
||||
forward_edge.data.distance = reverse_edge.data.distance = MAXIMAL_EDGE_DISTANCE;
|
||||
// remove parallel edges
|
||||
while (i < edges.size() && edges[i].source == source && edges[i].target == target)
|
||||
{
|
||||
@@ -90,12 +93,16 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
||||
forward_edge.data.weight = std::min(edges[i].data.weight, forward_edge.data.weight);
|
||||
forward_edge.data.duration =
|
||||
std::min(edges[i].data.duration, forward_edge.data.duration);
|
||||
forward_edge.data.distance =
|
||||
std::min(edges[i].data.distance, forward_edge.data.distance);
|
||||
}
|
||||
if (edges[i].data.backward)
|
||||
{
|
||||
reverse_edge.data.weight = std::min(edges[i].data.weight, reverse_edge.data.weight);
|
||||
reverse_edge.data.duration =
|
||||
std::min(edges[i].data.duration, reverse_edge.data.duration);
|
||||
reverse_edge.data.distance =
|
||||
std::min(edges[i].data.distance, reverse_edge.data.distance);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
@@ -151,6 +158,7 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
|
||||
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
|
||||
new_edge.data.weight = data.weight;
|
||||
new_edge.data.duration = data.duration;
|
||||
new_edge.data.distance = data.distance;
|
||||
new_edge.data.shortcut = data.shortcut;
|
||||
new_edge.data.turn_id = data.id;
|
||||
BOOST_ASSERT_MSG(new_edge.data.turn_id != INT_MAX, // 2^31
|
||||
|
||||
@@ -17,7 +17,8 @@ struct QueryEdge
|
||||
struct EdgeData
|
||||
{
|
||||
explicit EdgeData()
|
||||
: turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false)
|
||||
: turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false),
|
||||
distance(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -25,10 +26,11 @@ struct QueryEdge
|
||||
const bool shortcut,
|
||||
const EdgeWeight weight,
|
||||
const EdgeWeight duration,
|
||||
const EdgeDistance distance,
|
||||
const bool forward,
|
||||
const bool backward)
|
||||
: turn_id(turn_id), shortcut(shortcut), weight(weight), duration(duration),
|
||||
forward(forward), backward(backward)
|
||||
forward(forward), backward(backward), distance(distance)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,6 +42,7 @@ struct QueryEdge
|
||||
turn_id = other.id;
|
||||
forward = other.forward;
|
||||
backward = other.backward;
|
||||
distance = other.distance;
|
||||
}
|
||||
// this ID is either the middle node of the shortcut, or the ID of the edge based node (node
|
||||
// based edge) storing the appropriate data. If `shortcut` is set to true, we get the middle
|
||||
@@ -50,6 +53,7 @@ struct QueryEdge
|
||||
EdgeWeight duration : 30;
|
||||
std::uint32_t forward : 1;
|
||||
std::uint32_t backward : 1;
|
||||
EdgeDistance distance;
|
||||
} data;
|
||||
|
||||
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
||||
@@ -69,10 +73,11 @@ struct QueryEdge
|
||||
return (source == right.source && target == right.target &&
|
||||
data.weight == right.data.weight && data.duration == right.data.duration &&
|
||||
data.shortcut == right.data.shortcut && data.forward == right.data.forward &&
|
||||
data.backward == right.data.backward && data.turn_id == right.data.turn_id);
|
||||
data.backward == right.data.backward && data.turn_id == right.data.turn_id &&
|
||||
data.distance == right.data.distance);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif // QUERYEDGE_HPP
|
||||
|
||||
@@ -19,7 +19,7 @@ using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>;
|
||||
|
||||
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
|
||||
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
|
||||
}
|
||||
}
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif // QUERYEDGE_HPP
|
||||
|
||||
@@ -46,8 +46,8 @@ void read(storage::tar::FileReader &reader,
|
||||
metric.edge_filter[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace serialization
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@ class CellCustomizer
|
||||
{
|
||||
bool from_clique;
|
||||
EdgeDuration duration;
|
||||
EdgeDistance distance;
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -60,7 +61,7 @@ class CellCustomizer
|
||||
}
|
||||
}
|
||||
heap.Clear();
|
||||
heap.Insert(source, 0, {false, 0});
|
||||
heap.Insert(source, 0, {false, 0, 0});
|
||||
|
||||
// explore search space
|
||||
while (!heap.Empty() && !destinations_set.empty())
|
||||
@@ -68,8 +69,18 @@ class CellCustomizer
|
||||
const NodeID node = heap.DeleteMin();
|
||||
const EdgeWeight weight = heap.GetKey(node);
|
||||
const EdgeDuration duration = heap.GetData(node).duration;
|
||||
const EdgeDistance distance = heap.GetData(node).distance;
|
||||
|
||||
RelaxNode(graph, cells, allowed_nodes, metric, heap, level, node, weight, duration);
|
||||
RelaxNode(graph,
|
||||
cells,
|
||||
allowed_nodes,
|
||||
metric,
|
||||
heap,
|
||||
level,
|
||||
node,
|
||||
weight,
|
||||
duration,
|
||||
distance);
|
||||
|
||||
destinations_set.erase(node);
|
||||
}
|
||||
@@ -77,21 +88,27 @@ class CellCustomizer
|
||||
// fill a map of destination nodes to placeholder pointers
|
||||
auto weights = cell.GetOutWeight(source);
|
||||
auto durations = cell.GetOutDuration(source);
|
||||
auto distances = cell.GetOutDistance(source);
|
||||
for (auto &destination : destinations)
|
||||
{
|
||||
BOOST_ASSERT(!weights.empty());
|
||||
BOOST_ASSERT(!durations.empty());
|
||||
BOOST_ASSERT(!distances.empty());
|
||||
|
||||
const bool inserted = heap.WasInserted(destination);
|
||||
weights.front() = inserted ? heap.GetKey(destination) : INVALID_EDGE_WEIGHT;
|
||||
durations.front() =
|
||||
inserted ? heap.GetData(destination).duration : MAXIMAL_EDGE_DURATION;
|
||||
distances.front() =
|
||||
inserted ? heap.GetData(destination).distance : INVALID_EDGE_DISTANCE;
|
||||
|
||||
weights.advance_begin(1);
|
||||
durations.advance_begin(1);
|
||||
distances.advance_begin(1);
|
||||
}
|
||||
BOOST_ASSERT(weights.empty());
|
||||
BOOST_ASSERT(durations.empty());
|
||||
BOOST_ASSERT(distances.empty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +145,8 @@ class CellCustomizer
|
||||
LevelID level,
|
||||
NodeID node,
|
||||
EdgeWeight weight,
|
||||
EdgeDuration duration) const
|
||||
EdgeDuration duration,
|
||||
EdgeDistance distance) const
|
||||
{
|
||||
auto first_level = level == 1;
|
||||
BOOST_ASSERT(heap.WasInserted(node));
|
||||
@@ -149,6 +167,7 @@ class CellCustomizer
|
||||
auto subcell = cells.GetCell(metric, level - 1, subcell_id);
|
||||
auto subcell_destination = subcell.GetDestinationNodes().begin();
|
||||
auto subcell_duration = subcell.GetOutDuration(node).begin();
|
||||
auto subcell_distance = subcell.GetOutDistance(node).begin();
|
||||
for (auto subcell_weight : subcell.GetOutWeight(node))
|
||||
{
|
||||
if (subcell_weight != INVALID_EDGE_WEIGHT)
|
||||
@@ -161,20 +180,24 @@ class CellCustomizer
|
||||
|
||||
const EdgeWeight to_weight = weight + subcell_weight;
|
||||
const EdgeDuration to_duration = duration + *subcell_duration;
|
||||
const EdgeDistance to_distance = distance + *subcell_distance;
|
||||
if (!heap.WasInserted(to))
|
||||
{
|
||||
heap.Insert(to, to_weight, {true, to_duration});
|
||||
heap.Insert(to, to_weight, {true, to_duration, to_distance});
|
||||
}
|
||||
else if (std::tie(to_weight, to_duration) <
|
||||
std::tie(heap.GetKey(to), heap.GetData(to).duration))
|
||||
else if (std::tie(to_weight, to_duration, to_distance) <
|
||||
std::tie(heap.GetKey(to),
|
||||
heap.GetData(to).duration,
|
||||
heap.GetData(to).distance))
|
||||
{
|
||||
heap.DecreaseKey(to, to_weight);
|
||||
heap.GetData(to) = {true, to_duration};
|
||||
heap.GetData(to) = {true, to_duration, to_distance};
|
||||
}
|
||||
}
|
||||
|
||||
++subcell_destination;
|
||||
++subcell_duration;
|
||||
++subcell_distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,21 +212,23 @@ class CellCustomizer
|
||||
}
|
||||
|
||||
const auto &data = graph.GetEdgeData(edge);
|
||||
if (data.forward &&
|
||||
(first_level ||
|
||||
partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to)))
|
||||
if (data.forward && (first_level || partition.GetCell(level - 1, node) !=
|
||||
partition.GetCell(level - 1, to)))
|
||||
{
|
||||
const EdgeWeight to_weight = weight + data.weight;
|
||||
const EdgeDuration to_duration = duration + data.duration;
|
||||
const EdgeDistance to_distance = distance + data.distance;
|
||||
if (!heap.WasInserted(to))
|
||||
{
|
||||
heap.Insert(to, to_weight, {false, duration + data.duration});
|
||||
heap.Insert(
|
||||
to, to_weight, {false, duration + data.duration, distance + data.distance});
|
||||
}
|
||||
else if (std::tie(to_weight, to_duration) <
|
||||
std::tie(heap.GetKey(to), heap.GetData(to).duration))
|
||||
else if (std::tie(to_weight, to_duration, to_distance) <
|
||||
std::tie(
|
||||
heap.GetKey(to), heap.GetData(to).duration, heap.GetData(to).distance))
|
||||
{
|
||||
heap.DecreaseKey(to, to_weight);
|
||||
heap.GetData(to) = {false, to_duration};
|
||||
heap.GetData(to) = {false, to_duration, to_distance};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,7 +236,7 @@ class CellCustomizer
|
||||
|
||||
const partitioner::MultiLevelPartition &partition;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace customizer
|
||||
} // namespace osrm
|
||||
|
||||
#endif // OSRM_CELLS_CUSTOMIZER_HPP
|
||||
|
||||
@@ -20,12 +20,13 @@ template <storage::Ownership Ownership> struct CellMetricImpl
|
||||
|
||||
Vector<EdgeWeight> weights;
|
||||
Vector<EdgeDuration> durations;
|
||||
Vector<EdgeDistance> distances;
|
||||
};
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
using CellMetric = detail::CellMetricImpl<storage::Ownership::Container>;
|
||||
using CellMetricView = detail::CellMetricImpl<storage::Ownership::View>;
|
||||
}
|
||||
}
|
||||
} // namespace customizer
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@ struct CustomizationConfig final : storage::IOConfig
|
||||
|
||||
updater::UpdaterConfig updater_config;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace customizer
|
||||
} // namespace osrm
|
||||
|
||||
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
||||
|
||||
@@ -34,7 +34,7 @@ template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
void write(storage::tar::FileWriter &writer,
|
||||
const std::string &name,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
}
|
||||
} // namespace serialization
|
||||
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership>
|
||||
@@ -58,8 +58,10 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
|
||||
|
||||
MultiLevelGraph(PartitionerGraphT &&graph,
|
||||
Vector<EdgeWeight> node_weights_,
|
||||
Vector<EdgeDuration> node_durations_)
|
||||
: node_weights(std::move(node_weights_)), node_durations(std::move(node_durations_))
|
||||
Vector<EdgeDuration> node_durations_,
|
||||
Vector<EdgeDistance> node_distances_)
|
||||
: node_weights(std::move(node_weights_)), node_durations(std::move(node_durations_)),
|
||||
node_distances(std::move(node_distances_))
|
||||
{
|
||||
util::ViewOrVector<PartitionerGraphT::EdgeArrayEntry, storage::Ownership::Container>
|
||||
original_edge_array;
|
||||
@@ -83,11 +85,13 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
|
||||
Vector<EdgeOffset> node_to_edge_offset_,
|
||||
Vector<EdgeWeight> node_weights_,
|
||||
Vector<EdgeDuration> node_durations_,
|
||||
Vector<EdgeDistance> node_distances_,
|
||||
Vector<bool> is_forward_edge_,
|
||||
Vector<bool> is_backward_edge_)
|
||||
: SuperT(std::move(node_array_), std::move(edge_array_), std::move(node_to_edge_offset_)),
|
||||
node_weights(std::move(node_weights_)), node_durations(std::move(node_durations_)),
|
||||
is_forward_edge(is_forward_edge_), is_backward_edge(is_backward_edge_)
|
||||
node_distances(std::move(node_distances_)), is_forward_edge(is_forward_edge_),
|
||||
is_backward_edge(is_backward_edge_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -95,6 +99,8 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
|
||||
|
||||
EdgeWeight GetNodeDuration(NodeID node) const { return node_durations[node]; }
|
||||
|
||||
EdgeDistance GetNodeDistance(NodeID node) const { return node_distances[node]; }
|
||||
|
||||
bool IsForwardEdge(EdgeID edge) const { return is_forward_edge[edge]; }
|
||||
|
||||
bool IsBackwardEdge(EdgeID edge) const { return is_backward_edge[edge]; }
|
||||
@@ -111,6 +117,7 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
|
||||
protected:
|
||||
Vector<EdgeWeight> node_weights;
|
||||
Vector<EdgeDuration> node_durations;
|
||||
Vector<EdgeDistance> node_distances;
|
||||
Vector<bool> is_forward_edge;
|
||||
Vector<bool> is_backward_edge;
|
||||
};
|
||||
@@ -119,7 +126,7 @@ using MultiLevelEdgeBasedGraph =
|
||||
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
|
||||
using MultiLevelEdgeBasedGraphView =
|
||||
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>;
|
||||
}
|
||||
}
|
||||
} // namespace customizer
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -106,8 +106,8 @@ inline void writeGraph(const boost::filesystem::path &path,
|
||||
writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum);
|
||||
serialization::write(writer, "/mld/multilevelgraph", graph);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace files
|
||||
} // namespace customizer
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@ inline void read(storage::tar::FileReader &reader,
|
||||
{
|
||||
storage::serialization::read(reader, name + "/weights", metric.weights);
|
||||
storage::serialization::read(reader, name + "/durations", metric.durations);
|
||||
storage::serialization::read(reader, name + "/distances", metric.distances);
|
||||
}
|
||||
|
||||
template <storage::Ownership Ownership>
|
||||
@@ -32,6 +33,7 @@ inline void write(storage::tar::FileWriter &writer,
|
||||
{
|
||||
storage::serialization::write(writer, name + "/weights", metric.weights);
|
||||
storage::serialization::write(writer, name + "/durations", metric.durations);
|
||||
storage::serialization::write(writer, name + "/distances", metric.distances);
|
||||
}
|
||||
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
@@ -42,6 +44,7 @@ inline void read(storage::tar::FileReader &reader,
|
||||
storage::serialization::read(reader, name + "/node_array", graph.node_array);
|
||||
storage::serialization::read(reader, name + "/node_weights", graph.node_weights);
|
||||
storage::serialization::read(reader, name + "/node_durations", graph.node_durations);
|
||||
storage::serialization::read(reader, name + "/node_distances", graph.node_distances);
|
||||
storage::serialization::read(reader, name + "/edge_array", graph.edge_array);
|
||||
storage::serialization::read(reader, name + "/is_forward_edge", graph.is_forward_edge);
|
||||
storage::serialization::read(reader, name + "/is_backward_edge", graph.is_backward_edge);
|
||||
@@ -56,13 +59,14 @@ inline void write(storage::tar::FileWriter &writer,
|
||||
storage::serialization::write(writer, name + "/node_array", graph.node_array);
|
||||
storage::serialization::write(writer, name + "/node_weights", graph.node_weights);
|
||||
storage::serialization::write(writer, name + "/node_durations", graph.node_durations);
|
||||
storage::serialization::write(writer, name + "/node_distances", graph.node_distances);
|
||||
storage::serialization::write(writer, name + "/edge_array", graph.edge_array);
|
||||
storage::serialization::write(writer, name + "/is_forward_edge", graph.is_forward_edge);
|
||||
storage::serialization::write(writer, name + "/is_backward_edge", graph.is_backward_edge);
|
||||
storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace serialization
|
||||
} // namespace customizer
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace ch
|
||||
struct Algorithm final
|
||||
{
|
||||
};
|
||||
}
|
||||
} // namespace ch
|
||||
// Multi-Level Dijkstra
|
||||
namespace mld
|
||||
{
|
||||
struct Algorithm final
|
||||
{
|
||||
};
|
||||
}
|
||||
} // namespace mld
|
||||
|
||||
// Algorithm names
|
||||
template <typename AlgorithmT> const char *name();
|
||||
@@ -111,8 +111,8 @@ template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type
|
||||
template <> struct HasExcludeFlags<mld::Algorithm> final : std::true_type
|
||||
{
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
#define ENGINE_API_BASE_API_HPP
|
||||
|
||||
#include "engine/api/base_parameters.hpp"
|
||||
#include "engine/api/flatbuffers/fbresult_generated.h"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
|
||||
#include "engine/api/json_factory.hpp"
|
||||
#include "engine/hint.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/algorithm/transform.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm
|
||||
@@ -53,6 +56,8 @@ class BaseAPI
|
||||
// TODO: check forward/reverse
|
||||
return json::makeWaypoint(
|
||||
phantom.location,
|
||||
util::coordinate_calculation::fccApproximateDistance(phantom.location,
|
||||
phantom.input_location),
|
||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string(),
|
||||
Hint{phantom, facade.GetCheckSum()});
|
||||
}
|
||||
@@ -61,17 +66,70 @@ class BaseAPI
|
||||
// TODO: check forward/reverse
|
||||
return json::makeWaypoint(
|
||||
phantom.location,
|
||||
util::coordinate_calculation::fccApproximateDistance(phantom.location,
|
||||
phantom.input_location),
|
||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
||||
.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
MakeWaypoints(flatbuffers::FlatBufferBuilder *builder,
|
||||
const std::vector<PhantomNodes> &segment_end_coordinates) const
|
||||
{
|
||||
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
||||
BOOST_ASSERT(parameters.coordinates.size() == segment_end_coordinates.size() + 1);
|
||||
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.resize(parameters.coordinates.size());
|
||||
waypoints[0] =
|
||||
MakeWaypoint(builder, segment_end_coordinates.front().source_phantom)->Finish();
|
||||
|
||||
std::transform(segment_end_coordinates.begin(),
|
||||
segment_end_coordinates.end(),
|
||||
std::next(waypoints.begin()),
|
||||
[this, builder](const PhantomNodes &phantom_pair) {
|
||||
return MakeWaypoint(builder, phantom_pair.target_phantom)->Finish();
|
||||
});
|
||||
return builder->CreateVector(waypoints);
|
||||
}
|
||||
|
||||
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
||||
// protected:
|
||||
std::unique_ptr<fbresult::WaypointBuilder> MakeWaypoint(flatbuffers::FlatBufferBuilder *builder,
|
||||
const PhantomNode &phantom) const
|
||||
{
|
||||
|
||||
auto location =
|
||||
fbresult::Position(static_cast<double>(util::toFloating(phantom.location.lon)),
|
||||
static_cast<double>(util::toFloating(phantom.location.lat)));
|
||||
auto name_string = builder->CreateString(
|
||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string());
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> hint_string;
|
||||
if (parameters.generate_hints)
|
||||
{
|
||||
hint_string = builder->CreateString(Hint{phantom, facade.GetCheckSum()}.ToBase64());
|
||||
}
|
||||
|
||||
auto waypoint = std::make_unique<fbresult::WaypointBuilder>(*builder);
|
||||
waypoint->add_location(&location);
|
||||
waypoint->add_distance(util::coordinate_calculation::fccApproximateDistance(
|
||||
phantom.location, phantom.input_location));
|
||||
waypoint->add_name(name_string);
|
||||
if (parameters.generate_hints)
|
||||
{
|
||||
waypoint->add_hint(hint_string);
|
||||
}
|
||||
return waypoint;
|
||||
}
|
||||
|
||||
const datafacade::BaseDataFacade &facade;
|
||||
const BaseParameters ¶meters;
|
||||
};
|
||||
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,29 +63,50 @@ namespace api
|
||||
*/
|
||||
struct BaseParameters
|
||||
{
|
||||
|
||||
enum class SnappingType
|
||||
{
|
||||
Default,
|
||||
Any
|
||||
};
|
||||
|
||||
enum class OutputFormatType
|
||||
{
|
||||
JSON,
|
||||
FLATBUFFERS
|
||||
};
|
||||
|
||||
std::vector<util::Coordinate> coordinates;
|
||||
std::vector<boost::optional<Hint>> hints;
|
||||
std::vector<boost::optional<double>> radiuses;
|
||||
std::vector<boost::optional<Bearing>> bearings;
|
||||
std::vector<boost::optional<Approach>> approaches;
|
||||
std::vector<std::string> exclude;
|
||||
boost::optional<OutputFormatType> format = OutputFormatType::JSON;
|
||||
|
||||
// Adds hints to response which can be included in subsequent requests, see `hints` above.
|
||||
bool generate_hints = true;
|
||||
|
||||
BaseParameters(const std::vector<util::Coordinate> coordinates_ = {},
|
||||
const std::vector<boost::optional<Hint>> hints_ = {},
|
||||
// Remove waypoints array from the response.
|
||||
bool skip_waypoints = false;
|
||||
|
||||
SnappingType snapping = SnappingType::Default;
|
||||
|
||||
BaseParameters(std::vector<util::Coordinate> coordinates_ = {},
|
||||
std::vector<boost::optional<Hint>> hints_ = {},
|
||||
std::vector<boost::optional<double>> radiuses_ = {},
|
||||
std::vector<boost::optional<Bearing>> bearings_ = {},
|
||||
std::vector<boost::optional<Approach>> approaches_ = {},
|
||||
bool generate_hints_ = true,
|
||||
std::vector<std::string> exclude = {})
|
||||
: coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_),
|
||||
approaches(approaches_), exclude(std::move(exclude)), generate_hints(generate_hints_)
|
||||
std::vector<std::string> exclude = {},
|
||||
const SnappingType snapping_ = SnappingType::Default)
|
||||
: coordinates(std::move(coordinates_)), hints(std::move(hints_)),
|
||||
radiuses(std::move(radiuses_)), bearings(std::move(bearings_)),
|
||||
approaches(std::move(approaches_)), exclude(std::move(exclude)),
|
||||
generate_hints(generate_hints_), snapping(snapping_)
|
||||
{
|
||||
}
|
||||
|
||||
// FIXME add validation for invalid bearing values
|
||||
bool IsValid() const
|
||||
{
|
||||
return (hints.empty() || hints.size() == coordinates.size()) &&
|
||||
@@ -94,7 +115,7 @@ struct BaseParameters
|
||||
(approaches.empty() || approaches.size() == coordinates.size()) &&
|
||||
std::all_of(bearings.begin(),
|
||||
bearings.end(),
|
||||
[](const boost::optional<Bearing> bearing_and_range) {
|
||||
[](const boost::optional<Bearing> &bearing_and_range) {
|
||||
if (bearing_and_range)
|
||||
{
|
||||
return bearing_and_range->IsValid();
|
||||
@@ -103,8 +124,8 @@ struct BaseParameters
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // ROUTE_PARAMETERS_HPP
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef ENGINE_API_BASE_RESULT_HPP
|
||||
#define ENGINE_API_BASE_RESULT_HPP
|
||||
|
||||
#include <flatbuffers/flatbuffers.h>
|
||||
#include <mapbox/variant.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace api
|
||||
{
|
||||
using ResultT =
|
||||
mapbox::util::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
include "route.fbs";
|
||||
include "table.fbs";
|
||||
|
||||
namespace osrm.engine.api.fbresult;
|
||||
|
||||
table Error {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
table FBResult {
|
||||
error: bool = false;
|
||||
code: Error;
|
||||
data_version: string;
|
||||
waypoints: [Waypoint]; //Used as 'sources' waypoints for a 'Table' service
|
||||
routes: [RouteObject];
|
||||
table: Table;
|
||||
}
|
||||
|
||||
root_type FBResult;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
namespace osrm.engine.api.fbresult;
|
||||
|
||||
struct Position {
|
||||
longitude: float;
|
||||
latitude: float;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
include "waypoint.fbs";
|
||||
namespace osrm.engine.api.fbresult;
|
||||
|
||||
table Metadata {
|
||||
datasource_names: [string];
|
||||
}
|
||||
|
||||
table Annotation {
|
||||
distance: [uint];
|
||||
duration: [uint];
|
||||
datasources: [uint];
|
||||
nodes: [uint];
|
||||
weight: [uint];
|
||||
speed: [float];
|
||||
metadata: Metadata;
|
||||
}
|
||||
|
||||
enum ManeuverType: byte {
|
||||
Turn,
|
||||
NewName,
|
||||
Depart,
|
||||
Arrive,
|
||||
Merge,
|
||||
OnRamp,
|
||||
OffRamp,
|
||||
Fork,
|
||||
EndOfRoad,
|
||||
Continue,
|
||||
Roundabout,
|
||||
Rotary,
|
||||
RoundaboutTurn,
|
||||
Notification,
|
||||
ExitRoundabout,
|
||||
ExitRotary
|
||||
}
|
||||
|
||||
enum Turn: byte {
|
||||
None,
|
||||
UTurn,
|
||||
SharpRight,
|
||||
Right,
|
||||
SlightRight,
|
||||
Straight,
|
||||
SlightLeft,
|
||||
Left,
|
||||
SharpLeft
|
||||
}
|
||||
|
||||
table StepManeuver {
|
||||
location: Position;
|
||||
bearing_before: ushort;
|
||||
bearing_after: ushort;
|
||||
type: ManeuverType;
|
||||
modifier: Turn;
|
||||
exit: ubyte;
|
||||
}
|
||||
|
||||
table Lane {
|
||||
indications: [Turn];
|
||||
valid: bool;
|
||||
}
|
||||
|
||||
table Intersection {
|
||||
location: Position;
|
||||
bearings: [short];
|
||||
classes: [string];
|
||||
entry: [bool];
|
||||
in_bearing: uint;
|
||||
out_bearing: uint;
|
||||
lanes: [Lane];
|
||||
}
|
||||
|
||||
table Step {
|
||||
distance: float;
|
||||
duration: float;
|
||||
polyline: string;
|
||||
coordinates: [Position];
|
||||
weight: float;
|
||||
name: string;
|
||||
ref: string;
|
||||
pronunciation: string;
|
||||
destinations: string;
|
||||
exits: string;
|
||||
mode: string;
|
||||
maneuver: StepManeuver;
|
||||
intersections: [Intersection];
|
||||
rotary_name: string;
|
||||
rotary_pronunciation: string;
|
||||
driving_side: bool; //Where true stands for the left side.
|
||||
}
|
||||
|
||||
table Leg {
|
||||
distance: double;
|
||||
duration: double;
|
||||
weight: double;
|
||||
summary: string;
|
||||
annotations: Annotation;
|
||||
steps: [Step];
|
||||
}
|
||||
|
||||
table RouteObject {
|
||||
distance: float;
|
||||
duration: float;
|
||||
weight: float;
|
||||
weight_name: string;
|
||||
confidence: float; //Used only by 'Match' service
|
||||
polyline: string;
|
||||
coordinates: [Position];
|
||||
legs: [Leg];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
include "waypoint.fbs";
|
||||
namespace osrm.engine.api.fbresult;
|
||||
|
||||
table Table {
|
||||
durations: [float];
|
||||
rows: ushort;
|
||||
cols: ushort;
|
||||
distances: [float];
|
||||
destinations: [Waypoint];
|
||||
fallback_speed_cells: [uint];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
include "position.fbs";
|
||||
namespace osrm.engine.api.fbresult;
|
||||
|
||||
struct Uint64Pair {
|
||||
first: uint64;
|
||||
second: uint64;
|
||||
}
|
||||
|
||||
table Waypoint {
|
||||
hint: string;
|
||||
distance: float;
|
||||
name: string;
|
||||
location: Position;
|
||||
nodes: Uint64Pair; //Used only by 'Nearest' service
|
||||
matchings_index: uint; //Used only by 'Match' service
|
||||
waypoint_index: uint; //Used by 'Match' and 'Trip' services
|
||||
alternatives_count: uint; //Used only by 'Match' service
|
||||
trips_index: uint; //Used only by 'Trip' service
|
||||
}
|
||||
@@ -33,7 +33,19 @@ namespace json
|
||||
namespace detail
|
||||
{
|
||||
|
||||
util::json::Array coordinateToLonLat(const util::Coordinate coordinate);
|
||||
// Check whether to include a modifier in the result of the API
|
||||
inline bool isValidModifier(const guidance::StepManeuver maneuver)
|
||||
{
|
||||
return (maneuver.waypoint_type == guidance::WaypointType::None ||
|
||||
maneuver.instruction.direction_modifier != osrm::guidance::DirectionModifier::UTurn);
|
||||
}
|
||||
|
||||
inline bool hasValidLanes(const guidance::IntermediateIntersection &intersection)
|
||||
{
|
||||
return intersection.lanes.lanes_in_turn > 0;
|
||||
}
|
||||
|
||||
util::json::Array coordinateToLonLat(const util::Coordinate &coordinate);
|
||||
|
||||
/**
|
||||
* Ensures that a bearing value is a whole number, and clamped to the range 0-359
|
||||
@@ -86,19 +98,22 @@ util::json::Object makeRoute(const guidance::Route &route,
|
||||
const char *weight_name);
|
||||
|
||||
// Creates a Waypoint without Hint, see the Hint overload below
|
||||
util::json::Object makeWaypoint(const util::Coordinate location, std::string name);
|
||||
util::json::Object
|
||||
makeWaypoint(const util::Coordinate &location, const double &distance, std::string name);
|
||||
|
||||
// Creates a Waypoint with Hint, see the overload above when Hint is not needed
|
||||
util::json::Object
|
||||
makeWaypoint(const util::Coordinate location, std::string name, const Hint &hint);
|
||||
util::json::Object makeWaypoint(const util::Coordinate &location,
|
||||
const double &distance,
|
||||
std::string name,
|
||||
const Hint &hint);
|
||||
|
||||
util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps);
|
||||
|
||||
util::json::Array makeRouteLegs(std::vector<guidance::RouteLeg> legs,
|
||||
std::vector<util::json::Value> step_geometries,
|
||||
std::vector<util::json::Object> annotations);
|
||||
}
|
||||
}
|
||||
} // namespace json
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
|
||||
@@ -29,6 +29,44 @@ class MatchAPI final : public RouteAPI
|
||||
{
|
||||
}
|
||||
|
||||
void MakeResponse(const std::vector<map_matching::SubMatching> &sub_matchings,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
osrm::engine::api::ResultT &response) const
|
||||
{
|
||||
BOOST_ASSERT(sub_matchings.size() == sub_routes.size());
|
||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||
{
|
||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||
MakeResponse(sub_matchings, sub_routes, fb_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &json_result = response.get<util::json::Object>();
|
||||
MakeResponse(sub_matchings, sub_routes, json_result);
|
||||
}
|
||||
}
|
||||
void MakeResponse(const std::vector<map_matching::SubMatching> &sub_matchings,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
}
|
||||
|
||||
auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_matchings]() {
|
||||
return MakeTracepoints(fb_result, sub_matchings);
|
||||
});
|
||||
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response->add_data_version(data_version_string);
|
||||
}
|
||||
|
||||
fb_result.Finish(response->Finish());
|
||||
}
|
||||
void MakeResponse(const std::vector<map_matching::SubMatching> &sub_matchings,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
util::json::Object &response) const
|
||||
@@ -36,7 +74,6 @@ class MatchAPI final : public RouteAPI
|
||||
auto number_of_routes = sub_matchings.size();
|
||||
util::json::Array routes;
|
||||
routes.values.reserve(number_of_routes);
|
||||
BOOST_ASSERT(sub_matchings.size() == sub_routes.size());
|
||||
for (auto index : util::irange<std::size_t>(0UL, sub_matchings.size()))
|
||||
{
|
||||
auto route = MakeRoute(sub_routes[index].segment_end_coordinates,
|
||||
@@ -46,7 +83,10 @@ class MatchAPI final : public RouteAPI
|
||||
route.values["confidence"] = sub_matchings[index].confidence;
|
||||
routes.values.push_back(std::move(route));
|
||||
}
|
||||
response.values["tracepoints"] = MakeTracepoints(sub_matchings);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["tracepoints"] = MakeTracepoints(sub_matchings);
|
||||
}
|
||||
response.values["matchings"] = std::move(routes);
|
||||
response.values["code"] = "Ok";
|
||||
}
|
||||
@@ -55,47 +95,87 @@ class MatchAPI final : public RouteAPI
|
||||
// FIXME this logic is a little backwards. We should change the output format of the
|
||||
// map_matching
|
||||
// routing algorithm to be easier to consume here.
|
||||
struct MatchingIndex
|
||||
{
|
||||
MatchingIndex() = default;
|
||||
MatchingIndex(unsigned sub_matching_index_, unsigned point_index_)
|
||||
: sub_matching_index(sub_matching_index_), point_index(point_index_)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned sub_matching_index = std::numeric_limits<unsigned>::max();
|
||||
unsigned point_index = std::numeric_limits<unsigned>::max();
|
||||
|
||||
bool NotMatched()
|
||||
{
|
||||
return sub_matching_index == std::numeric_limits<unsigned>::max() &&
|
||||
point_index == std::numeric_limits<unsigned>::max();
|
||||
}
|
||||
};
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
MakeTracepoints(flatbuffers::FlatBufferBuilder &fb_result,
|
||||
const std::vector<map_matching::SubMatching> &sub_matchings) const
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.reserve(parameters.coordinates.size());
|
||||
|
||||
auto trace_idx_to_matching_idx = MakeMatchingIndices(sub_matchings);
|
||||
|
||||
BOOST_ASSERT(parameters.waypoints.empty() || sub_matchings.size() == 1);
|
||||
|
||||
std::size_t was_waypoint_idx = 0;
|
||||
for (auto trace_index : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
|
||||
{
|
||||
|
||||
if (tidy_result.can_be_removed[trace_index])
|
||||
{
|
||||
waypoints.push_back(fbresult::WaypointBuilder(fb_result).Finish());
|
||||
continue;
|
||||
}
|
||||
auto matching_index = trace_idx_to_matching_idx[trace_index];
|
||||
if (matching_index.NotMatched())
|
||||
{
|
||||
waypoints.push_back(fbresult::WaypointBuilder(fb_result).Finish());
|
||||
continue;
|
||||
}
|
||||
const auto &phantom =
|
||||
sub_matchings[matching_index.sub_matching_index].nodes[matching_index.point_index];
|
||||
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, phantom);
|
||||
waypoint->add_matchings_index(matching_index.sub_matching_index);
|
||||
waypoint->add_alternatives_count(sub_matchings[matching_index.sub_matching_index]
|
||||
.alternatives_count[matching_index.point_index]);
|
||||
// waypoint indices need to be adjusted if route legs were collapsed
|
||||
// waypoint parameter assumes there is only one match object
|
||||
if (!parameters.waypoints.empty())
|
||||
{
|
||||
if (tidy_result.was_waypoint[trace_index])
|
||||
{
|
||||
waypoint->add_waypoint_index(was_waypoint_idx);
|
||||
was_waypoint_idx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
waypoint->add_waypoint_index(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
waypoint->add_waypoint_index(matching_index.point_index);
|
||||
}
|
||||
waypoints.push_back(waypoint->Finish());
|
||||
}
|
||||
|
||||
return fb_result.CreateVector(waypoints);
|
||||
}
|
||||
|
||||
util::json::Array
|
||||
MakeTracepoints(const std::vector<map_matching::SubMatching> &sub_matchings) const
|
||||
{
|
||||
util::json::Array waypoints;
|
||||
waypoints.values.reserve(parameters.coordinates.size());
|
||||
|
||||
struct MatchingIndex
|
||||
{
|
||||
MatchingIndex() = default;
|
||||
MatchingIndex(unsigned sub_matching_index_, unsigned point_index_)
|
||||
: sub_matching_index(sub_matching_index_), point_index(point_index_)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned sub_matching_index = std::numeric_limits<unsigned>::max();
|
||||
unsigned point_index = std::numeric_limits<unsigned>::max();
|
||||
|
||||
bool NotMatched()
|
||||
{
|
||||
return sub_matching_index == std::numeric_limits<unsigned>::max() &&
|
||||
point_index == std::numeric_limits<unsigned>::max();
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<MatchingIndex> trace_idx_to_matching_idx(parameters.coordinates.size());
|
||||
for (auto sub_matching_index :
|
||||
util::irange(0u, static_cast<unsigned>(sub_matchings.size())))
|
||||
{
|
||||
for (auto point_index : util::irange(
|
||||
0u, static_cast<unsigned>(sub_matchings[sub_matching_index].indices.size())))
|
||||
{
|
||||
// tidied_to_original: index of the input coordinate that a tidied coordinate
|
||||
// corresponds to.
|
||||
// sub_matching indices: index of the coordinate passed to map matching plugin that
|
||||
// a matched node corresponds to.
|
||||
trace_idx_to_matching_idx[tidy_result
|
||||
.tidied_to_original[sub_matchings[sub_matching_index]
|
||||
.indices[point_index]]] =
|
||||
MatchingIndex{sub_matching_index, point_index};
|
||||
}
|
||||
}
|
||||
auto trace_idx_to_matching_idx = MakeMatchingIndices(sub_matchings);
|
||||
|
||||
BOOST_ASSERT(parameters.waypoints.empty() || sub_matchings.size() == 1);
|
||||
|
||||
@@ -141,12 +221,35 @@ class MatchAPI final : public RouteAPI
|
||||
return waypoints;
|
||||
}
|
||||
|
||||
std::vector<MatchingIndex>
|
||||
MakeMatchingIndices(const std::vector<map_matching::SubMatching> &sub_matchings) const
|
||||
{
|
||||
std::vector<MatchingIndex> trace_idx_to_matching_idx(parameters.coordinates.size());
|
||||
for (auto sub_matching_index :
|
||||
util::irange(0u, static_cast<unsigned>(sub_matchings.size())))
|
||||
{
|
||||
for (auto point_index : util::irange(
|
||||
0u, static_cast<unsigned>(sub_matchings[sub_matching_index].indices.size())))
|
||||
{
|
||||
// tidied_to_original: index of the input coordinate that a tidied coordinate
|
||||
// corresponds to.
|
||||
// sub_matching indices: index of the coordinate passed to map matching plugin that
|
||||
// a matched node corresponds to.
|
||||
trace_idx_to_matching_idx[tidy_result
|
||||
.tidied_to_original[sub_matchings[sub_matching_index]
|
||||
.indices[point_index]]] =
|
||||
MatchingIndex{sub_matching_index, point_index};
|
||||
}
|
||||
}
|
||||
return trace_idx_to_matching_idx;
|
||||
}
|
||||
|
||||
const MatchParameters ¶meters;
|
||||
const tidy::Result &tidy_result;
|
||||
};
|
||||
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,13 +63,16 @@ struct MatchParameters : public RouteParameters
|
||||
RouteParameters::GeometriesType::Polyline,
|
||||
RouteParameters::OverviewType::Simplified,
|
||||
{}),
|
||||
gaps(GapsType::Split), tidy(false), waypoints()
|
||||
gaps(GapsType::Split), tidy(false)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
MatchParameters(std::vector<unsigned> timestamps_, GapsType gaps_, bool tidy_, Args... args_)
|
||||
: MatchParameters(std::move(timestamps_), gaps_, tidy_, {}, std::forward<Args>(args_)...)
|
||||
MatchParameters(const std::vector<unsigned> ×tamps_,
|
||||
GapsType gaps_,
|
||||
bool tidy_,
|
||||
Args &&... args_)
|
||||
: MatchParameters(timestamps_, gaps_, tidy_, {}, std::forward<Args>(args_)...)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,30 +80,26 @@ struct MatchParameters : public RouteParameters
|
||||
MatchParameters(std::vector<unsigned> timestamps_,
|
||||
GapsType gaps_,
|
||||
bool tidy_,
|
||||
std::vector<std::size_t> waypoints_,
|
||||
Args... args_)
|
||||
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)},
|
||||
gaps(gaps_), tidy(tidy_), waypoints{std::move(waypoints_)}
|
||||
const std::vector<std::size_t> &waypoints_,
|
||||
Args &&... args_)
|
||||
: RouteParameters{std::forward<Args>(args_)..., waypoints_}, timestamps{std::move(
|
||||
timestamps_)},
|
||||
gaps(gaps_), tidy(tidy_)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<unsigned> timestamps;
|
||||
GapsType gaps;
|
||||
bool tidy;
|
||||
std::vector<std::size_t> waypoints;
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
const auto valid_waypoints =
|
||||
std::all_of(waypoints.begin(), waypoints.end(), [this](const auto &w) {
|
||||
return w < coordinates.size();
|
||||
});
|
||||
return RouteParameters::IsValid() &&
|
||||
(timestamps.empty() || timestamps.size() == coordinates.size()) && valid_waypoints;
|
||||
(timestamps.empty() || timestamps.size() == coordinates.size());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -200,9 +200,9 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
||||
return result;
|
||||
}
|
||||
|
||||
} // ns tidy
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace tidy
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define ENGINE_API_NEAREST_API_HPP
|
||||
|
||||
#include "engine/api/base_api.hpp"
|
||||
#include "engine/api/base_result.hpp"
|
||||
#include "engine/api/nearest_parameters.hpp"
|
||||
|
||||
#include "engine/api/json_factory.hpp"
|
||||
@@ -27,72 +28,139 @@ class NearestAPI final : public BaseAPI
|
||||
}
|
||||
|
||||
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
||||
util::json::Object &response) const
|
||||
osrm::engine::api::ResultT &response) const
|
||||
{
|
||||
BOOST_ASSERT(phantom_nodes.size() == 1);
|
||||
BOOST_ASSERT(parameters.coordinates.size() == 1);
|
||||
|
||||
util::json::Array waypoints;
|
||||
waypoints.values.resize(phantom_nodes.front().size());
|
||||
std::transform(
|
||||
phantom_nodes.front().begin(),
|
||||
phantom_nodes.front().end(),
|
||||
waypoints.values.begin(),
|
||||
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||
auto &phantom_node = phantom_with_distance.phantom_node;
|
||||
auto waypoint = MakeWaypoint(phantom_node);
|
||||
waypoint.values["distance"] = phantom_with_distance.distance;
|
||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||
{
|
||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||
MakeResponse(phantom_nodes, fb_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &json_result = response.get<util::json::Object>();
|
||||
MakeResponse(phantom_nodes, json_result);
|
||||
}
|
||||
}
|
||||
|
||||
util::json::Array nodes;
|
||||
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
}
|
||||
|
||||
std::uint64_t from_node = 0;
|
||||
std::uint64_t to_node = 0;
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
waypoints_vector;
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.resize(phantom_nodes.front().size());
|
||||
std::transform(
|
||||
phantom_nodes.front().begin(),
|
||||
phantom_nodes.front().end(),
|
||||
waypoints.begin(),
|
||||
[this, &fb_result](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||
auto &phantom_node = phantom_with_distance.phantom_node;
|
||||
|
||||
datafacade::BaseDataFacade::NodeForwardRange forward_geometry;
|
||||
if (phantom_node.forward_segment_id.enabled)
|
||||
{
|
||||
auto segment_id = phantom_node.forward_segment_id.id;
|
||||
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
|
||||
forward_geometry = facade.GetUncompressedForwardGeometry(geometry_id);
|
||||
auto node_values = MakeNodes(phantom_node);
|
||||
fbresult::Uint64Pair nodes{node_values.first, node_values.second};
|
||||
|
||||
auto osm_node_id = facade.GetOSMNodeIDOfNode(
|
||||
forward_geometry(phantom_node.fwd_segment_position));
|
||||
to_node = static_cast<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
auto waypoint = MakeWaypoint(&fb_result, phantom_node);
|
||||
waypoint->add_nodes(&nodes);
|
||||
return waypoint->Finish();
|
||||
});
|
||||
|
||||
if (phantom_node.reverse_segment_id.enabled)
|
||||
{
|
||||
auto segment_id = phantom_node.reverse_segment_id.id;
|
||||
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
|
||||
const auto geometry = facade.GetUncompressedForwardGeometry(geometry_id);
|
||||
auto osm_node_id =
|
||||
facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1));
|
||||
from_node = static_cast<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
else if (phantom_node.forward_segment_id.enabled &&
|
||||
phantom_node.fwd_segment_position > 0)
|
||||
{
|
||||
// In the case of one way, rely on forward segment only
|
||||
auto osm_node_id = facade.GetOSMNodeIDOfNode(
|
||||
forward_geometry(phantom_node.fwd_segment_position - 1));
|
||||
from_node = static_cast<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
nodes.values.push_back(from_node);
|
||||
nodes.values.push_back(to_node);
|
||||
waypoint.values["nodes"] = std::move(nodes);
|
||||
waypoints_vector = fb_result.CreateVector(waypoints);
|
||||
}
|
||||
|
||||
return waypoint;
|
||||
});
|
||||
fbresult::FBResultBuilder response(fb_result);
|
||||
|
||||
response.add_waypoints(waypoints_vector);
|
||||
if (data_version_string)
|
||||
{
|
||||
response.add_data_version(*data_version_string);
|
||||
}
|
||||
fb_result.Finish(response.Finish());
|
||||
}
|
||||
void MakeResponse(const std::vector<std::vector<PhantomNodeWithDistance>> &phantom_nodes,
|
||||
util::json::Object &response) const
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
util::json::Array waypoints;
|
||||
waypoints.values.resize(phantom_nodes.front().size());
|
||||
std::transform(phantom_nodes.front().begin(),
|
||||
phantom_nodes.front().end(),
|
||||
waypoints.values.begin(),
|
||||
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||
auto &phantom_node = phantom_with_distance.phantom_node;
|
||||
auto waypoint = MakeWaypoint(phantom_node);
|
||||
|
||||
util::json::Array nodes;
|
||||
|
||||
auto node_values = MakeNodes(phantom_node);
|
||||
|
||||
nodes.values.push_back(node_values.first);
|
||||
nodes.values.push_back(node_values.second);
|
||||
waypoint.values["nodes"] = std::move(nodes);
|
||||
|
||||
return waypoint;
|
||||
});
|
||||
response.values["waypoints"] = std::move(waypoints);
|
||||
}
|
||||
|
||||
response.values["code"] = "Ok";
|
||||
response.values["waypoints"] = std::move(waypoints);
|
||||
}
|
||||
|
||||
const NearestParameters ¶meters;
|
||||
|
||||
protected:
|
||||
std::pair<uint64_t, uint64_t> MakeNodes(const PhantomNode &phantom_node) const
|
||||
{
|
||||
std::uint64_t from_node = 0;
|
||||
std::uint64_t to_node = 0;
|
||||
|
||||
datafacade::BaseDataFacade::NodeForwardRange forward_geometry;
|
||||
if (phantom_node.forward_segment_id.enabled)
|
||||
{
|
||||
auto segment_id = phantom_node.forward_segment_id.id;
|
||||
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
|
||||
forward_geometry = facade.GetUncompressedForwardGeometry(geometry_id);
|
||||
|
||||
auto osm_node_id =
|
||||
facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position));
|
||||
to_node = static_cast<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
|
||||
if (phantom_node.reverse_segment_id.enabled)
|
||||
{
|
||||
auto segment_id = phantom_node.reverse_segment_id.id;
|
||||
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
|
||||
const auto geometry = facade.GetUncompressedForwardGeometry(geometry_id);
|
||||
auto osm_node_id =
|
||||
facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1));
|
||||
from_node = static_cast<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
else if (phantom_node.forward_segment_id.enabled && phantom_node.fwd_segment_position > 0)
|
||||
{
|
||||
// In the case of one way, rely on forward segment only
|
||||
auto osm_node_id =
|
||||
facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position - 1));
|
||||
from_node = static_cast<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
|
||||
return std::make_pair(from_node, to_node);
|
||||
}
|
||||
};
|
||||
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,8 +52,8 @@ struct NearestParameters : public BaseParameters
|
||||
|
||||
bool IsValid() const { return BaseParameters::IsValid() && number_of_results >= 1; }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // ENGINE_API_NEAREST_PARAMETERS_HPP
|
||||
|
||||
+748
-119
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "extractor/maneuver_override.hpp"
|
||||
#include "engine/api/base_api.hpp"
|
||||
#include "engine/api/base_result.hpp"
|
||||
#include "engine/api/json_factory.hpp"
|
||||
#include "engine/api/route_parameters.hpp"
|
||||
|
||||
@@ -44,11 +45,58 @@ class RouteAPI : public BaseAPI
|
||||
{
|
||||
}
|
||||
|
||||
void MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||
util::json::Object &response) const
|
||||
void
|
||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||
const std::vector<PhantomNodes>
|
||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
||||
osrm::engine::api::ResultT &response) const
|
||||
{
|
||||
BOOST_ASSERT(!raw_routes.routes.empty());
|
||||
|
||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||
{
|
||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||
MakeResponse(raw_routes, all_start_end_points, fb_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &json_result = response.get<util::json::Object>();
|
||||
MakeResponse(raw_routes, all_start_end_points, json_result);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||
const std::vector<PhantomNodes>
|
||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
}
|
||||
|
||||
auto response =
|
||||
MakeFBResponse(raw_routes, fb_result, [this, &all_start_end_points, &fb_result]() {
|
||||
return BaseAPI::MakeWaypoints(&fb_result, all_start_end_points);
|
||||
});
|
||||
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response->add_data_version(data_version_string);
|
||||
}
|
||||
fb_result.Finish(response->Finish());
|
||||
}
|
||||
|
||||
void
|
||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||
const std::vector<PhantomNodes>
|
||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
||||
util::json::Object &response) const
|
||||
{
|
||||
util::json::Array jsRoutes;
|
||||
|
||||
for (const auto &route : raw_routes.routes)
|
||||
@@ -62,28 +110,115 @@ class RouteAPI : public BaseAPI
|
||||
route.target_traversed_in_reverse));
|
||||
}
|
||||
|
||||
response.values["waypoints"] =
|
||||
BaseAPI::MakeWaypoints(raw_routes.routes[0].segment_end_coordinates);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["waypoints"] = BaseAPI::MakeWaypoints(all_start_end_points);
|
||||
}
|
||||
response.values["routes"] = std::move(jsRoutes);
|
||||
response.values["code"] = "Ok";
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response.values["data_version"] = data_timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
template <typename GetWptsFn>
|
||||
std::unique_ptr<fbresult::FBResultBuilder>
|
||||
MakeFBResponse(const InternalManyRoutesResult &raw_routes,
|
||||
flatbuffers::FlatBufferBuilder &fb_result,
|
||||
GetWptsFn getWaypoints) const
|
||||
{
|
||||
|
||||
std::vector<flatbuffers::Offset<fbresult::RouteObject>> routes;
|
||||
for (const auto &raw_route : raw_routes.routes)
|
||||
{
|
||||
if (!raw_route.is_valid())
|
||||
continue;
|
||||
|
||||
routes.push_back(MakeRoute(fb_result,
|
||||
raw_route.segment_end_coordinates,
|
||||
raw_route.unpacked_path_segments,
|
||||
raw_route.source_traversed_in_reverse,
|
||||
raw_route.target_traversed_in_reverse));
|
||||
}
|
||||
|
||||
auto routes_vector = fb_result.CreateVector(routes);
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
waypoints_vector;
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
waypoints_vector = getWaypoints();
|
||||
}
|
||||
|
||||
auto response = std::make_unique<fbresult::FBResultBuilder>(fb_result);
|
||||
response->add_routes(routes_vector);
|
||||
response->add_waypoints(waypoints_vector);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
template <typename ForwardIter>
|
||||
util::json::Value MakeGeometry(ForwardIter begin, ForwardIter end) const
|
||||
mapbox::util::variant<flatbuffers::Offset<flatbuffers::String>,
|
||||
flatbuffers::Offset<flatbuffers::Vector<const fbresult::Position *>>>
|
||||
MakeGeometry(flatbuffers::FlatBufferBuilder &builder, ForwardIter begin, ForwardIter end) const
|
||||
{
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||
{
|
||||
return json::makePolyline<100000>(begin, end);
|
||||
return builder.CreateString(encodePolyline<100000>(begin, end));
|
||||
}
|
||||
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||
else if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||
{
|
||||
return json::makePolyline<1000000>(begin, end);
|
||||
return builder.CreateString(encodePolyline<1000000>(begin, end));
|
||||
}
|
||||
std::vector<fbresult::Position> coordinates;
|
||||
coordinates.resize(std::distance(begin, end));
|
||||
std::transform(begin, end, coordinates.begin(), [](const Coordinate &c) {
|
||||
return fbresult::Position{static_cast<float>(util::toFloating(c.lon).__value),
|
||||
static_cast<float>(util::toFloating(c.lat).__value)};
|
||||
});
|
||||
return builder.CreateVectorOfStructs(coordinates);
|
||||
}
|
||||
|
||||
boost::optional<util::json::Value>
|
||||
MakeGeometry(boost::optional<std::vector<Coordinate>> &&annotations) const
|
||||
{
|
||||
boost::optional<util::json::Value> json_geometry;
|
||||
if (annotations)
|
||||
{
|
||||
auto begin = annotations->begin();
|
||||
auto end = annotations->end();
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||
{
|
||||
json_geometry = json::makePolyline<100000>(begin, end);
|
||||
}
|
||||
else if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||
{
|
||||
json_geometry = json::makePolyline<1000000>(begin, end);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
|
||||
json_geometry = json::makeGeoJSONGeometry(begin, end);
|
||||
}
|
||||
}
|
||||
return json_geometry;
|
||||
}
|
||||
|
||||
template <typename ValueType, typename GetFn>
|
||||
flatbuffers::Offset<flatbuffers::Vector<ValueType>> GetAnnotations(
|
||||
flatbuffers::FlatBufferBuilder &fb_result, guidance::LegGeometry &leg, GetFn Get) const
|
||||
{
|
||||
std::vector<ValueType> annotations_store;
|
||||
annotations_store.reserve(leg.annotations.size());
|
||||
|
||||
for (const auto &step : leg.annotations)
|
||||
{
|
||||
annotations_store.push_back(Get(step));
|
||||
}
|
||||
|
||||
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
|
||||
return json::makeGeoJSONGeometry(begin, end);
|
||||
return fb_result.CreateVector(annotations_store);
|
||||
}
|
||||
|
||||
template <typename GetFn>
|
||||
@@ -100,118 +235,491 @@ class RouteAPI : public BaseAPI
|
||||
return annotations_store;
|
||||
}
|
||||
|
||||
fbresult::ManeuverType WaypointTypeToFB(guidance::WaypointType type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case guidance::WaypointType::Arrive:
|
||||
return fbresult::ManeuverType_Arrive;
|
||||
case guidance::WaypointType::Depart:
|
||||
return fbresult::ManeuverType_Depart;
|
||||
default:
|
||||
return fbresult::ManeuverType_Notification;
|
||||
}
|
||||
}
|
||||
|
||||
fbresult::ManeuverType TurnTypeToFB(osrm::guidance::TurnType::Enum turn) const
|
||||
{
|
||||
static std::map<osrm::guidance::TurnType::Enum, fbresult::ManeuverType> mappings = {
|
||||
{osrm::guidance::TurnType::Invalid, fbresult::ManeuverType_Notification},
|
||||
{osrm::guidance::TurnType::NewName, fbresult::ManeuverType_NewName},
|
||||
{osrm::guidance::TurnType::Continue, fbresult::ManeuverType_Continue},
|
||||
{osrm::guidance::TurnType::Turn, fbresult::ManeuverType_Turn},
|
||||
{osrm::guidance::TurnType::Merge, fbresult::ManeuverType_Merge},
|
||||
{osrm::guidance::TurnType::OnRamp, fbresult::ManeuverType_OnRamp},
|
||||
{osrm::guidance::TurnType::OffRamp, fbresult::ManeuverType_OffRamp},
|
||||
{osrm::guidance::TurnType::Fork, fbresult::ManeuverType_Fork},
|
||||
{osrm::guidance::TurnType::EndOfRoad, fbresult::ManeuverType_EndOfRoad},
|
||||
{osrm::guidance::TurnType::Notification, fbresult::ManeuverType_Notification},
|
||||
{osrm::guidance::TurnType::EnterRoundabout, fbresult::ManeuverType_Roundabout},
|
||||
{osrm::guidance::TurnType::EnterAndExitRoundabout,
|
||||
fbresult::ManeuverType_ExitRoundabout},
|
||||
{osrm::guidance::TurnType::EnterRotary, fbresult::ManeuverType_Rotary},
|
||||
{osrm::guidance::TurnType::EnterAndExitRotary, fbresult::ManeuverType_ExitRotary},
|
||||
{osrm::guidance::TurnType::EnterRoundaboutIntersection,
|
||||
fbresult::ManeuverType_Roundabout},
|
||||
{osrm::guidance::TurnType::EnterAndExitRoundaboutIntersection,
|
||||
fbresult::ManeuverType_ExitRoundabout},
|
||||
{osrm::guidance::TurnType::NoTurn, fbresult::ManeuverType_Notification},
|
||||
{osrm::guidance::TurnType::Suppressed, fbresult::ManeuverType_Notification},
|
||||
{osrm::guidance::TurnType::EnterRoundaboutAtExit, fbresult::ManeuverType_Roundabout},
|
||||
{osrm::guidance::TurnType::ExitRoundabout, fbresult::ManeuverType_ExitRoundabout},
|
||||
{osrm::guidance::TurnType::EnterRotaryAtExit, fbresult::ManeuverType_Rotary},
|
||||
{osrm::guidance::TurnType::ExitRotary, fbresult::ManeuverType_ExitRotary},
|
||||
{osrm::guidance::TurnType::EnterRoundaboutIntersectionAtExit,
|
||||
fbresult::ManeuverType_Roundabout},
|
||||
{osrm::guidance::TurnType::ExitRoundaboutIntersection,
|
||||
fbresult::ManeuverType_ExitRoundabout},
|
||||
{osrm::guidance::TurnType::StayOnRoundabout, fbresult::ManeuverType_RoundaboutTurn},
|
||||
{osrm::guidance::TurnType::Sliproad, fbresult::ManeuverType_Notification},
|
||||
{osrm::guidance::TurnType::MaxTurnType, fbresult::ManeuverType_Notification}};
|
||||
return mappings[turn];
|
||||
}
|
||||
|
||||
fbresult::Turn TurnModifierToFB(osrm::guidance::DirectionModifier::Enum modifier) const
|
||||
{
|
||||
static std::map<osrm::guidance::DirectionModifier::Enum, fbresult::Turn> mappings = {
|
||||
{osrm::guidance::DirectionModifier::UTurn, fbresult::Turn_UTurn},
|
||||
{osrm::guidance::DirectionModifier::SharpRight, fbresult::Turn_SharpRight},
|
||||
{osrm::guidance::DirectionModifier::Right, fbresult::Turn_Right},
|
||||
{osrm::guidance::DirectionModifier::SlightRight, fbresult::Turn_SlightRight},
|
||||
{osrm::guidance::DirectionModifier::Straight, fbresult::Turn_Straight},
|
||||
{osrm::guidance::DirectionModifier::SlightLeft, fbresult::Turn_SlightLeft},
|
||||
{osrm::guidance::DirectionModifier::Left, fbresult::Turn_Left},
|
||||
{osrm::guidance::DirectionModifier::SharpLeft, fbresult::Turn_SharpLeft},
|
||||
};
|
||||
return mappings[modifier];
|
||||
}
|
||||
|
||||
std::vector<int8_t> TurnLaneTypeToFB(const extractor::TurnLaneType::Mask lane_type) const
|
||||
{
|
||||
const static fbresult::Turn mapping[] = {fbresult::Turn_None,
|
||||
fbresult::Turn_Straight,
|
||||
fbresult::Turn_SharpLeft,
|
||||
fbresult::Turn_Left,
|
||||
fbresult::Turn_SlightLeft,
|
||||
fbresult::Turn_SlightRight,
|
||||
fbresult::Turn_Right,
|
||||
fbresult::Turn_SharpRight,
|
||||
fbresult::Turn_UTurn,
|
||||
fbresult::Turn_SlightLeft,
|
||||
fbresult::Turn_SlightRight};
|
||||
std::vector<int8_t> result;
|
||||
std::bitset<8 * sizeof(extractor::TurnLaneType::Mask)> mask(lane_type);
|
||||
for (auto index : util::irange<std::size_t>(0, extractor::TurnLaneType::NUM_TYPES))
|
||||
{
|
||||
if (mask[index])
|
||||
{
|
||||
result.push_back(mapping[index]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
flatbuffers::Offset<fbresult::RouteObject>
|
||||
MakeRoute(flatbuffers::FlatBufferBuilder &fb_result,
|
||||
const std::vector<PhantomNodes> &segment_end_coordinates,
|
||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||
const std::vector<bool> &source_traversed_in_reverse,
|
||||
const std::vector<bool> &target_traversed_in_reverse) const
|
||||
{
|
||||
auto legs_info = MakeLegs(segment_end_coordinates,
|
||||
unpacked_path_segments,
|
||||
source_traversed_in_reverse,
|
||||
target_traversed_in_reverse);
|
||||
std::vector<guidance::RouteLeg> legs = legs_info.first;
|
||||
std::vector<guidance::LegGeometry> leg_geometries = legs_info.second;
|
||||
auto route = guidance::assembleRoute(legs);
|
||||
|
||||
// Fill legs
|
||||
std::vector<flatbuffers::Offset<fbresult::Leg>> routeLegs;
|
||||
routeLegs.reserve(legs.size());
|
||||
for (const auto idx : util::irange<std::size_t>(0UL, legs.size()))
|
||||
{
|
||||
auto leg = legs[idx];
|
||||
auto &leg_geometry = leg_geometries[idx];
|
||||
|
||||
// Fill steps
|
||||
std::vector<flatbuffers::Offset<fbresult::Step>> legSteps;
|
||||
if (!leg.steps.empty())
|
||||
{
|
||||
legSteps.resize(leg.steps.size());
|
||||
std::transform(leg.steps.begin(),
|
||||
leg.steps.end(),
|
||||
legSteps.begin(),
|
||||
[this, &fb_result, &leg_geometry](auto &step) {
|
||||
return this->MakeFBStep(fb_result, leg_geometry, step);
|
||||
});
|
||||
}
|
||||
auto steps_vector = fb_result.CreateVector(legSteps);
|
||||
|
||||
// Fill annotations
|
||||
// To maintain support for uses of the old default constructors, we check
|
||||
// if annotations property was set manually after default construction
|
||||
auto requested_annotations = parameters.annotations_type;
|
||||
if ((parameters.annotations == true) &&
|
||||
(parameters.annotations_type == RouteParameters::AnnotationsType::None))
|
||||
{
|
||||
requested_annotations = RouteParameters::AnnotationsType::All;
|
||||
}
|
||||
|
||||
flatbuffers::Offset<fbresult::Annotation> annotation_buffer;
|
||||
if (requested_annotations != RouteParameters::AnnotationsType::None)
|
||||
{
|
||||
annotation_buffer =
|
||||
MakeFBAnnotations(fb_result, leg_geometry, requested_annotations);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> summary_string;
|
||||
if (!leg.summary.empty())
|
||||
{
|
||||
summary_string = fb_result.CreateString(leg.summary);
|
||||
}
|
||||
|
||||
fbresult::LegBuilder legBuilder(fb_result);
|
||||
legBuilder.add_distance(leg.distance);
|
||||
legBuilder.add_duration(leg.duration);
|
||||
legBuilder.add_weight(leg.weight);
|
||||
if (!leg.summary.empty())
|
||||
{
|
||||
legBuilder.add_summary(summary_string);
|
||||
}
|
||||
legBuilder.add_steps(steps_vector);
|
||||
|
||||
if (requested_annotations != RouteParameters::AnnotationsType::None)
|
||||
{
|
||||
legBuilder.add_annotations(annotation_buffer);
|
||||
}
|
||||
routeLegs.emplace_back(legBuilder.Finish());
|
||||
}
|
||||
auto legs_vector = fb_result.CreateVector(routeLegs);
|
||||
|
||||
// Fill geometry
|
||||
auto overview = MakeOverview(leg_geometries);
|
||||
mapbox::util::variant<flatbuffers::Offset<flatbuffers::String>,
|
||||
flatbuffers::Offset<flatbuffers::Vector<const fbresult::Position *>>>
|
||||
geometry;
|
||||
if (overview)
|
||||
{
|
||||
geometry = MakeGeometry(fb_result, overview->begin(), overview->end());
|
||||
}
|
||||
|
||||
auto weight_name_string = fb_result.CreateString(facade.GetWeightName());
|
||||
|
||||
fbresult::RouteObjectBuilder routeObject(fb_result);
|
||||
routeObject.add_distance(route.distance);
|
||||
routeObject.add_duration(route.duration);
|
||||
routeObject.add_weight(route.weight);
|
||||
routeObject.add_weight_name(weight_name_string);
|
||||
routeObject.add_legs(legs_vector);
|
||||
if (overview)
|
||||
{
|
||||
mapbox::util::apply_visitor(GeometryVisitor<fbresult::RouteObjectBuilder>(routeObject),
|
||||
geometry);
|
||||
}
|
||||
|
||||
return routeObject.Finish();
|
||||
}
|
||||
|
||||
flatbuffers::Offset<fbresult::Annotation>
|
||||
MakeFBAnnotations(flatbuffers::FlatBufferBuilder &fb_result,
|
||||
guidance::LegGeometry &leg_geometry,
|
||||
const RouteParameters::AnnotationsType &requested_annotations) const
|
||||
{
|
||||
// AnnotationsType uses bit flags, & operator checks if a property is set
|
||||
flatbuffers::Offset<flatbuffers::Vector<float>> speed;
|
||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
|
||||
{
|
||||
double prev_speed = 0;
|
||||
speed =
|
||||
GetAnnotations<float>(fb_result,
|
||||
leg_geometry,
|
||||
[&prev_speed](const guidance::LegGeometry::Annotation &anno) {
|
||||
if (anno.duration < std::numeric_limits<float>::min())
|
||||
{
|
||||
return prev_speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto speed =
|
||||
round(anno.distance / anno.duration * 10.) / 10.;
|
||||
prev_speed = speed;
|
||||
return util::json::clamp_float(speed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> duration;
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Duration)
|
||||
{
|
||||
duration = GetAnnotations<uint32_t>(
|
||||
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||
return anno.duration;
|
||||
});
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> distance;
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Distance)
|
||||
{
|
||||
distance = GetAnnotations<uint32_t>(
|
||||
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||
return anno.distance;
|
||||
});
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> weight;
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Weight)
|
||||
{
|
||||
weight = GetAnnotations<uint32_t>(
|
||||
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||
return anno.weight;
|
||||
});
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> datasources;
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Datasources)
|
||||
{
|
||||
datasources = GetAnnotations<uint32_t>(
|
||||
fb_result, leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||
return anno.datasource;
|
||||
});
|
||||
}
|
||||
std::vector<uint32_t> nodes;
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
||||
{
|
||||
nodes.reserve(leg_geometry.osm_node_ids.size());
|
||||
for (const auto node_id : leg_geometry.osm_node_ids)
|
||||
{
|
||||
nodes.emplace_back(static_cast<uint64_t>(node_id));
|
||||
}
|
||||
}
|
||||
auto nodes_vector = fb_result.CreateVector(nodes);
|
||||
// Add any supporting metadata, if needed
|
||||
bool use_metadata = requested_annotations & RouteParameters::AnnotationsType::Datasources;
|
||||
flatbuffers::Offset<fbresult::Metadata> metadata_buffer;
|
||||
if (use_metadata)
|
||||
{
|
||||
const auto MAX_DATASOURCE_ID = 255u;
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> names;
|
||||
for (auto i = 0u; i < MAX_DATASOURCE_ID; i++)
|
||||
{
|
||||
const auto name = facade.GetDatasourceName(i);
|
||||
// Length of 0 indicates the first empty name, so we can stop here
|
||||
if (name.size() == 0)
|
||||
break;
|
||||
names.emplace_back(
|
||||
fb_result.CreateString(std::string(facade.GetDatasourceName(i))));
|
||||
}
|
||||
metadata_buffer = fbresult::CreateMetadataDirect(fb_result, &names);
|
||||
}
|
||||
fbresult::AnnotationBuilder annotation(fb_result);
|
||||
annotation.add_speed(speed);
|
||||
annotation.add_duration(duration);
|
||||
annotation.add_distance(distance);
|
||||
annotation.add_weight(weight);
|
||||
annotation.add_datasources(datasources);
|
||||
annotation.add_nodes(nodes_vector);
|
||||
if (use_metadata)
|
||||
{
|
||||
annotation.add_metadata(metadata_buffer);
|
||||
}
|
||||
|
||||
return annotation.Finish();
|
||||
}
|
||||
|
||||
template <typename Builder> class GeometryVisitor
|
||||
{
|
||||
public:
|
||||
GeometryVisitor(Builder &builder) : builder(builder) {}
|
||||
|
||||
void operator()(const flatbuffers::Offset<flatbuffers::String> &value)
|
||||
{
|
||||
builder.add_polyline(value);
|
||||
}
|
||||
void operator()(
|
||||
const flatbuffers::Offset<flatbuffers::Vector<const fbresult::Position *>> &value)
|
||||
{
|
||||
builder.add_coordinates(value);
|
||||
}
|
||||
|
||||
private:
|
||||
Builder &builder;
|
||||
};
|
||||
|
||||
flatbuffers::Offset<fbresult::Step> MakeFBStep(flatbuffers::FlatBufferBuilder &builder,
|
||||
const guidance::LegGeometry &leg_geometry,
|
||||
const guidance::RouteStep &step) const
|
||||
{
|
||||
auto name_string = builder.CreateString(step.name);
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> ref_string;
|
||||
if (!step.ref.empty())
|
||||
{
|
||||
ref_string = builder.CreateString(step.ref);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> pronunciation_string;
|
||||
if (!step.pronunciation.empty())
|
||||
{
|
||||
pronunciation_string = builder.CreateString(step.pronunciation);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> destinations_string;
|
||||
if (!step.destinations.empty())
|
||||
{
|
||||
destinations_string = builder.CreateString(step.destinations);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> exists_string;
|
||||
if (!step.exits.empty())
|
||||
{
|
||||
exists_string = builder.CreateString(step.exits);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::String> rotary_name_string;
|
||||
flatbuffers::Offset<flatbuffers::String> rotary_pronunciation_string;
|
||||
if (!step.rotary_name.empty())
|
||||
{
|
||||
rotary_name_string = builder.CreateString(step.rotary_name);
|
||||
if (!step.rotary_pronunciation.empty())
|
||||
{
|
||||
rotary_pronunciation_string = builder.CreateString(step.rotary_pronunciation);
|
||||
}
|
||||
}
|
||||
auto mode_string = builder.CreateString(extractor::travelModeToString(step.mode));
|
||||
|
||||
// Geometry
|
||||
auto geometry = MakeGeometry(builder,
|
||||
leg_geometry.locations.begin() + step.geometry_begin,
|
||||
leg_geometry.locations.begin() + step.geometry_end);
|
||||
// Maneuver
|
||||
fbresult::StepManeuverBuilder maneuver(builder);
|
||||
fbresult::Position maneuverPosition{
|
||||
static_cast<float>(util::toFloating(step.maneuver.location.lon).__value),
|
||||
static_cast<float>(util::toFloating(step.maneuver.location.lat).__value)};
|
||||
maneuver.add_location(&maneuverPosition);
|
||||
maneuver.add_bearing_before(step.maneuver.bearing_before);
|
||||
maneuver.add_bearing_after(step.maneuver.bearing_after);
|
||||
if (step.maneuver.waypoint_type == guidance::WaypointType::None)
|
||||
maneuver.add_type(TurnTypeToFB(step.maneuver.instruction.type));
|
||||
else
|
||||
maneuver.add_type(WaypointTypeToFB(step.maneuver.waypoint_type));
|
||||
if (osrm::engine::api::json::detail::isValidModifier(step.maneuver))
|
||||
{
|
||||
maneuver.add_modifier(TurnModifierToFB(step.maneuver.instruction.direction_modifier));
|
||||
}
|
||||
if (step.maneuver.exit != 0)
|
||||
{
|
||||
maneuver.add_exit(step.maneuver.exit);
|
||||
}
|
||||
auto maneuver_buffer = maneuver.Finish();
|
||||
|
||||
// intersections
|
||||
auto intersections_vector = MakeFBIntersections(builder, step);
|
||||
|
||||
fbresult::StepBuilder stepBuilder(builder);
|
||||
stepBuilder.add_duration(step.duration);
|
||||
stepBuilder.add_distance(step.distance);
|
||||
stepBuilder.add_weight(step.weight);
|
||||
stepBuilder.add_name(name_string);
|
||||
stepBuilder.add_mode(mode_string);
|
||||
stepBuilder.add_driving_side(step.is_left_hand_driving);
|
||||
stepBuilder.add_ref(ref_string);
|
||||
stepBuilder.add_pronunciation(pronunciation_string);
|
||||
stepBuilder.add_destinations(destinations_string);
|
||||
stepBuilder.add_exits(exists_string);
|
||||
stepBuilder.add_rotary_name(rotary_name_string);
|
||||
stepBuilder.add_rotary_pronunciation(rotary_pronunciation_string);
|
||||
stepBuilder.add_intersections(intersections_vector);
|
||||
stepBuilder.add_maneuver(maneuver_buffer);
|
||||
mapbox::util::apply_visitor(GeometryVisitor<fbresult::StepBuilder>(stepBuilder), geometry);
|
||||
return stepBuilder.Finish();
|
||||
};
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Intersection>>>
|
||||
MakeFBIntersections(flatbuffers::FlatBufferBuilder &fb_result,
|
||||
const guidance::RouteStep &step) const
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Intersection>> intersections;
|
||||
intersections.resize(step.intersections.size());
|
||||
std::transform(
|
||||
step.intersections.begin(),
|
||||
step.intersections.end(),
|
||||
intersections.begin(),
|
||||
[&fb_result, this](const guidance::IntermediateIntersection &intersection) {
|
||||
std::vector<flatbuffers::Offset<fbresult::Lane>> lanes;
|
||||
if (json::detail::hasValidLanes(intersection))
|
||||
{
|
||||
BOOST_ASSERT(intersection.lanes.lanes_in_turn >= 1);
|
||||
lanes.reserve(intersection.lane_description.size());
|
||||
LaneID lane_id = intersection.lane_description.size();
|
||||
|
||||
for (const auto &lane_desc : intersection.lane_description)
|
||||
{
|
||||
--lane_id;
|
||||
auto indications = TurnLaneTypeToFB(lane_desc);
|
||||
|
||||
auto lane_valid = lane_id >= intersection.lanes.first_lane_from_the_right &&
|
||||
lane_id < intersection.lanes.first_lane_from_the_right +
|
||||
intersection.lanes.lanes_in_turn;
|
||||
lanes.push_back(
|
||||
fbresult::CreateLaneDirect(fb_result, &indications, lane_valid));
|
||||
}
|
||||
}
|
||||
auto lanes_vector = fb_result.CreateVector(lanes);
|
||||
|
||||
fbresult::Position maneuverPosition{
|
||||
static_cast<float>(util::toFloating(intersection.location.lon).__value),
|
||||
static_cast<float>(util::toFloating(intersection.location.lat).__value)};
|
||||
auto bearings_vector = fb_result.CreateVector(intersection.bearings);
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> classes;
|
||||
classes.resize(intersection.classes.size());
|
||||
std::transform(
|
||||
intersection.classes.begin(),
|
||||
intersection.classes.end(),
|
||||
classes.begin(),
|
||||
[&fb_result](const std::string cls) { return fb_result.CreateString(cls); });
|
||||
auto classes_vector = fb_result.CreateVector(classes);
|
||||
auto entry_vector = fb_result.CreateVector(intersection.entry);
|
||||
|
||||
fbresult::IntersectionBuilder intersectionBuilder(fb_result);
|
||||
intersectionBuilder.add_location(&maneuverPosition);
|
||||
intersectionBuilder.add_bearings(bearings_vector);
|
||||
intersectionBuilder.add_classes(classes_vector);
|
||||
intersectionBuilder.add_entry(entry_vector);
|
||||
intersectionBuilder.add_in_bearing(intersection.in);
|
||||
intersectionBuilder.add_out_bearing(intersection.out);
|
||||
intersectionBuilder.add_lanes(lanes_vector);
|
||||
return intersectionBuilder.Finish();
|
||||
});
|
||||
return fb_result.CreateVector(intersections);
|
||||
}
|
||||
|
||||
util::json::Object MakeRoute(const std::vector<PhantomNodes> &segment_end_coordinates,
|
||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||
const std::vector<bool> &source_traversed_in_reverse,
|
||||
const std::vector<bool> &target_traversed_in_reverse) const
|
||||
{
|
||||
std::vector<guidance::RouteLeg> legs;
|
||||
std::vector<guidance::LegGeometry> leg_geometries;
|
||||
auto number_of_legs = segment_end_coordinates.size();
|
||||
legs.reserve(number_of_legs);
|
||||
leg_geometries.reserve(number_of_legs);
|
||||
|
||||
for (auto idx : util::irange<std::size_t>(0UL, number_of_legs))
|
||||
{
|
||||
const auto &phantoms = segment_end_coordinates[idx];
|
||||
const auto &path_data = unpacked_path_segments[idx];
|
||||
|
||||
const bool reversed_source = source_traversed_in_reverse[idx];
|
||||
const bool reversed_target = target_traversed_in_reverse[idx];
|
||||
|
||||
auto leg_geometry = guidance::assembleGeometry(BaseAPI::facade,
|
||||
path_data,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom,
|
||||
reversed_source,
|
||||
reversed_target);
|
||||
auto leg = guidance::assembleLeg(facade,
|
||||
path_data,
|
||||
leg_geometry,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom,
|
||||
reversed_target,
|
||||
parameters.steps);
|
||||
|
||||
util::Log(logDEBUG) << "Assembling steps " << std::endl;
|
||||
if (parameters.steps)
|
||||
{
|
||||
auto steps = guidance::assembleSteps(BaseAPI::facade,
|
||||
path_data,
|
||||
leg_geometry,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom,
|
||||
reversed_source,
|
||||
reversed_target);
|
||||
|
||||
// Apply maneuver overrides before any other post
|
||||
// processing is performed
|
||||
guidance::applyOverrides(BaseAPI::facade, steps, leg_geometry);
|
||||
|
||||
// Collapse segregated steps before others
|
||||
steps = guidance::collapseSegregatedTurnInstructions(std::move(steps));
|
||||
|
||||
/* Perform step-based post-processing.
|
||||
*
|
||||
* Using post-processing on basis of route-steps for a single leg at a time
|
||||
* comes at the cost that we cannot count the correct exit for roundabouts.
|
||||
* We can only emit the exit nr/intersections up to/starting at a part of the leg.
|
||||
* If a roundabout is not terminated in a leg, we will end up with a
|
||||
*enter-roundabout
|
||||
* and exit-roundabout-nr where the exit nr is out of sync with the previous enter.
|
||||
*
|
||||
* | S |
|
||||
* * *
|
||||
* ----* * ----
|
||||
* T
|
||||
* ----* * ----
|
||||
* V * *
|
||||
* | |
|
||||
* | |
|
||||
*
|
||||
* Coming from S via V to T, we end up with the legs S->V and V->T. V-T will say to
|
||||
*take
|
||||
* the second exit, even though counting from S it would be the third.
|
||||
* For S, we only emit `roundabout` without an exit number, showing that we enter a
|
||||
*roundabout
|
||||
* to find a via point.
|
||||
* The same exit will be emitted, though, if we should start routing at S, making
|
||||
* the overall response consistent.
|
||||
*
|
||||
* ⚠ CAUTION: order of post-processing steps is important
|
||||
* - handleRoundabouts must be called before collapseTurnInstructions that
|
||||
* expects post-processed roundabouts
|
||||
*/
|
||||
|
||||
guidance::trimShortSegments(steps, leg_geometry);
|
||||
leg.steps = guidance::handleRoundabouts(std::move(steps));
|
||||
leg.steps = guidance::collapseTurnInstructions(std::move(leg.steps));
|
||||
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
|
||||
leg.steps = guidance::buildIntersections(std::move(leg.steps));
|
||||
leg.steps = guidance::suppressShortNameSegments(std::move(leg.steps));
|
||||
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps),
|
||||
leg_geometry,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom);
|
||||
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
|
||||
}
|
||||
|
||||
leg_geometries.push_back(std::move(leg_geometry));
|
||||
legs.push_back(std::move(leg));
|
||||
}
|
||||
auto legs_info = MakeLegs(segment_end_coordinates,
|
||||
unpacked_path_segments,
|
||||
source_traversed_in_reverse,
|
||||
target_traversed_in_reverse);
|
||||
std::vector<guidance::RouteLeg> legs = legs_info.first;
|
||||
std::vector<guidance::LegGeometry> leg_geometries = legs_info.second;
|
||||
|
||||
auto route = guidance::assembleRoute(legs);
|
||||
boost::optional<util::json::Value> json_overview;
|
||||
if (parameters.overview != RouteParameters::OverviewType::False)
|
||||
{
|
||||
const auto use_simplification =
|
||||
parameters.overview == RouteParameters::OverviewType::Simplified;
|
||||
BOOST_ASSERT(use_simplification ||
|
||||
parameters.overview == RouteParameters::OverviewType::Full);
|
||||
|
||||
auto overview = guidance::assembleOverview(leg_geometries, use_simplification);
|
||||
json_overview = MakeGeometry(overview.begin(), overview.end());
|
||||
}
|
||||
boost::optional<util::json::Value> json_overview =
|
||||
MakeGeometry(MakeOverview(leg_geometries));
|
||||
|
||||
std::vector<util::json::Value> step_geometries;
|
||||
const auto total_step_count =
|
||||
@@ -357,10 +865,131 @@ class RouteAPI : public BaseAPI
|
||||
}
|
||||
|
||||
const RouteParameters ¶meters;
|
||||
|
||||
std::pair<std::vector<guidance::RouteLeg>, std::vector<guidance::LegGeometry>>
|
||||
MakeLegs(const std::vector<PhantomNodes> &segment_end_coordinates,
|
||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||
const std::vector<bool> &source_traversed_in_reverse,
|
||||
const std::vector<bool> &target_traversed_in_reverse) const
|
||||
{
|
||||
auto result =
|
||||
std::make_pair(std::vector<guidance::RouteLeg>(), std::vector<guidance::LegGeometry>());
|
||||
auto &legs = result.first;
|
||||
auto &leg_geometries = result.second;
|
||||
auto number_of_legs = segment_end_coordinates.size();
|
||||
legs.reserve(number_of_legs);
|
||||
leg_geometries.reserve(number_of_legs);
|
||||
|
||||
for (auto idx : util::irange<std::size_t>(0UL, number_of_legs))
|
||||
{
|
||||
const auto &phantoms = segment_end_coordinates[idx];
|
||||
const auto &path_data = unpacked_path_segments[idx];
|
||||
|
||||
const bool reversed_source = source_traversed_in_reverse[idx];
|
||||
const bool reversed_target = target_traversed_in_reverse[idx];
|
||||
|
||||
auto leg_geometry = guidance::assembleGeometry(BaseAPI::facade,
|
||||
path_data,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom,
|
||||
reversed_source,
|
||||
reversed_target);
|
||||
auto leg = guidance::assembleLeg(facade,
|
||||
path_data,
|
||||
leg_geometry,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom,
|
||||
reversed_target,
|
||||
parameters.steps);
|
||||
|
||||
util::Log(logDEBUG) << "Assembling steps " << std::endl;
|
||||
if (parameters.steps)
|
||||
{
|
||||
auto steps = guidance::assembleSteps(BaseAPI::facade,
|
||||
path_data,
|
||||
leg_geometry,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom,
|
||||
reversed_source,
|
||||
reversed_target);
|
||||
|
||||
// Apply maneuver overrides before any other post
|
||||
// processing is performed
|
||||
guidance::applyOverrides(BaseAPI::facade, steps, leg_geometry);
|
||||
|
||||
// Collapse segregated steps before others
|
||||
steps = guidance::collapseSegregatedTurnInstructions(std::move(steps));
|
||||
|
||||
/* Perform step-based post-processing.
|
||||
*
|
||||
* Using post-processing on basis of route-steps for a single leg at a time
|
||||
* comes at the cost that we cannot count the correct exit for roundabouts.
|
||||
* We can only emit the exit nr/intersections up to/starting at a part of the leg.
|
||||
* If a roundabout is not terminated in a leg, we will end up with a
|
||||
*enter-roundabout
|
||||
* and exit-roundabout-nr where the exit nr is out of sync with the previous enter.
|
||||
*
|
||||
* | S |
|
||||
* * *
|
||||
* ----* * ----
|
||||
* T
|
||||
* ----* * ----
|
||||
* V * *
|
||||
* | |
|
||||
* | |
|
||||
*
|
||||
* Coming from S via V to T, we end up with the legs S->V and V->T. V-T will say to
|
||||
*take
|
||||
* the second exit, even though counting from S it would be the third.
|
||||
* For S, we only emit `roundabout` without an exit number, showing that we enter a
|
||||
*roundabout
|
||||
* to find a via point.
|
||||
* The same exit will be emitted, though, if we should start routing at S, making
|
||||
* the overall response consistent.
|
||||
*
|
||||
* ⚠ CAUTION: order of post-processing steps is important
|
||||
* - handleRoundabouts must be called before collapseTurnInstructions that
|
||||
* expects post-processed roundabouts
|
||||
*/
|
||||
|
||||
guidance::trimShortSegments(steps, leg_geometry);
|
||||
leg.steps = guidance::handleRoundabouts(std::move(steps));
|
||||
leg.steps = guidance::collapseTurnInstructions(std::move(leg.steps));
|
||||
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
|
||||
leg.steps = guidance::buildIntersections(std::move(leg.steps));
|
||||
leg.steps = guidance::suppressShortNameSegments(std::move(leg.steps));
|
||||
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps),
|
||||
leg_geometry,
|
||||
phantoms.source_phantom,
|
||||
phantoms.target_phantom);
|
||||
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
|
||||
}
|
||||
|
||||
leg_geometries.push_back(std::move(leg_geometry));
|
||||
legs.push_back(std::move(leg));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
boost::optional<std::vector<Coordinate>>
|
||||
MakeOverview(const std::vector<guidance::LegGeometry> &leg_geometries) const
|
||||
{
|
||||
boost::optional<std::vector<Coordinate>> overview;
|
||||
if (parameters.overview != RouteParameters::OverviewType::False)
|
||||
{
|
||||
const auto use_simplification =
|
||||
parameters.overview == RouteParameters::OverviewType::Simplified;
|
||||
BOOST_ASSERT(use_simplification ||
|
||||
parameters.overview == RouteParameters::OverviewType::Full);
|
||||
|
||||
overview = guidance::assembleOverview(leg_geometries, use_simplification);
|
||||
}
|
||||
return overview;
|
||||
}
|
||||
};
|
||||
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -87,18 +87,13 @@ struct RouteParameters : public BaseParameters
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
Args... args_)
|
||||
Args &&... args_)
|
||||
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one
|
||||
// below.
|
||||
: BaseParameters{std::forward<Args>(args_)...},
|
||||
steps{steps_},
|
||||
alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u},
|
||||
annotations{false},
|
||||
annotations_type{AnnotationsType::None},
|
||||
geometries{geometries_},
|
||||
overview{overview_},
|
||||
continue_straight{continue_straight_}
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{false},
|
||||
annotations_type{AnnotationsType::None}, geometries{geometries_}, overview{overview_},
|
||||
continue_straight{continue_straight_}, waypoints()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,11 +105,13 @@ struct RouteParameters : public BaseParameters
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
Args... args_)
|
||||
Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
||||
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
|
||||
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}
|
||||
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
|
||||
waypoints()
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
@@ -126,12 +123,48 @@ struct RouteParameters : public BaseParameters
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
Args... args_)
|
||||
Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u},
|
||||
annotations{annotations_ == AnnotationsType::None ? false : true},
|
||||
annotations{annotations_ != AnnotationsType::None}, annotations_type{annotations_},
|
||||
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
|
||||
waypoints()
|
||||
{
|
||||
}
|
||||
|
||||
// RouteParameters constructor adding the `waypoints` parameter
|
||||
template <typename... Args>
|
||||
RouteParameters(const bool steps_,
|
||||
const bool alternatives_,
|
||||
const bool annotations_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
std::vector<std::size_t> waypoints_,
|
||||
const Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
||||
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
|
||||
geometries{geometries_}, overview{overview_},
|
||||
continue_straight{continue_straight_}, waypoints{std::move(waypoints_)}
|
||||
{
|
||||
}
|
||||
|
||||
// RouteParameters constructor adding the `waypoints` parameter
|
||||
template <typename... Args>
|
||||
RouteParameters(const bool steps_,
|
||||
const bool alternatives_,
|
||||
const AnnotationsType annotations_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
std::vector<std::size_t> waypoints_,
|
||||
Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_ !=
|
||||
AnnotationsType::None},
|
||||
annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
|
||||
continue_straight{continue_straight_}
|
||||
continue_straight{continue_straight_}, waypoints{std::move(waypoints_)}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -144,12 +177,17 @@ struct RouteParameters : public BaseParameters
|
||||
GeometriesType geometries = GeometriesType::Polyline;
|
||||
OverviewType overview = OverviewType::Simplified;
|
||||
boost::optional<bool> continue_straight;
|
||||
std::vector<std::size_t> waypoints;
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
const auto coordinates_ok = coordinates.size() >= 2;
|
||||
const auto base_params_ok = BaseParameters::IsValid();
|
||||
return coordinates_ok && base_params_ok;
|
||||
const auto valid_waypoints =
|
||||
std::all_of(waypoints.begin(), waypoints.end(), [this](const auto &w) {
|
||||
return w < coordinates.size();
|
||||
});
|
||||
return coordinates_ok && base_params_ok && valid_waypoints;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -173,8 +211,8 @@ inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsT
|
||||
{
|
||||
return lhs = lhs | rhs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define ENGINE_API_TABLE_HPP
|
||||
|
||||
#include "engine/api/base_api.hpp"
|
||||
#include "engine/api/base_result.hpp"
|
||||
#include "engine/api/json_factory.hpp"
|
||||
#include "engine/api/table_parameters.hpp"
|
||||
|
||||
@@ -31,6 +32,15 @@ namespace api
|
||||
class TableAPI final : public BaseAPI
|
||||
{
|
||||
public:
|
||||
struct TableCellRef
|
||||
{
|
||||
TableCellRef(const std::size_t &row, const std::size_t &column) : row{row}, column{column}
|
||||
{
|
||||
}
|
||||
std::size_t row;
|
||||
std::size_t column;
|
||||
};
|
||||
|
||||
TableAPI(const datafacade::BaseDataFacade &facade_, const TableParameters ¶meters_)
|
||||
: BaseAPI(facade_, parameters_), parameters(parameters_)
|
||||
{
|
||||
@@ -39,6 +49,127 @@ class TableAPI final : public BaseAPI
|
||||
virtual void
|
||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||
osrm::engine::api::ResultT &response) const
|
||||
{
|
||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||
{
|
||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||
MakeResponse(tables, phantoms, fallback_speed_cells, fb_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &json_result = response.get<util::json::Object>();
|
||||
MakeResponse(tables, phantoms, fallback_speed_cells, json_result);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void
|
||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto number_of_sources = parameters.sources.size();
|
||||
auto number_of_destinations = parameters.destinations.size();
|
||||
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
}
|
||||
|
||||
// symmetric case
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>> sources;
|
||||
if (parameters.sources.empty())
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
sources = MakeWaypoints(fb_result, phantoms);
|
||||
}
|
||||
number_of_sources = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
sources = MakeWaypoints(fb_result, phantoms, parameters.sources);
|
||||
}
|
||||
}
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
destinations;
|
||||
if (parameters.destinations.empty())
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
destinations = MakeWaypoints(fb_result, phantoms);
|
||||
}
|
||||
number_of_destinations = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
destinations = MakeWaypoints(fb_result, phantoms, parameters.destinations);
|
||||
}
|
||||
}
|
||||
|
||||
bool use_durations = parameters.annotations & TableParameters::AnnotationsType::Duration;
|
||||
flatbuffers::Offset<flatbuffers::Vector<float>> durations;
|
||||
if (use_durations)
|
||||
{
|
||||
durations = MakeDurationTable(fb_result, tables.first);
|
||||
}
|
||||
|
||||
bool use_distances = parameters.annotations & TableParameters::AnnotationsType::Distance;
|
||||
flatbuffers::Offset<flatbuffers::Vector<float>> distances;
|
||||
if (use_distances)
|
||||
{
|
||||
distances = MakeDistanceTable(fb_result, tables.second);
|
||||
}
|
||||
|
||||
bool have_speed_cells =
|
||||
parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0;
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint32_t>> speed_cells;
|
||||
if (have_speed_cells)
|
||||
{
|
||||
speed_cells = MakeEstimatesTable(fb_result, fallback_speed_cells);
|
||||
}
|
||||
|
||||
fbresult::TableBuilder table(fb_result);
|
||||
table.add_destinations(destinations);
|
||||
table.add_rows(number_of_sources);
|
||||
table.add_cols(number_of_destinations);
|
||||
if (use_durations)
|
||||
{
|
||||
table.add_durations(durations);
|
||||
}
|
||||
if (use_distances)
|
||||
{
|
||||
table.add_distances(distances);
|
||||
}
|
||||
if (have_speed_cells)
|
||||
{
|
||||
table.add_fallback_speed_cells(speed_cells);
|
||||
}
|
||||
auto table_buffer = table.Finish();
|
||||
|
||||
fbresult::FBResultBuilder response(fb_result);
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response.add_data_version(data_version_string);
|
||||
}
|
||||
response.add_table(table_buffer);
|
||||
response.add_waypoints(sources);
|
||||
fb_result.Finish(response.Finish());
|
||||
}
|
||||
|
||||
virtual void
|
||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||
util::json::Object &response) const
|
||||
{
|
||||
auto number_of_sources = parameters.sources.size();
|
||||
@@ -47,22 +178,34 @@ class TableAPI final : public BaseAPI
|
||||
// symmetric case
|
||||
if (parameters.sources.empty())
|
||||
{
|
||||
response.values["sources"] = MakeWaypoints(phantoms);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["sources"] = MakeWaypoints(phantoms);
|
||||
}
|
||||
number_of_sources = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
response.values["sources"] = MakeWaypoints(phantoms, parameters.sources);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["sources"] = MakeWaypoints(phantoms, parameters.sources);
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters.destinations.empty())
|
||||
{
|
||||
response.values["destinations"] = MakeWaypoints(phantoms);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["destinations"] = MakeWaypoints(phantoms);
|
||||
}
|
||||
number_of_destinations = phantoms.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
response.values["destinations"] = MakeWaypoints(phantoms, parameters.destinations);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["destinations"] = MakeWaypoints(phantoms, parameters.destinations);
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters.annotations & TableParameters::AnnotationsType::Duration)
|
||||
@@ -77,10 +220,94 @@ class TableAPI final : public BaseAPI
|
||||
MakeDistanceTable(tables.second, number_of_sources, number_of_destinations);
|
||||
}
|
||||
|
||||
if (parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0)
|
||||
{
|
||||
response.values["fallback_speed_cells"] = MakeEstimatesTable(fallback_speed_cells);
|
||||
}
|
||||
|
||||
response.values["code"] = "Ok";
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||
const std::vector<PhantomNode> &phantoms) const
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.reserve(phantoms.size());
|
||||
BOOST_ASSERT(phantoms.size() == parameters.coordinates.size());
|
||||
|
||||
boost::range::transform(
|
||||
phantoms, std::back_inserter(waypoints), [this, &builder](const PhantomNode &phantom) {
|
||||
return BaseAPI::MakeWaypoint(&builder, phantom)->Finish();
|
||||
});
|
||||
return builder.CreateVector(waypoints);
|
||||
}
|
||||
|
||||
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
const std::vector<std::size_t> &indices) const
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.reserve(indices.size());
|
||||
boost::range::transform(indices,
|
||||
std::back_inserter(waypoints),
|
||||
[this, &builder, phantoms](const std::size_t idx) {
|
||||
BOOST_ASSERT(idx < phantoms.size());
|
||||
return BaseAPI::MakeWaypoint(&builder, phantoms[idx])->Finish();
|
||||
});
|
||||
return builder.CreateVector(waypoints);
|
||||
}
|
||||
|
||||
virtual flatbuffers::Offset<flatbuffers::Vector<float>>
|
||||
MakeDurationTable(flatbuffers::FlatBufferBuilder &builder,
|
||||
const std::vector<EdgeWeight> &values) const
|
||||
{
|
||||
std::vector<float> distance_table;
|
||||
distance_table.resize(values.size());
|
||||
std::transform(
|
||||
values.begin(), values.end(), distance_table.begin(), [](const EdgeWeight duration) {
|
||||
if (duration == MAXIMAL_EDGE_DURATION)
|
||||
{
|
||||
return 0.;
|
||||
}
|
||||
return duration / 10.;
|
||||
});
|
||||
return builder.CreateVector(distance_table);
|
||||
}
|
||||
|
||||
virtual flatbuffers::Offset<flatbuffers::Vector<float>>
|
||||
MakeDistanceTable(flatbuffers::FlatBufferBuilder &builder,
|
||||
const std::vector<EdgeDistance> &values) const
|
||||
{
|
||||
std::vector<float> duration_table;
|
||||
duration_table.resize(values.size());
|
||||
std::transform(
|
||||
values.begin(), values.end(), duration_table.begin(), [](const EdgeDistance distance) {
|
||||
if (distance == INVALID_EDGE_DISTANCE)
|
||||
{
|
||||
return 0.;
|
||||
}
|
||||
return std::round(distance * 10) / 10.;
|
||||
});
|
||||
return builder.CreateVector(duration_table);
|
||||
}
|
||||
|
||||
virtual flatbuffers::Offset<flatbuffers::Vector<uint32_t>>
|
||||
MakeEstimatesTable(flatbuffers::FlatBufferBuilder &builder,
|
||||
const std::vector<TableCellRef> &fallback_speed_cells) const
|
||||
{
|
||||
std::vector<uint32_t> fb_table;
|
||||
fb_table.reserve(fallback_speed_cells.size());
|
||||
std::for_each(
|
||||
fallback_speed_cells.begin(), fallback_speed_cells.end(), [&](const auto &cell) {
|
||||
fb_table.push_back(cell.row);
|
||||
fb_table.push_back(cell.column);
|
||||
});
|
||||
return builder.CreateVector(fb_table);
|
||||
}
|
||||
|
||||
virtual util::json::Array MakeWaypoints(const std::vector<PhantomNode> &phantoms) const
|
||||
{
|
||||
util::json::Array json_waypoints;
|
||||
@@ -163,11 +390,25 @@ class TableAPI final : public BaseAPI
|
||||
return json_table;
|
||||
}
|
||||
|
||||
virtual util::json::Array
|
||||
MakeEstimatesTable(const std::vector<TableCellRef> &fallback_speed_cells) const
|
||||
{
|
||||
util::json::Array json_table;
|
||||
std::for_each(
|
||||
fallback_speed_cells.begin(), fallback_speed_cells.end(), [&](const auto &cell) {
|
||||
util::json::Array row;
|
||||
row.values.push_back(util::json::Number(cell.row));
|
||||
row.values.push_back(util::json::Number(cell.column));
|
||||
json_table.values.push_back(std::move(row));
|
||||
});
|
||||
return json_table;
|
||||
}
|
||||
|
||||
const TableParameters ¶meters;
|
||||
};
|
||||
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,6 +59,15 @@ struct TableParameters : public BaseParameters
|
||||
{
|
||||
std::vector<std::size_t> sources;
|
||||
std::vector<std::size_t> destinations;
|
||||
double fallback_speed = INVALID_FALLBACK_SPEED;
|
||||
|
||||
enum class FallbackCoordinateType
|
||||
{
|
||||
Input = 0,
|
||||
Snapped = 1
|
||||
};
|
||||
|
||||
FallbackCoordinateType fallback_coordinate_type = FallbackCoordinateType::Input;
|
||||
|
||||
enum class AnnotationsType
|
||||
{
|
||||
@@ -70,11 +79,13 @@ struct TableParameters : public BaseParameters
|
||||
|
||||
AnnotationsType annotations = AnnotationsType::Duration;
|
||||
|
||||
double scale_factor = 1;
|
||||
|
||||
TableParameters() = default;
|
||||
template <typename... Args>
|
||||
TableParameters(std::vector<std::size_t> sources_,
|
||||
std::vector<std::size_t> destinations_,
|
||||
Args... args_)
|
||||
Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
||||
destinations{std::move(destinations_)}
|
||||
{
|
||||
@@ -84,31 +95,40 @@ struct TableParameters : public BaseParameters
|
||||
TableParameters(std::vector<std::size_t> sources_,
|
||||
std::vector<std::size_t> destinations_,
|
||||
const AnnotationsType annotations_,
|
||||
Args... args_)
|
||||
Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
||||
destinations{std::move(destinations_)}, annotations{annotations_}
|
||||
{
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
TableParameters(std::vector<std::size_t> sources_,
|
||||
std::vector<std::size_t> destinations_,
|
||||
const AnnotationsType annotations_,
|
||||
double fallback_speed_,
|
||||
FallbackCoordinateType fallback_coordinate_type_,
|
||||
double scale_factor_,
|
||||
Args &&... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
|
||||
destinations{std::move(destinations_)}, fallback_speed{fallback_speed_},
|
||||
fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_},
|
||||
scale_factor{scale_factor_}
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
if (!BaseParameters::IsValid())
|
||||
return false;
|
||||
|
||||
// Distance Table makes only sense with 2+ coodinates
|
||||
// Distance Table makes only sense with 2+ coordinates
|
||||
if (coordinates.size() < 2)
|
||||
return false;
|
||||
|
||||
// 1/ The user is able to specify duplicates in srcs and dsts, in that case it's their fault
|
||||
|
||||
// 2/ len(srcs) and len(dsts) smaller or equal to len(locations)
|
||||
if (sources.size() > coordinates.size())
|
||||
return false;
|
||||
|
||||
if (destinations.size() > coordinates.size())
|
||||
return false;
|
||||
|
||||
// 3/ 0 <= index < len(locations)
|
||||
// 2/ 0 <= index < len(locations)
|
||||
const auto not_in_range = [this](const std::size_t x) { return x >= coordinates.size(); };
|
||||
|
||||
if (std::any_of(begin(sources), end(sources), not_in_range))
|
||||
@@ -117,6 +137,12 @@ struct TableParameters : public BaseParameters
|
||||
if (std::any_of(begin(destinations), end(destinations), not_in_range))
|
||||
return false;
|
||||
|
||||
if (fallback_speed <= 0)
|
||||
return false;
|
||||
|
||||
if (scale_factor <= 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -140,8 +166,8 @@ inline TableParameters::AnnotationsType &operator|=(TableParameters::Annotations
|
||||
{
|
||||
return lhs = lhs | rhs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // ENGINE_API_TABLE_PARAMETERS_HPP
|
||||
|
||||
@@ -70,8 +70,8 @@ struct TileParameters final
|
||||
return valid_x && valid_y && valid_z;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
+106
-32
@@ -24,7 +24,47 @@ class TripAPI final : public RouteAPI
|
||||
: RouteAPI(facade_, parameters_), parameters(parameters_)
|
||||
{
|
||||
}
|
||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
osrm::engine::api::ResultT &response) const
|
||||
{
|
||||
BOOST_ASSERT(sub_trips.size() == sub_routes.size());
|
||||
|
||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||
{
|
||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||
MakeResponse(sub_trips, sub_routes, phantoms, fb_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &json_result = response.get<util::json::Object>();
|
||||
MakeResponse(sub_trips, sub_routes, phantoms, json_result);
|
||||
}
|
||||
}
|
||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
flatbuffers::Offset<flatbuffers::String> data_version_string;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
}
|
||||
|
||||
auto response =
|
||||
MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &phantoms]() {
|
||||
return MakeWaypoints(fb_result, sub_trips, phantoms);
|
||||
});
|
||||
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
response->add_data_version(data_version_string);
|
||||
}
|
||||
fb_result.Finish(response->Finish());
|
||||
}
|
||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||
const std::vector<InternalRouteResult> &sub_routes,
|
||||
const std::vector<PhantomNode> &phantoms,
|
||||
@@ -33,7 +73,6 @@ class TripAPI final : public RouteAPI
|
||||
auto number_of_routes = sub_trips.size();
|
||||
util::json::Array routes;
|
||||
routes.values.reserve(number_of_routes);
|
||||
BOOST_ASSERT(sub_trips.size() == sub_routes.size());
|
||||
for (auto index : util::irange<std::size_t>(0UL, sub_trips.size()))
|
||||
{
|
||||
auto route = MakeRoute(sub_routes[index].segment_end_coordinates,
|
||||
@@ -42,7 +81,10 @@ class TripAPI final : public RouteAPI
|
||||
sub_routes[index].target_traversed_in_reverse);
|
||||
routes.values.push_back(std::move(route));
|
||||
}
|
||||
response.values["waypoints"] = MakeWaypoints(sub_trips, phantoms);
|
||||
if (!parameters.skip_waypoints)
|
||||
{
|
||||
response.values["waypoints"] = MakeWaypoints(sub_trips, phantoms);
|
||||
}
|
||||
response.values["trips"] = std::move(routes);
|
||||
response.values["code"] = "Ok";
|
||||
}
|
||||
@@ -50,39 +92,57 @@ class TripAPI final : public RouteAPI
|
||||
protected:
|
||||
// FIXME this logic is a little backwards. We should change the output format of the
|
||||
// trip plugin routing algorithm to be easier to consume here.
|
||||
|
||||
struct TripIndex
|
||||
{
|
||||
TripIndex() = default;
|
||||
|
||||
TripIndex(unsigned sub_trip_index_, unsigned point_index_)
|
||||
: sub_trip_index(sub_trip_index_), point_index(point_index_)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned sub_trip_index = std::numeric_limits<unsigned>::max();
|
||||
unsigned point_index = std::numeric_limits<unsigned>::max();
|
||||
|
||||
bool NotUsed()
|
||||
{
|
||||
return sub_trip_index == std::numeric_limits<unsigned>::max() &&
|
||||
point_index == std::numeric_limits<unsigned>::max();
|
||||
}
|
||||
};
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &fb_result,
|
||||
const std::vector<std::vector<NodeID>> &sub_trips,
|
||||
const std::vector<PhantomNode> &phantoms) const
|
||||
{
|
||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||
waypoints.reserve(parameters.coordinates.size());
|
||||
|
||||
auto input_idx_to_trip_idx = MakeTripIndices(sub_trips);
|
||||
|
||||
for (auto input_index : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
|
||||
{
|
||||
auto trip_index = input_idx_to_trip_idx[input_index];
|
||||
BOOST_ASSERT(!trip_index.NotUsed());
|
||||
|
||||
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, phantoms[input_index]);
|
||||
waypoint->add_waypoint_index(trip_index.point_index);
|
||||
waypoint->add_trips_index(trip_index.sub_trip_index);
|
||||
waypoints.push_back(waypoint->Finish());
|
||||
}
|
||||
|
||||
return fb_result.CreateVector(waypoints);
|
||||
}
|
||||
|
||||
util::json::Array MakeWaypoints(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||
const std::vector<PhantomNode> &phantoms) const
|
||||
{
|
||||
util::json::Array waypoints;
|
||||
waypoints.values.reserve(parameters.coordinates.size());
|
||||
|
||||
struct TripIndex
|
||||
{
|
||||
TripIndex() = default;
|
||||
TripIndex(unsigned sub_trip_index_, unsigned point_index_)
|
||||
: sub_trip_index(sub_trip_index_), point_index(point_index_)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned sub_trip_index = std::numeric_limits<unsigned>::max();
|
||||
unsigned point_index = std::numeric_limits<unsigned>::max();
|
||||
|
||||
bool NotUsed()
|
||||
{
|
||||
return sub_trip_index == std::numeric_limits<unsigned>::max() &&
|
||||
point_index == std::numeric_limits<unsigned>::max();
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<TripIndex> input_idx_to_trip_idx(parameters.coordinates.size());
|
||||
for (auto sub_trip_index : util::irange<unsigned>(0u, sub_trips.size()))
|
||||
{
|
||||
for (auto point_index : util::irange<unsigned>(0u, sub_trips[sub_trip_index].size()))
|
||||
{
|
||||
input_idx_to_trip_idx[sub_trips[sub_trip_index][point_index]] =
|
||||
TripIndex{sub_trip_index, point_index};
|
||||
}
|
||||
}
|
||||
auto input_idx_to_trip_idx = MakeTripIndices(sub_trips);
|
||||
|
||||
for (auto input_index : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
|
||||
{
|
||||
@@ -98,11 +158,25 @@ class TripAPI final : public RouteAPI
|
||||
return waypoints;
|
||||
}
|
||||
|
||||
std::vector<TripIndex> MakeTripIndices(const std::vector<std::vector<NodeID>> &sub_trips) const
|
||||
{
|
||||
std::vector<TripIndex> input_idx_to_trip_idx(parameters.coordinates.size());
|
||||
for (auto sub_trip_index : util::irange<unsigned>(0u, sub_trips.size()))
|
||||
{
|
||||
for (auto point_index : util::irange<unsigned>(0u, sub_trips[sub_trip_index].size()))
|
||||
{
|
||||
input_idx_to_trip_idx[sub_trips[sub_trip_index][point_index]] =
|
||||
TripIndex{sub_trip_index, point_index};
|
||||
}
|
||||
}
|
||||
return input_idx_to_trip_idx;
|
||||
}
|
||||
|
||||
const TripParameters ¶meters;
|
||||
};
|
||||
|
||||
} // ns api
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -65,8 +65,8 @@ struct TripParameters : public RouteParameters
|
||||
DestinationType destination_,
|
||||
bool roundtrip_,
|
||||
Args &&... args_)
|
||||
: RouteParameters{std::forward<Args>(args_)...}, source{source_}, destination{destination_},
|
||||
roundtrip{roundtrip_}
|
||||
: RouteParameters{std::forward<Args>(args_)...}, source{source_},
|
||||
destination{destination_}, roundtrip{roundtrip_}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ struct TripParameters : public RouteParameters
|
||||
|
||||
bool IsValid() const { return RouteParameters::IsValid(); }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,5 +42,5 @@ enum class Approach : std::uint8_t
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace osrm
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ using BinaryFromBase64 = boost::archive::iterators::transform_width<
|
||||
8, // get a view of 8 bit
|
||||
6 // from a sequence of 6 bit
|
||||
>;
|
||||
} // ns detail
|
||||
} // namespace detail
|
||||
namespace engine
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ template <typename T> T decodeBase64Bytewise(const std::string &encoded)
|
||||
return x;
|
||||
}
|
||||
|
||||
} // ns engine
|
||||
} // ns osrm
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif /* OSRM_BASE64_HPP */
|
||||
|
||||
@@ -46,7 +46,7 @@ inline bool operator==(const Bearing lhs, const Bearing rhs)
|
||||
return lhs.bearing == rhs.bearing && lhs.range == rhs.range;
|
||||
}
|
||||
inline bool operator!=(const Bearing lhs, const Bearing rhs) { return !(lhs == rhs); }
|
||||
}
|
||||
}
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,11 +56,14 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
|
||||
static_region = *static_shared_region;
|
||||
updatable_region = *updatable_shared_region;
|
||||
|
||||
facade_factory =
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(
|
||||
std::vector<storage::SharedRegionRegister::ShmKey>{
|
||||
static_region.shm_key, updatable_region.shm_key}));
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> swap_lock(factory_mutex);
|
||||
facade_factory =
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(
|
||||
std::vector<storage::SharedRegionRegister::ShmKey>{
|
||||
static_region.shm_key, updatable_region.shm_key}));
|
||||
}
|
||||
}
|
||||
|
||||
watcher = std::thread(&DataWatchdogImpl::Run, this);
|
||||
@@ -75,10 +78,14 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
|
||||
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const
|
||||
{
|
||||
// make sure facade_factory stays stable while we call Get()
|
||||
boost::shared_lock<boost::shared_mutex> swap_lock(factory_mutex);
|
||||
return facade_factory.Get(params);
|
||||
}
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const
|
||||
{
|
||||
// make sure facade_factory stays stable while we call Get()
|
||||
boost::shared_lock<boost::shared_mutex> swap_lock(factory_mutex);
|
||||
return facade_factory.Get(params);
|
||||
}
|
||||
|
||||
@@ -111,16 +118,20 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
|
||||
<< (int)updatable_region.shm_key << " with timestamps "
|
||||
<< static_region.timestamp << " and " << updatable_region.timestamp;
|
||||
|
||||
facade_factory =
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(
|
||||
std::vector<storage::SharedRegionRegister::ShmKey>{
|
||||
static_region.shm_key, updatable_region.shm_key}));
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> swap_lock(factory_mutex);
|
||||
facade_factory =
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(
|
||||
std::vector<storage::SharedRegionRegister::ShmKey>{
|
||||
static_region.shm_key, updatable_region.shm_key}));
|
||||
}
|
||||
}
|
||||
|
||||
util::Log() << "DataWatchdog thread stopped";
|
||||
}
|
||||
|
||||
mutable boost::shared_mutex factory_mutex;
|
||||
const std::string dataset_name;
|
||||
storage::SharedMonitor<storage::SharedRegionRegister> barrier;
|
||||
std::thread watcher;
|
||||
@@ -131,14 +142,14 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
|
||||
storage::SharedRegion *updatable_shared_region;
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT> facade_factory;
|
||||
};
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
// This class monitors the shared memory region that contains the pointers to
|
||||
// the data and layout regions that should be used. This region is updated
|
||||
// once a new dataset arrives.
|
||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
||||
using DataWatchdog = detail::DataWatchdogImpl<AlgorithmT, FacadeT<AlgorithmT>>;
|
||||
}
|
||||
}
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace engine
|
||||
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
|
||||
template <typename AlgorithmT>
|
||||
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||
}
|
||||
}
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user