Merge branch 'Project-OSRM:master' into exceptionForSharedMem
This commit is contained in:
commit
baf1f86ee1
5
.babelrc
5
.babelrc
@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["transform-class-properties"],
|
"plugins": ["transform-class-properties"],
|
||||||
"presets": [
|
"presets": [
|
||||||
"stage-0",
|
"@babel/preset-env",
|
||||||
"es2015",
|
"@babel/preset-react"
|
||||||
"react"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
85
.clang-tidy
85
.clang-tidy
@ -1,4 +1,85 @@
|
|||||||
---
|
---
|
||||||
Checks: '-clang-analyzer-*,google-*,llvm-*,misc-*,readability-*,-google-build-explicit-make-pair,-google-explicit-constructor,-google-readability-braces-around-statements,-google-readability-casting,-google-readability-namespace-comments,-google-readability-function,-google-readability-todo,-google-runtime-int,-llvm-namespace-comment,-llvm-header-guard,-llvm-twine-local,-misc-argument-comment,-readability-braces-around-statements,-readability-identifier-naming'
|
Checks: >
|
||||||
...
|
bugprone-*,
|
||||||
|
-bugprone-narrowing-conversions,
|
||||||
|
-bugprone-easily-swappable-parameters,
|
||||||
|
-bugprone-branch-clone,
|
||||||
|
-bugprone-misplaced-widening-cast,
|
||||||
|
-bugprone-exception-escape,
|
||||||
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
|
-bugprone-integer-division,
|
||||||
|
-bugprone-reserved-identifier,
|
||||||
|
-bugprone-unhandled-self-assignment,
|
||||||
|
-bugprone-forward-declaration-namespace,
|
||||||
|
-bugprone-sizeof-expression,
|
||||||
|
-clang-analyzer-*,
|
||||||
|
-clang-diagnostic-deprecated-declarations,
|
||||||
|
-clang-diagnostic-constant-conversion,
|
||||||
|
cppcoreguidelines-avoid-goto,
|
||||||
|
cppcoreguidelines-no-malloc,
|
||||||
|
cppcoreguidelines-virtual-class-destructor,
|
||||||
|
google-*,
|
||||||
|
-google-build-explicit-make-pair,
|
||||||
|
-google-build-using-namespace,
|
||||||
|
-google-explicit-constructor,
|
||||||
|
-google-default-arguments,
|
||||||
|
-google-readability-braces-around-statements,
|
||||||
|
-google-readability-casting,
|
||||||
|
-google-readability-namespace-comments,
|
||||||
|
-google-readability-function,
|
||||||
|
-google-readability-todo,
|
||||||
|
-google-runtime-int,
|
||||||
|
-google-build-namespaces,
|
||||||
|
-google-runtime-references,
|
||||||
|
-google-readability-function-size,
|
||||||
|
llvm-*,
|
||||||
|
-llvm-namespace-comment,
|
||||||
|
-llvm-qualified-auto,
|
||||||
|
-llvm-include-order,
|
||||||
|
-llvm-else-after-return,
|
||||||
|
-llvm-header-guard,
|
||||||
|
-llvm-twine-local,
|
||||||
|
misc-*,
|
||||||
|
-misc-argument-comment,
|
||||||
|
-misc-non-private-member-variables-in-classes,
|
||||||
|
-misc-unconventional-assign-operator,
|
||||||
|
-misc-no-recursion,
|
||||||
|
-misc-misplaced-const,
|
||||||
|
-misc-definitions-in-headers,
|
||||||
|
-misc-unused-parameters,
|
||||||
|
performance-*,
|
||||||
|
-performance-noexcept-move-constructor,
|
||||||
|
-performance-no-int-to-ptr,
|
||||||
|
readability-*,
|
||||||
|
-readability-avoid-const-params-in-decls,
|
||||||
|
-readability-braces-around-statements,
|
||||||
|
-readability-container-size-empty,
|
||||||
|
-readability-convert-member-functions-to-static,
|
||||||
|
-readability-const-return-type,
|
||||||
|
-readability-function-cognitive-complexity,
|
||||||
|
-readability-function-size,
|
||||||
|
-readability-identifier-naming,
|
||||||
|
-readability-implicit-bool-conversion,
|
||||||
|
-readability-magic-numbers,
|
||||||
|
-readability-else-after-return,
|
||||||
|
-readability-inconsistent-declaration-parameter-name,
|
||||||
|
-readability-isolate-declaration,
|
||||||
|
-readability-redundant-declaration,
|
||||||
|
-readability-uppercase-literal-suffix,
|
||||||
|
-readability-named-parameter,
|
||||||
|
-readability-qualified-auto,
|
||||||
|
-readability-suspicious-call-argument,
|
||||||
|
-readability-redundant-access-specifiers,
|
||||||
|
-readability-redundant-member-init,
|
||||||
|
-readability-static-definition-in-anonymous-namespace,
|
||||||
|
-readability-use-anyofallof,
|
||||||
|
-readability-simplify-boolean-expr,
|
||||||
|
-readability-make-member-function-const,
|
||||||
|
-readability-redundant-string-init,
|
||||||
|
-readability-non-const-parameter,
|
||||||
|
-readability-static-accessed-through-instance
|
||||||
|
|
||||||
|
WarningsAsErrors: '*'
|
||||||
|
HeaderFilterRegex: '.*'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -9,7 +9,7 @@ If your PR is still work in progress please attach the relevant label.
|
|||||||
|
|
||||||
- [ ] CHANGELOG.md entry ([How to write a changelog entry](http://keepachangelog.com/en/1.0.0/#how))
|
- [ ] CHANGELOG.md entry ([How to write a changelog entry](http://keepachangelog.com/en/1.0.0/#how))
|
||||||
- [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki)
|
- [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki)
|
||||||
- [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md)
|
- [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md))
|
||||||
- [ ] review
|
- [ ] review
|
||||||
- [ ] adjust for comments
|
- [ ] adjust for comments
|
||||||
- [ ] cherry pick to release branch
|
- [ ] cherry pick to release branch
|
||||||
|
|||||||
84
.github/workflows/osrm-backend-docker.yml
vendored
Normal file
84
.github/workflows/osrm-backend-docker.yml
vendored
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
name: build and publish container image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
|
- name: Docker meta - debug
|
||||||
|
id: metadebug
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
flavor: |
|
||||||
|
latest=true
|
||||||
|
suffix=-debug,onlatest=true
|
||||||
|
|
||||||
|
- name: Docker meta - assertions
|
||||||
|
id: metaassertions
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
flavor: |
|
||||||
|
latest=true
|
||||||
|
suffix=-assertions,onlatest=true
|
||||||
|
|
||||||
|
- name: Log in to GitHub Docker Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build container image - debug
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
file: ./docker/Dockerfile
|
||||||
|
tags: ${{ steps.metadebug.outputs.tags }}
|
||||||
|
build-args: |
|
||||||
|
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags ) }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build container image - assertions
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
file: ./docker/Dockerfile
|
||||||
|
tags: ${{ steps.metaassertions.outputs.tags }}
|
||||||
|
build-args: |
|
||||||
|
DOCKER_TAG=${{ join(steps.metaassertions.outputs.tags ) }}
|
||||||
|
|
||||||
|
# build and publish "normal" image as last to get it listed on top
|
||||||
|
- name: Build container image - normal
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
file: ./docker/Dockerfile
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
build-args: |
|
||||||
|
DOCKER_TAG=${{ join(steps.meta.outputs.tags ) }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
674
.github/workflows/osrm-backend.yml
vendored
Normal file
674
.github/workflows/osrm-backend.yml
vendored
Normal file
@ -0,0 +1,674 @@
|
|||||||
|
name: osrm-backend CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- v[1-9]+.[0-9]+.[0-9]+
|
||||||
|
- v[1-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+
|
||||||
|
- v[1-9]+.[0-9]+-[0-9a-zA-Z]+
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
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
|
||||||
|
CCACHE_VERSION: 3.3.1
|
||||||
|
CMAKE_VERSION: 3.21.2
|
||||||
|
ENABLE_NODE_BINDINGS: "ON"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
windows:
|
||||||
|
needs: format-taginfo-docs
|
||||||
|
runs-on: windows-2022
|
||||||
|
continue-on-error: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: pip install conan==1.50.0
|
||||||
|
- run: conan --version
|
||||||
|
- run: cmake --version
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- run: node --version
|
||||||
|
- run: npm --version
|
||||||
|
- run: npm install --ignore-scripts
|
||||||
|
- run: npm link --ignore-scripts
|
||||||
|
- uses: microsoft/setup-msbuild@v1.1
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
.\scripts\ci\windows-build.bat
|
||||||
|
|
||||||
|
format-taginfo-docs:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
- name: Enable Node.js cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- name: Prepare environment
|
||||||
|
run: |
|
||||||
|
npm ci --ignore-scripts
|
||||||
|
export MASON=${GITHUB_WORKSPACE}/scripts/mason.sh
|
||||||
|
${MASON} install clang-format 10.0.0
|
||||||
|
echo "$(${MASON} prefix clang-format 10.0.0)/bin" >> $GITHUB_PATH
|
||||||
|
- name: Run checks
|
||||||
|
run: |
|
||||||
|
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
||||||
|
./scripts/format.sh && ./scripts/error_on_dirty.sh
|
||||||
|
node ./scripts/validate_changelog.js
|
||||||
|
npm run docs && ./scripts/error_on_dirty.sh
|
||||||
|
|
||||||
|
docker-image:
|
||||||
|
needs: format-taginfo-docs
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
continue-on-error: false
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Enable osm.pbf cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: berlin-latest.osm.pbf
|
||||||
|
key: v1-berlin-osm-pbf
|
||||||
|
restore-keys: |
|
||||||
|
v1-berlin-osm-pbf
|
||||||
|
- name: Docker build
|
||||||
|
run: |
|
||||||
|
docker build -t osrm-backend-local -f docker/Dockerfile .
|
||||||
|
- name: Test Docker image
|
||||||
|
run: |
|
||||||
|
if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
|
||||||
|
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
|
||||||
|
fi
|
||||||
|
TAG=osrm-backend-local
|
||||||
|
# when `--memory-swap` value equals `--memory` it means container won't use swap
|
||||||
|
# see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
|
||||||
|
MEMORY_ARGS="--memory=1g --memory-swap=1g"
|
||||||
|
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
|
||||||
|
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
|
||||||
|
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
|
||||||
|
docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
|
||||||
|
curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
|
||||||
|
docker stop osrm-container
|
||||||
|
|
||||||
|
build-test-publish:
|
||||||
|
needs: format-taginfo-docs
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: gcc-9-debug-cov
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CCOMPILER: gcc-9
|
||||||
|
CUCUMBER_TIMEOUT: 20000
|
||||||
|
CXXCOMPILER: g++-9
|
||||||
|
ENABLE_COVERAGE: ON
|
||||||
|
|
||||||
|
- name: gcc-9-debug-asan-ubsan
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CCOMPILER: gcc-9
|
||||||
|
CUCUMBER_TIMEOUT: 20000
|
||||||
|
CXXCOMPILER: g++-9
|
||||||
|
ENABLE_SANITIZER: ON
|
||||||
|
TARGET_ARCH: x86_64-asan-ubsan
|
||||||
|
OSRM_CONNECTION_RETRIES: 10
|
||||||
|
OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5
|
||||||
|
|
||||||
|
- name: clang-6.0-debug
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
|
||||||
|
- name: clang-11.0-debug-clang-tidy
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 11.0.0
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_CLANG_TIDY: ON
|
||||||
|
|
||||||
|
- name: conan-linux-debug-asan-ubsan
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 11.0.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
ENABLE_SANITIZER: ON
|
||||||
|
|
||||||
|
- name: conan-linux-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: gcc-11-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-11
|
||||||
|
CXXCOMPILER: g++-11
|
||||||
|
|
||||||
|
- name: gcc-10-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-10
|
||||||
|
CXXCOMPILER: g++-10
|
||||||
|
|
||||||
|
- name: gcc-9-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-9
|
||||||
|
CXXCOMPILER: g++-9
|
||||||
|
CXXFLAGS: -Wno-cast-function-type
|
||||||
|
|
||||||
|
- name: gcc-9-conan-release-i686
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-9
|
||||||
|
CFLAGS: "-m32 -msse2 -mfpmath=sse"
|
||||||
|
CXXCOMPILER: g++-9
|
||||||
|
CXXFLAGS: "-m32 -msse2 -mfpmath=sse"
|
||||||
|
TARGET_ARCH: i686
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: gcc-8-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-8
|
||||||
|
CXXCOMPILER: g++-8
|
||||||
|
CXXFLAGS: -Wno-cast-function-type
|
||||||
|
|
||||||
|
- name: gcc-7-release
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: gcc-7
|
||||||
|
CXXCOMPILER: g++-7
|
||||||
|
|
||||||
|
- name: conan-osx-release-node-12
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: conan-osx-release-node-14
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 14
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: conan-osx-release-node-16
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: gcc-7-release-shared
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TOOLS: ON
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
BUILD_SHARED_LIBS: ON
|
||||||
|
CCOMPILER: gcc-7
|
||||||
|
CXXCOMPILER: g++-7
|
||||||
|
|
||||||
|
- name: node-12-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-12-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 12
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-14-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 14
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-14-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 14
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
|
||||||
|
- name: node-16-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-16-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: false
|
||||||
|
node: 16
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: conan-osx-release-node-latest
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: latest
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: node-latest-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: latest
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-latest-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: latest
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: conan-osx-release-node-lts
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: macos-11
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CCOMPILER: clang
|
||||||
|
CXXCOMPILER: clang++
|
||||||
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_ASSERTIONS: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
|
||||||
|
- name: node-lts-conan-linux-release
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
- name: node-lts-conan-linux-debug
|
||||||
|
build_node_package: true
|
||||||
|
continue-on-error: true
|
||||||
|
node: "lts/*"
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
CLANG_VERSION: 6.0.0
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ON
|
||||||
|
ENABLE_CONAN: ON
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ON
|
||||||
|
|
||||||
|
name: ${{ matrix.name}}
|
||||||
|
continue-on-error: ${{ matrix.continue-on-error }}
|
||||||
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
env:
|
||||||
|
BUILD_TOOLS: ${{ matrix.BUILD_TOOLS }}
|
||||||
|
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
|
||||||
|
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
|
||||||
|
CCOMPILER: ${{ matrix.CCOMPILER }}
|
||||||
|
CFLAGS: ${{ matrix.CFLAGS }}
|
||||||
|
CLANG_VERSION: ${{ matrix.CLANG_VERSION }}
|
||||||
|
CUCUMBER_TIMEOUT: ${{ matrix.CUCUMBER_TIMEOUT }}
|
||||||
|
CXXCOMPILER: ${{ matrix.CXXCOMPILER }}
|
||||||
|
CXXFLAGS: ${{ matrix.CXXFLAGS }}
|
||||||
|
ENABLE_ASSERTIONS: ${{ matrix.ENABLE_ASSERTIONS }}
|
||||||
|
ENABLE_CLANG_TIDY: ${{ matrix.ENABLE_CLANG_TIDY }}
|
||||||
|
ENABLE_COVERAGE: ${{ matrix.ENABLE_COVERAGE }}
|
||||||
|
ENABLE_GLIBC_WORKAROUND: ${{ matrix.ENABLE_GLIBC_WORKAROUND }}
|
||||||
|
ENABLE_CONAN: ${{ matrix.ENABLE_CONAN }}
|
||||||
|
ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }}
|
||||||
|
NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }}
|
||||||
|
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
|
||||||
|
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
|
||||||
|
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
- name: Enable Node.js cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- name: Enable compiler cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.ccache
|
||||||
|
key: ccache-${{ matrix.name }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
ccache-${{ matrix.name }}-
|
||||||
|
- name: Enable Conan cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.conan
|
||||||
|
key: v3-conan-${{ matrix.name }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
v3-conan-${{ matrix.name }}-
|
||||||
|
- name: Enable test cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{github.workspace}}/test/cache
|
||||||
|
key: v3-test-${{ matrix.name }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
v3-test-${{ matrix.name }}-
|
||||||
|
|
||||||
|
- name: Prepare environment
|
||||||
|
run: |
|
||||||
|
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
|
||||||
|
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
|
||||||
|
|
||||||
|
echo "OSRM_INSTALL_DIR=${GITHUB_WORKSPACE}/install-osrm" >> $GITHUB_ENV
|
||||||
|
echo "OSRM_BUILD_DIR=${GITHUB_WORKSPACE}/build-osrm" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
if [[ "$ENABLE_SANITIZER" == 'ON' ]]; then
|
||||||
|
# We can only set this after checkout once we know the workspace directory
|
||||||
|
echo "LSAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV
|
||||||
|
echo "UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1:suppressions=${GITHUB_WORKSPACE}/scripts/ci/undefinedsanitizer.conf" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
||||||
|
echo "JOBS=$((`nproc` + 1))" >> $GITHUB_ENV
|
||||||
|
export MASON_OS=linux
|
||||||
|
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
|
||||||
|
echo "JOBS=$((`sysctl -n hw.ncpu` + 1))" >> $GITHUB_ENV
|
||||||
|
sudo mdutil -i off /
|
||||||
|
export MASON_OS=osx
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "MASON=${GITHUB_WORKSPACE}/scripts/mason.sh" >> $GITHUB_ENV
|
||||||
|
echo "CMAKE_URL=https://mason-binaries.s3.amazonaws.com/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" >> $GITHUB_ENV
|
||||||
|
echo "CMAKE_DIR=mason_packages/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Install dev dependencies
|
||||||
|
run: |
|
||||||
|
python3 -m pip install conan==1.50.0
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
mkdir -p ${CMAKE_DIR}
|
||||||
|
wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}
|
||||||
|
echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
# ccache
|
||||||
|
${MASON} install ccache ${CCACHE_VERSION}
|
||||||
|
echo "$(${MASON} prefix ccache ${CCACHE_VERSION})/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
# clang
|
||||||
|
if [[ -n ${CLANG_VERSION} ]]; then
|
||||||
|
echo "CCOMPILER=clang" >> $GITHUB_ENV
|
||||||
|
echo "CXXCOMPILER=clang++" >> $GITHUB_ENV
|
||||||
|
${MASON} install clang++ ${CLANG_VERSION}
|
||||||
|
echo "$(${MASON} prefix clang++ ${CLANG_VERSION})/bin" >> $GITHUB_PATH
|
||||||
|
# we only enable lto for release builds
|
||||||
|
# and therefore don't need to us ld.gold or llvm tools for linking
|
||||||
|
# for debug builds
|
||||||
|
if [[ ${BUILD_TYPE} == 'Release' ]]; then
|
||||||
|
${MASON} install binutils 2.27
|
||||||
|
echo "$(${MASON} prefix binutils 2.27)/bin" >> $GITHUB_PATH
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Linux dev packages
|
||||||
|
if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then
|
||||||
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
|
||||||
|
if [[ -z "${CLANG_VERSION}" ]]; then
|
||||||
|
sudo apt-get install -y ${CXXCOMPILER}
|
||||||
|
fi
|
||||||
|
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
|
||||||
|
sudo apt-get install -y lcov
|
||||||
|
fi
|
||||||
|
elif [[ $TARGET_ARCH == "i686" ]]; then
|
||||||
|
source ./scripts/ci/before_install.${TARGET_ARCH}.sh
|
||||||
|
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TBB
|
||||||
|
TBB_VERSION=2021.3.0
|
||||||
|
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
||||||
|
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-lin.tgz"
|
||||||
|
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
|
||||||
|
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-mac.tgz"
|
||||||
|
fi
|
||||||
|
wget --tries 5 ${TBB_URL} -O onetbb.tgz
|
||||||
|
tar zxvf onetbb.tgz
|
||||||
|
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
|
||||||
|
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
|
||||||
|
|
||||||
|
- name: Prepare build
|
||||||
|
run: |
|
||||||
|
mkdir ${OSRM_BUILD_DIR}
|
||||||
|
ccache --max-size=256M
|
||||||
|
npm ci --ignore-scripts
|
||||||
|
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
|
||||||
|
lcov --directory . --zerocounters # clean cached files
|
||||||
|
fi
|
||||||
|
echo "CC=${CCOMPILER}" >> $GITHUB_ENV
|
||||||
|
echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build and install OSRM
|
||||||
|
run: |
|
||||||
|
echo "Using ${JOBS} jobs"
|
||||||
|
pushd ${OSRM_BUILD_DIR}
|
||||||
|
|
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||||
|
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
|
||||||
|
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
|
||||||
|
-DENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY:-OFF} \
|
||||||
|
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \
|
||||||
|
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
||||||
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
|
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||||
|
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
||||||
|
-DENABLE_CCACHE=ON \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
||||||
|
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
|
||||||
|
make --jobs=${JOBS}
|
||||||
|
|
||||||
|
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then
|
||||||
|
make tests --jobs=${JOBS}
|
||||||
|
make benchmarks --jobs=${JOBS}
|
||||||
|
ccache -s
|
||||||
|
sudo make install
|
||||||
|
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
||||||
|
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
- name: Build example
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
||||||
|
run: |
|
||||||
|
mkdir example/build && pushd example/build
|
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||||
|
make --jobs=${JOBS}
|
||||||
|
popd
|
||||||
|
|
||||||
|
- name: Run all tests
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
||||||
|
run: |
|
||||||
|
make -C test/data benchmark
|
||||||
|
|
||||||
|
# macOS SIP strips the linker path. Reset this inside the running shell
|
||||||
|
export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}
|
||||||
|
./example/build/osrm-example test/data/mld/monaco.osrm
|
||||||
|
|
||||||
|
# All tests assume to be run from the build directory
|
||||||
|
pushd ${OSRM_BUILD_DIR}
|
||||||
|
for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done
|
||||||
|
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
|
||||||
|
npm run nodejs-tests
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
npm test
|
||||||
|
- name: Run Node package tests only
|
||||||
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
|
||||||
|
run: |
|
||||||
|
npm run nodejs-tests
|
||||||
|
- name: Upload test logs
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: logs
|
||||||
|
path: test/logs/
|
||||||
|
|
||||||
|
- name: Generate code coverage
|
||||||
|
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
||||||
|
run: |
|
||||||
|
lcov --directory . --capture --output-file coverage.info # capture coverage info
|
||||||
|
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
|
||||||
|
lcov --list coverage.info #debug info
|
||||||
|
# Uploading report to CodeCov
|
||||||
|
- name: Upload code coverage
|
||||||
|
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
files: coverage.info
|
||||||
|
name: codecov-osrm-backend
|
||||||
|
fail_ci_if_error: true
|
||||||
|
verbose: true
|
||||||
|
|
||||||
|
- name: Build Node package
|
||||||
|
if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }}
|
||||||
|
run: ./scripts/ci/node_package.sh
|
||||||
|
- name: Publish Node package
|
||||||
|
if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }}
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
allowUpdates: true
|
||||||
|
artifactErrorsFailBuild: true
|
||||||
|
artifacts: build/stage/**/*.tar.gz
|
||||||
|
omitBody: true
|
||||||
|
omitBodyDuringUpdate: true
|
||||||
|
omitName: true
|
||||||
|
omitNameDuringUpdate: true
|
||||||
|
replacesArtifacts: true
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
ci-complete:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: [build-test-publish, docker-image, windows]
|
||||||
|
steps:
|
||||||
|
- run: echo "CI complete"
|
||||||
576
.travis.yml
576
.travis.yml
@ -1,576 +0,0 @@
|
|||||||
language: cpp
|
|
||||||
|
|
||||||
git:
|
|
||||||
depth: 10
|
|
||||||
|
|
||||||
# sudo:required is needed for trusty images
|
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
# enable building tags
|
|
||||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
|
||||||
|
|
||||||
cache:
|
|
||||||
npm: true
|
|
||||||
ccache: true
|
|
||||||
apt: true
|
|
||||||
directories:
|
|
||||||
- test/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
|
|
||||||
- CCACHE_VERSION=3.3.1
|
|
||||||
- CMAKE_VERSION=3.7.2
|
|
||||||
- MASON="$(pwd)/scripts/mason.sh"
|
|
||||||
- ENABLE_NODE_BINDINGS=On
|
|
||||||
- NODE="10"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- core
|
|
||||||
- optional
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
# We override the compiler names here to yield better ccache behavior, which uses this as key
|
|
||||||
include:
|
|
||||||
|
|
||||||
# Debug Builds
|
|
||||||
- stage: core
|
|
||||||
os: linux
|
|
||||||
compiler: "format-taginfo-docs"
|
|
||||||
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 ci --ignore-scripts
|
|
||||||
script:
|
|
||||||
- ./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
|
||||||
- ${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
|
|
||||||
after_success:
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "gcc-7-debug-cov"
|
|
||||||
addons: &gcc7
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'lcov']
|
|
||||||
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
|
|
||||||
before_script:
|
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
|
||||||
- lcov --directory . --zerocounters # clean cached da files
|
|
||||||
after_success:
|
|
||||||
# Creating report
|
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
|
||||||
- lcov --directory . --capture --output-file coverage.info # capture coverage info
|
|
||||||
- lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
|
|
||||||
- lcov --list coverage.info #debug info
|
|
||||||
# Uploading report to CodeCov
|
|
||||||
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "gcc-7-debug-asan"
|
|
||||||
addons: &gcc7
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
|
||||||
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "clang-5.0-debug"
|
|
||||||
addons: &clang50
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
|
||||||
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "mason-linux-debug-asan"
|
|
||||||
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_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
|
|
||||||
|
|
||||||
# Release Builds
|
|
||||||
- os: linux
|
|
||||||
compiler: "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 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
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
|
||||||
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "gcc-7-release-i686"
|
|
||||||
env: >
|
|
||||||
TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
|
|
||||||
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "gcc-5-release"
|
|
||||||
addons: &gcc49
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-5', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
|
|
||||||
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: "gcc-6-release"
|
|
||||||
addons: &gcc49
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
|
|
||||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9.2
|
|
||||||
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="10"
|
|
||||||
after_success:
|
|
||||||
- ./scripts/travis/publish.sh
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9.2
|
|
||||||
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="12"
|
|
||||||
after_success:
|
|
||||||
- ./scripts/travis/publish.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/publish.sh
|
|
||||||
|
|
||||||
# Shared Library
|
|
||||||
- os: linux
|
|
||||||
compiler: "gcc-7-release-shared"
|
|
||||||
addons: &gcc7
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
|
|
||||||
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
|
||||||
|
|
||||||
# Node build jobs. These skip running the tests.
|
|
||||||
- os: linux
|
|
||||||
sudo: false
|
|
||||||
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="14"
|
|
||||||
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/publish.sh
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
sudo: false
|
|
||||||
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="14"
|
|
||||||
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/publish.sh
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
sudo: false
|
|
||||||
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="12"
|
|
||||||
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/publish.sh
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
sudo: false
|
|
||||||
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="12"
|
|
||||||
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/publish.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/publish.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/publish.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/publish.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/publish.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/publish.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/publish.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/publish.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/publish.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
|
|
||||||
- node --version
|
|
||||||
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
|
|
||||||
- |
|
|
||||||
if [[ -z $JOBS ]]; then
|
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
|
||||||
export JOBS=$((`nproc` + 1))
|
|
||||||
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
|
||||||
export JOBS=$((`sysctl -n hw.ncpu` + 1))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
- |
|
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
|
||||||
sudo mdutil -i off /
|
|
||||||
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"
|
|
||||||
- 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}"
|
|
||||||
- mkdir -p ${CMAKE_DIR}
|
|
||||||
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1
|
|
||||||
- export PATH=${CMAKE_DIR}/bin:${PATH}
|
|
||||||
- ${MASON} install tbb 2017_U7 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}
|
|
||||||
- ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH}
|
|
||||||
- |
|
|
||||||
if [[ ! -z ${CLANG_VERSION} ]]; then
|
|
||||||
export CCOMPILER='clang'
|
|
||||||
export CXXCOMPILER='clang++'
|
|
||||||
${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH} || travis_terminate 1
|
|
||||||
# we only enable lto for release builds
|
|
||||||
# and therefore don't need to us ld.gold or llvm tools for linking
|
|
||||||
# for debug builds
|
|
||||||
if [[ ${BUILD_TYPE} == 'Release' ]]; then
|
|
||||||
${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH} || travis_terminate 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
|
|
||||||
- export OSRM_INSTALL_DIR="$(pwd)/install-osrm"
|
|
||||||
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
|
|
||||||
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
|
|
||||||
- mkdir ${OSRM_BUILD_DIR}
|
|
||||||
|
|
||||||
install:
|
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
|
||||||
- |
|
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
|
||||||
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
|
|
||||||
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
|
|
||||||
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \
|
|
||||||
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
|
||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
|
||||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
|
||||||
-DBUILD_TOOLS=ON \
|
|
||||||
-DENABLE_CCACHE=ON \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
|
|
||||||
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
|
|
||||||
- echo "travis_fold:start:MAKE"
|
|
||||||
- make --jobs=${JOBS}
|
|
||||||
- make tests --jobs=${JOBS}
|
|
||||||
- make benchmarks --jobs=${JOBS}
|
|
||||||
- echo "travis_fold:end:MAKE"
|
|
||||||
- ccache -s
|
|
||||||
- sudo make install
|
|
||||||
- |
|
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib
|
|
||||||
fi
|
|
||||||
- popd
|
|
||||||
- mkdir example/build && pushd example/build
|
|
||||||
- export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig
|
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
|
||||||
- make --jobs=${JOBS}
|
|
||||||
- popd
|
|
||||||
|
|
||||||
script:
|
|
||||||
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
|
|
||||||
- make -C test/data benchmark
|
|
||||||
- ./example/build/osrm-example test/data/mld/monaco.osrm
|
|
||||||
# All tests assume to be run from the build directory
|
|
||||||
- pushd ${OSRM_BUILD_DIR}
|
|
||||||
- ./unit_tests/library-tests
|
|
||||||
- ./unit_tests/extractor-tests
|
|
||||||
- ./unit_tests/contractor-tests
|
|
||||||
- ./unit_tests/engine-tests
|
|
||||||
- ./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
|
|
||||||
- npm test
|
|
||||||
76
CHANGELOG.md
76
CHANGELOG.md
@ -1,8 +1,82 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
- Changes from 5.26.0
|
||||||
|
- API:
|
||||||
|
- ADDED: Add Flatbuffers support to NodeJS bindings. [#6338](https://github.com/Project-OSRM/osrm-backend/pull/6338)
|
||||||
|
- CHANGED: Add `data_version` field to responses of all services. [#5387](https://github.com/Project-OSRM/osrm-backend/pull/5387)
|
||||||
|
- FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294)
|
||||||
|
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
|
||||||
|
- FIXED: Fix HTTP compression precedence [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
|
||||||
|
- NodeJS:
|
||||||
|
- FIXED: Support `skip_waypoints` in Node bindings [#6060](https://github.com/Project-OSRM/osrm-backend/pull/6060)
|
||||||
|
- Misc:
|
||||||
|
- CHANGED: Use Lua 5.4 in Docker image. [#6346](https://github.com/Project-OSRM/osrm-backend/pull/6346)
|
||||||
|
- CHANGED: Remove redundant nullptr check. [#6326](https://github.com/Project-OSRM/osrm-backend/pull/6326)
|
||||||
|
- CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360)
|
||||||
|
- CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [#6318](https://github.com/Project-OSRM/osrm-backend/pull/6318)
|
||||||
|
- FIXED: Fix distance calculation consistency. [#6315](https://github.com/Project-OSRM/osrm-backend/pull/6315)
|
||||||
|
- FIXED: Fix performance issue after migration to sol2 3.3.0. [#6304](https://github.com/Project-OSRM/osrm-backend/pull/6304)
|
||||||
|
- CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298)
|
||||||
|
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
|
||||||
|
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)
|
||||||
|
- FIXED: Internal refactoring of identifier types used in data facade [#6044](https://github.com/Project-OSRM/osrm-backend/pull/6044)
|
||||||
|
- Build:
|
||||||
|
- CHANGED: Fix TBB in case of Conan + NodeJS build. [#6333](https://github.com/Project-OSRM/osrm-backend/pull/6333)
|
||||||
|
- CHANGED: Migrate to modern TBB version. [#6300](https://github.com/Project-OSRM/osrm-backend/pull/6300)
|
||||||
|
- CHANGED: Enable performance-move-const-arg clang-tidy check. [#6319](https://github.com/Project-OSRM/osrm-backend/pull/6319)
|
||||||
|
- CHANGED: Use the latest node on CI. [#6317](https://github.com/Project-OSRM/osrm-backend/pull/6317)
|
||||||
|
- CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312)
|
||||||
|
- ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313)
|
||||||
|
- CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303)
|
||||||
|
- CHANGED: Remove EXACT from find_package if using Conan. [#6299](https://github.com/Project-OSRM/osrm-backend/pull/6299)
|
||||||
|
- CHANGED: Configure Undefined Behaviour Sanitizer. [#6290](https://github.com/Project-OSRM/osrm-backend/pull/6290)
|
||||||
|
- CHANGED: Use Conan instead of Mason to install code dependencies. [#6284](https://github.com/Project-OSRM/osrm-backend/pull/6284)
|
||||||
|
- CHANGED: Migrate to C++17. Update sol2 to 3.3.0. [#6279](https://github.com/Project-OSRM/osrm-backend/pull/6279)
|
||||||
|
- CHANGED: Update macOS CI image to macos-11. [#6286](https://github.com/Project-OSRM/osrm-backend/pull/6286)
|
||||||
|
- CHANGED: Enable even more clang-tidy checks. [#6273](https://github.com/Project-OSRM/osrm-backend/pull/6273)
|
||||||
|
- CHANGED: Configure CMake to not build flatbuffers tests and samples. [#6274](https://github.com/Project-OSRM/osrm-backend/pull/6274)
|
||||||
|
- CHANGED: Enable more clang-tidy checks. [#6270](https://github.com/Project-OSRM/osrm-backend/pull/6270)
|
||||||
|
- CHANGED: Configure clang-tidy job on CI. [#6261](https://github.com/Project-OSRM/osrm-backend/pull/6261)
|
||||||
|
- CHANGED: Use Github Actions for building container images [#6138](https://github.com/Project-OSRM/osrm-backend/pull/6138)
|
||||||
|
- CHANGED: Upgrade Boost dependency to 1.70 [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
|
||||||
|
- CHANGED: Upgrade Ubuntu CI builds to 20.04 [#6119](https://github.com/Project-OSRM/osrm-backend/pull/6119)
|
||||||
|
- CHANGED: Make building osrm-routed optional [#6144](https://github.com/Project-OSRM/osrm-backend/pull/6144)
|
||||||
|
- FIXED: Run all unit tests in CI [#5248](https://github.com/Project-OSRM/osrm-backend/pull/5248)
|
||||||
|
- FIXED: Fix installation of Mason CMake and 32 bit CI build [#6170](https://github.com/Project-OSRM/osrm-backend/pull/6170)
|
||||||
|
- FIXED: Fixed Node docs generation check in CI. [#6058](https://github.com/Project-OSRM/osrm-backend/pull/6058)
|
||||||
|
- CHANGED: Docker build, enabled arm64 build layer [#6172](https://github.com/Project-OSRM/osrm-backend/pull/6172)
|
||||||
|
- CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [#6175](https://github.com/Project-OSRM/osrm-backend/pull/6175)
|
||||||
|
- FIXED: Bump CI complete meta job to ubuntu-20.04 [#6323](https://github.com/Project-OSRM/osrm-backend/pull/6323)
|
||||||
|
- Routing:
|
||||||
|
- CHANGED: Lazily generate optional route path data [#6045](https://github.com/Project-OSRM/osrm-backend/pull/6045)
|
||||||
|
- FIXED: Completed support for no_entry and no_exit turn restrictions. [#5988](https://github.com/Project-OSRM/osrm-backend/pull/5988)
|
||||||
|
- ADDED: Add support for non-round-trips with a single fixed endpoint. [#6050](https://github.com/Project-OSRM/osrm-backend/pull/6050)
|
||||||
|
- FIXED: Improvements to maneuver override processing [#6125](https://github.com/Project-OSRM/osrm-backend/pull/6125)
|
||||||
|
- ADDED: Support snapping to multiple ways at an input location. [#5953](https://github.com/Project-OSRM/osrm-backend/pull/5953)
|
||||||
|
- FIXED: Fix snapping target locations to ways used in turn restrictions. [#6339](https://github.com/Project-OSRM/osrm-backend/pull/6339)
|
||||||
|
|
||||||
|
# 5.26.0
|
||||||
|
- Changes from 5.25.0
|
||||||
|
- API:
|
||||||
|
- FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090)
|
||||||
|
- FIXED: Set osrm-routed to immediately close bad connections [#6112](https://github.com/Project-OSRM/osrm-backend/pull/6112)
|
||||||
|
- Build:
|
||||||
|
- CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071)
|
||||||
|
- FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083)
|
||||||
|
- FIXED: Fixed test cache to consider MLD executable changes. [#6129](https://github.com/Project-OSRM/osrm-backend/pull/6129)
|
||||||
|
- Routing:
|
||||||
|
- FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084)
|
||||||
|
- FIXED: Fix MLD level mask generation to support 64-bit masks. [#6123](https://github.com/Project-OSRM/osrm-backend/pull/6123)
|
||||||
|
- FIXED: Fix metric offset overflow for large MLD partitions. This breaks the **data format** [#6124](https://github.com/Project-OSRM/osrm-backend/pull/6124)
|
||||||
|
|
||||||
|
# 5.25.0
|
||||||
- Changes from 5.24.0
|
- 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:
|
- 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: 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: `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:
|
- Profile:
|
||||||
- FIXED: Add kerb barrier exception to default car profile. [#5999](https://github.com/Project-OSRM/osrm-backend/pull/5999)
|
- FIXED: Add kerb barrier exception to default car profile. [#5999](https://github.com/Project-OSRM/osrm-backend/pull/5999)
|
||||||
- ADDED: output messages for shared memory block creation of Boost - catch exceptions and give reasonable error messages [#6009](https://github.com/Project-OSRM/osrm-backend/pull/6009)
|
- ADDED: output messages for shared memory block creation of Boost - catch exceptions and give reasonable error messages [#6009](https://github.com/Project-OSRM/osrm-backend/pull/6009)
|
||||||
@ -112,7 +186,7 @@
|
|||||||
](https://github.com/Project-OSRM/osrm-backend/pull/5076/)
|
](https://github.com/Project-OSRM/osrm-backend/pull/5076/)
|
||||||
- CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077
|
- CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077
|
||||||
](https://github.com/Project-OSRM/osrm-backend/pull/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]
|
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101)
|
||||||
- Bugfixes:
|
- Bugfixes:
|
||||||
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
|
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
|
||||||
- Misc:
|
- Misc:
|
||||||
|
|||||||
280
CMakeLists.txt
280
CMakeLists.txt
@ -1,4 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
|
|
||||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.
|
message(FATAL_ERROR "In-source builds are not allowed.
|
||||||
@ -18,10 +21,11 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
|
|||||||
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_MASON "Use mason for dependencies" OFF)
|
option(ENABLE_CONAN "Use conan for dependencies" OFF)
|
||||||
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||||
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
||||||
|
option(BUILD_ROUTED "Build osrm-routed HTTP server" ON)
|
||||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||||
option(ENABLE_DEBUG_LOGGING "Use debug logging 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_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||||
@ -31,27 +35,20 @@ option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
|||||||
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||||
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
||||||
option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF)
|
option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF)
|
||||||
|
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
||||||
|
|
||||||
|
if (ENABLE_CLANG_TIDY)
|
||||||
|
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
|
||||||
|
if(NOT CLANG_TIDY_COMMAND)
|
||||||
|
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
|
||||||
|
else()
|
||||||
|
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
|
||||||
|
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
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_EXPAT_VERSION "2.2.0")
|
|
||||||
set(MASON_LUA_VERSION "5.2.4")
|
|
||||||
set(MASON_BZIP2_VERSION "1.0.6")
|
|
||||||
set(MASON_TBB_VERSION "2017_U7")
|
|
||||||
|
|
||||||
message(STATUS "Enabling mason")
|
|
||||||
|
|
||||||
find_program(CURL_FOUND curl)
|
|
||||||
if(NOT CURL_FOUND)
|
|
||||||
message(FATAL_ERROR "curl command required with -DENABLE_MASON")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(mason)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# be compatible with version handling before cmake 3.x
|
# be compatible with version handling before cmake 3.x
|
||||||
if (POLICY CMP0048)
|
if (POLICY CMP0048)
|
||||||
cmake_policy(SET CMP0048 OLD)
|
cmake_policy(SET CMP0048 OLD)
|
||||||
@ -132,7 +129,7 @@ endif()
|
|||||||
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
||||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/)
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2-3.3.0/include)
|
||||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/variant/include)
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/variant/include)
|
||||||
|
|
||||||
set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework)
|
set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework)
|
||||||
@ -162,7 +159,11 @@ add_library(CONTRACTOR OBJECT ${ContractorGlob})
|
|||||||
add_library(UPDATER OBJECT ${UpdaterGlob})
|
add_library(UPDATER OBJECT ${UpdaterGlob})
|
||||||
add_library(STORAGE OBJECT ${StorageGlob})
|
add_library(STORAGE OBJECT ${StorageGlob})
|
||||||
add_library(ENGINE OBJECT ${EngineGlob})
|
add_library(ENGINE OBJECT ${EngineGlob})
|
||||||
add_library(SERVER OBJECT ${ServerGlob})
|
|
||||||
|
if (BUILD_ROUTED)
|
||||||
|
add_library(SERVER OBJECT ${ServerGlob})
|
||||||
|
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
@ -170,7 +171,6 @@ add_executable(osrm-extract src/tools/extract.cpp)
|
|||||||
add_executable(osrm-partition src/tools/partition.cpp)
|
add_executable(osrm-partition src/tools/partition.cpp)
|
||||||
add_executable(osrm-customize src/tools/customize.cpp)
|
add_executable(osrm-customize src/tools/customize.cpp)
|
||||||
add_executable(osrm-contract src/tools/contract.cpp)
|
add_executable(osrm-contract src/tools/contract.cpp)
|
||||||
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
|
||||||
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
|
||||||
@ -201,13 +201,6 @@ if(ENABLE_GOLD_LINKER)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Disable LTO when mason+gcc is detected before testing for / setting any flags.
|
|
||||||
# Mason builds libraries with Clang, mixing does not work in the context of lto.
|
|
||||||
if(ENABLE_MASON AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ENABLE_LTO)
|
|
||||||
set(ENABLE_LTO OFF)
|
|
||||||
message(WARNING "Mason and GCC's LTO not work together. Disabling LTO.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Explicitly set the build type to Release if no other type is specified
|
# Explicitly set the build type to Release if no other type is specified
|
||||||
# on the command line. Without this, cmake defaults to an unoptimized,
|
# on the command line. Without this, cmake defaults to an unoptimized,
|
||||||
# non-debug build, which almost nobody wants.
|
# non-debug build, which almost nobody wants.
|
||||||
@ -308,9 +301,9 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE AND ENABLE_MASON AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
|
# TODO: this was added for Mason, we are not sure if it is true after migration to Conan
|
||||||
message(WARNING "ENABLE_MASON and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
|
if(UNIX AND NOT APPLE AND ENABLE_CONAN AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
|
||||||
message(WARNING "For more details see: https://github.com/Project-OSRM/osrm-backend/issues/3202")
|
message(WARNING "ENABLE_CONAN and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MAYBE_COVERAGE_LIBRARIES "")
|
set(MAYBE_COVERAGE_LIBRARIES "")
|
||||||
@ -323,11 +316,14 @@ if (ENABLE_COVERAGE)
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ftest-coverage -fprofile-arcs")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ftest-coverage -fprofile-arcs")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (ENABLE_SANITIZER)
|
if (ENABLE_SANITIZER)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
set(SANITIZER_FLAGS "-g -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=undefined -fno-omit-frame-pointer")
|
||||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
|
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} ${SANITIZER_FLAGS}")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configuring compilers
|
# Configuring compilers
|
||||||
@ -360,7 +356,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
|
||||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
# using Visual Studio C++
|
# using Visual Studio C++
|
||||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} zlib)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # avoid compiler error C1128 from scripting_environment_lua.cpp
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # avoid compiler error C1128 from scripting_environment_lua.cpp
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32_LEAN_AND_MEAN") # avoid compiler error C2011 from dual #include of winsock.h and winsock2.h
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32_LEAN_AND_MEAN") # avoid compiler error C2011 from dual #include of winsock.h and winsock2.h
|
||||||
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
|
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
|
||||||
@ -397,16 +392,13 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|||||||
|
|
||||||
# Activate C++1y
|
# Activate C++1y
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++14")
|
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++17")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configuring other platform dependencies
|
# Configuring other platform dependencies
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
|
|
||||||
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
||||||
message(STATUS "Set Architecture to x64 on OS X")
|
|
||||||
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
|
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
||||||
if(OSXLIBSTD)
|
if(OSXLIBSTD)
|
||||||
@ -433,7 +425,7 @@ include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
|
|||||||
|
|
||||||
set(MBXGEOM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/geometry.hpp-0.9.2/include")
|
set(MBXGEOM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/geometry.hpp-0.9.2/include")
|
||||||
include_directories(SYSTEM ${MBXGEOM_INCLUDE_DIR})
|
include_directories(SYSTEM ${MBXGEOM_INCLUDE_DIR})
|
||||||
set(CHEAPRULER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cheap-ruler-cpp-2.5.4/include")
|
set(CHEAPRULER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cheap-ruler-cpp-2778eb8/include")
|
||||||
include_directories(SYSTEM ${CHEAPRULER_INCLUDE_DIR})
|
include_directories(SYSTEM ${CHEAPRULER_INCLUDE_DIR})
|
||||||
|
|
||||||
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
|
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
|
||||||
@ -445,90 +437,110 @@ include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR})
|
|||||||
set(VTZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vtzero/include")
|
set(VTZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vtzero/include")
|
||||||
include_directories(SYSTEM ${VTZERO_INCLUDE_DIR})
|
include_directories(SYSTEM ${VTZERO_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Disable the build of Flatbuffers tests and samples.")
|
||||||
set(FLATBUFFERS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers")
|
set(FLATBUFFERS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers")
|
||||||
set(FLATBUFFERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include")
|
set(FLATBUFFERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include")
|
||||||
include_directories(${FLATBUFFERS_INCLUDE_DIR})
|
include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_DIR})
|
||||||
add_subdirectory(${FLATBUFFERS_SRC_DIR}
|
add_subdirectory(${FLATBUFFERS_SRC_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
|
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
|
||||||
EXCLUDE_FROM_ALL)
|
EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
# if mason is enabled no find_package calls are made
|
# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package
|
||||||
# to ensure that we are only compiling and linking against
|
if (MSVC)
|
||||||
# fully portable mason packages
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||||
if(ENABLE_MASON)
|
endif()
|
||||||
message(STATUS "Installing dependencies via mason")
|
|
||||||
|
if(ENABLE_CONAN)
|
||||||
|
message(STATUS "Installing dependencies via Conan")
|
||||||
|
|
||||||
|
# Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
|
||||||
|
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR})
|
||||||
|
list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
|
||||||
|
|
||||||
|
set(CONAN_BOOST_VERSION 1.79.0)
|
||||||
|
set(CONAN_BZIP2_VERSION 1.0.8)
|
||||||
|
set(CONAN_EXPAT_VERSION 2.2.10)
|
||||||
|
set(CONAN_LUA_VERSION 5.4.4)
|
||||||
|
set(CONAN_TBB_VERSION 2021.3.0)
|
||||||
|
|
||||||
|
set(CONAN_SYSTEM_INCLUDES ON)
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
|
||||||
|
# with exit code = -1073741515, which means that program cannot load required DLL.
|
||||||
|
if (MSVC)
|
||||||
|
set(TBB_SHARED False)
|
||||||
|
else()
|
||||||
|
set(TBB_SHARED True)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CONAN_ARGS
|
||||||
|
REQUIRES
|
||||||
|
boost/${CONAN_BOOST_VERSION}
|
||||||
|
bzip2/${CONAN_BZIP2_VERSION}
|
||||||
|
expat/${CONAN_EXPAT_VERSION}
|
||||||
|
lua/${CONAN_LUA_VERSION}
|
||||||
|
onetbb/${CONAN_TBB_VERSION}
|
||||||
|
BASIC_SETUP
|
||||||
|
GENERATORS cmake_find_package
|
||||||
|
KEEP_RPATHS
|
||||||
|
NO_OUTPUT_DIRS
|
||||||
|
OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake
|
||||||
|
onetbb:shared=${TBB_SHARED}
|
||||||
|
BUILD missing
|
||||||
|
)
|
||||||
|
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
|
||||||
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
|
||||||
|
else()
|
||||||
|
conan_cmake_run("${CONAN_ARGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST})
|
||||||
|
add_dependency_includes(${CONAN_INCLUDE_DIRS_BZIP2})
|
||||||
|
add_dependency_includes(${CONAN_INCLUDE_DIRS_EXPAT})
|
||||||
|
add_dependency_includes(${CONAN_INCLUDE_DIRS_LUA})
|
||||||
|
add_dependency_includes(${CONAN_INCLUDE_DIRS_TBB})
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
mason_use(boost VERSION ${MASON_BOOST_VERSION} HEADER_ONLY)
|
find_package(Boost REQUIRED EXACT ${CONAN_BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS})
|
||||||
add_dependency_includes(${MASON_PACKAGE_boost_INCLUDE_DIRS})
|
set(Boost_DATE_TIME_LIBRARY "${Boost_date_time_LIB_TARGETS}")
|
||||||
mason_use(boost_libfilesystem VERSION ${MASON_BOOST_VERSION})
|
set(Boost_CHRONO_LIBRARY "${Boost_chrono_LIB_TARGETS}")
|
||||||
set(Boost_FILESYSTEM_LIBRARY ${MASON_PACKAGE_boost_libfilesystem_STATIC_LIBS})
|
set(Boost_PROGRAM_OPTIONS_LIBRARY "${Boost_program_options_LIB_TARGETS}")
|
||||||
mason_use(boost_libiostreams VERSION ${MASON_BOOST_VERSION})
|
set(Boost_FILESYSTEM_LIBRARY "${Boost_filesystem_LIB_TARGETS}")
|
||||||
set(Boost_IOSTREAMS_LIBRARY ${MASON_PACKAGE_boost_libiostreams_STATIC_LIBS})
|
set(Boost_IOSTREAMS_LIBRARY "${Boost_iostreams_LIB_TARGETS}")
|
||||||
mason_use(boost_libprogram_options VERSION ${MASON_BOOST_VERSION})
|
set(Boost_THREAD_LIBRARY "${Boost_thread_LIB_TARGETS}")
|
||||||
set(Boost_PROGRAM_OPTIONS_LIBRARY ${MASON_PACKAGE_boost_libprogram_options_STATIC_LIBS})
|
set(Boost_SYSTEM_LIBRARY "${Boost_system_LIB_TARGETS}")
|
||||||
mason_use(boost_libregex VERSION ${MASON_BOOST_VERSION})
|
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
|
||||||
set(Boost_REGEX_LIBRARY ${MASON_PACKAGE_boost_libregex_STATIC_LIBS})
|
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
|
||||||
mason_use(boost_libtest VERSION ${MASON_BOOST_VERSION})
|
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
|
||||||
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY ${MASON_PACKAGE_boost_libtest_STATIC_LIBS})
|
|
||||||
mason_use(boost_libdate_time VERSION ${MASON_BOOST_VERSION})
|
|
||||||
set(Boost_DATE_TIME_LIBRARY ${MASON_PACKAGE_boost_libdate_time_STATIC_LIBS})
|
|
||||||
mason_use(boost_libthread VERSION ${MASON_BOOST_VERSION})
|
|
||||||
set(Boost_THREAD_LIBRARY ${MASON_PACKAGE_boost_libthread_STATIC_LIBS})
|
|
||||||
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
|
|
||||||
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
|
|
||||||
|
|
||||||
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
|
|
||||||
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
|
|
||||||
set(EXPAT_LIBRARIES ${MASON_PACKAGE_expat_STATIC_LIBS})
|
|
||||||
|
|
||||||
mason_use(lua VERSION ${MASON_LUA_VERSION})
|
find_package(BZip2 REQUIRED)
|
||||||
add_dependency_includes(${MASON_PACKAGE_lua_INCLUDE_DIRS})
|
find_package(EXPAT REQUIRED)
|
||||||
set(USED_LUA_LIBRARIES ${MASON_PACKAGE_lua_STATIC_LIBS})
|
find_package(lua REQUIRED)
|
||||||
|
set(LUA_LIBRARIES ${lua_LIBRARIES})
|
||||||
|
|
||||||
mason_use(bzip2 VERSION ${MASON_BZIP2_VERSION})
|
find_package(TBB REQUIRED)
|
||||||
add_dependency_includes(${MASON_PACKAGE_bzip2_INCLUDE_DIRS})
|
|
||||||
set(BZIP2_LIBRARIES ${MASON_PACKAGE_bzip2_STATIC_LIBS})
|
|
||||||
|
|
||||||
mason_use(tbb VERSION ${MASON_TBB_VERSION})
|
|
||||||
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
|
|
||||||
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
|
|
||||||
|
|
||||||
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
|
|
||||||
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
|
|
||||||
endif()
|
|
||||||
set(TBB_LINKER_RPATHS "")
|
|
||||||
foreach(libpath ${MASON_PACKAGE_tbb_LIBRARY_DIRS})
|
|
||||||
set(TBB_LINKER_RPATHS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,${libpath}")
|
|
||||||
file(GLOB TBBGlob ${libpath}/*.*)
|
|
||||||
install(FILES ${TBBGlob} DESTINATION lib)
|
|
||||||
endforeach()
|
|
||||||
if(APPLE)
|
|
||||||
set(LINKER_FLAGS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,@loader_path")
|
|
||||||
elseif(UNIX)
|
|
||||||
set(LINKER_FLAGS "${TBB_LINKER_RPATHS} '-Wl,-rpath,$ORIGIN' -Wl,-z,origin")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|
||||||
|
|
||||||
# current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
|
|
||||||
|
|
||||||
# note: we avoid calling find_package(Osmium ...) here to ensure that the
|
# note: we avoid calling find_package(Osmium ...) here to ensure that the
|
||||||
# expat and bzip2 are used from mason rather than the system
|
# expat and bzip2 are used from conan rather than the system
|
||||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
||||||
else()
|
else()
|
||||||
|
if (BUILD_ROUTED)
|
||||||
find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
# osrm-routed requires newer boost:asio
|
||||||
|
find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
else()
|
||||||
|
find_package(Boost 1.60 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
endif()
|
||||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||||
|
|
||||||
find_package(TBB REQUIRED)
|
find_package(TBB REQUIRED)
|
||||||
add_dependency_includes(${TBB_INCLUDE_DIR})
|
add_dependency_includes(${TBB_INCLUDE_DIR})
|
||||||
if(WIN32)
|
set(TBB_LIBRARIES TBB::tbb)
|
||||||
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} optimized ${TBB_MALLOC_LIBRARY} debug ${TBB_LIBRARY_DEBUG} debug ${TBB_MALLOC_LIBRARY_DEBUG})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(EXPAT REQUIRED)
|
find_package(EXPAT REQUIRED)
|
||||||
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
|
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
|
||||||
@ -541,7 +553,6 @@ else()
|
|||||||
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
|
|
||||||
add_dependency_includes(${LUA_INCLUDE_DIR})
|
add_dependency_includes(${LUA_INCLUDE_DIR})
|
||||||
|
|
||||||
# add a target to generate API documentation with Doxygen
|
# add a target to generate API documentation with Doxygen
|
||||||
@ -575,19 +586,11 @@ if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILE
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# even with mason builds we want to link to system zlib
|
# even with conan builds we want to link to system zlib
|
||||||
# to ensure that osrm binaries play well with other binaries like nodejs
|
# to ensure that osrm binaries play well with other binaries like nodejs
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
|
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
|
||||||
|
|
||||||
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
|
|
||||||
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
|
|
||||||
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
||||||
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
||||||
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
||||||
@ -614,7 +617,9 @@ target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY}
|
|||||||
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
if (BUILD_ROUTED)
|
||||||
|
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(EXTRACTOR_LIBRARIES
|
set(EXTRACTOR_LIBRARIES
|
||||||
${BZIP2_LIBRARIES}
|
${BZIP2_LIBRARIES}
|
||||||
@ -622,7 +627,7 @@ set(EXTRACTOR_LIBRARIES
|
|||||||
${BOOST_BASE_LIBRARIES}
|
${BOOST_BASE_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXPAT_LIBRARIES}
|
${EXPAT_LIBRARIES}
|
||||||
${USED_LUA_LIBRARIES}
|
${LUA_LIBRARIES}
|
||||||
${OSMIUM_LIBRARIES}
|
${OSMIUM_LIBRARIES}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${ZLIB_LIBRARY}
|
${ZLIB_LIBRARY}
|
||||||
@ -630,7 +635,7 @@ set(EXTRACTOR_LIBRARIES
|
|||||||
set(GUIDANCE_LIBRARIES
|
set(GUIDANCE_LIBRARIES
|
||||||
${BOOST_BASE_LIBRARIES}
|
${BOOST_BASE_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${USED_LUA_LIBRARIES}
|
${LUA_LIBRARIES}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${MAYBE_COVERAGE_LIBRARIES})
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
set(PARTITIONER_LIBRARIES
|
set(PARTITIONER_LIBRARIES
|
||||||
@ -656,7 +661,7 @@ set(UPDATER_LIBRARIES
|
|||||||
set(CONTRACTOR_LIBRARIES
|
set(CONTRACTOR_LIBRARIES
|
||||||
${BOOST_BASE_LIBRARIES}
|
${BOOST_BASE_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${USED_LUA_LIBRARIES}
|
${LUA_LIBRARIES}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${MAYBE_RT_LIBRARY}
|
${MAYBE_RT_LIBRARY}
|
||||||
${MAYBE_COVERAGE_LIBRARIES})
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
@ -697,7 +702,7 @@ install(TARGETS osrm-components DESTINATION bin)
|
|||||||
if(BUILD_TOOLS)
|
if(BUILD_TOOLS)
|
||||||
message(STATUS "Activating OSRM internal tools")
|
message(STATUS "Activating OSRM internal tools")
|
||||||
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
||||||
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES})
|
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${TBB_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
||||||
endif()
|
endif()
|
||||||
@ -719,7 +724,9 @@ set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|||||||
set_property(TARGET osrm-partition PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-partition PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
if (BUILD_ROUTED)
|
||||||
|
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
|
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
|
||||||
file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h)
|
file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h)
|
||||||
@ -748,7 +755,9 @@ install(TARGETS osrm-partition DESTINATION bin)
|
|||||||
install(TARGETS osrm-customize DESTINATION bin)
|
install(TARGETS osrm-customize DESTINATION bin)
|
||||||
install(TARGETS osrm-contract DESTINATION bin)
|
install(TARGETS osrm-contract DESTINATION bin)
|
||||||
install(TARGETS osrm-datastore DESTINATION bin)
|
install(TARGETS osrm-datastore DESTINATION bin)
|
||||||
install(TARGETS osrm-routed DESTINATION bin)
|
if (BUILD_ROUTED)
|
||||||
|
install(TARGETS osrm-routed DESTINATION bin)
|
||||||
|
endif()
|
||||||
install(TARGETS osrm DESTINATION lib)
|
install(TARGETS osrm DESTINATION lib)
|
||||||
install(TARGETS osrm_extract DESTINATION lib)
|
install(TARGETS osrm_extract DESTINATION lib)
|
||||||
install(TARGETS osrm_partition DESTINATION lib)
|
install(TARGETS osrm_partition DESTINATION lib)
|
||||||
@ -802,9 +811,26 @@ set(PKGCONFIG_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
|
|||||||
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}")
|
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}")
|
||||||
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm")
|
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm")
|
||||||
JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
|
JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
|
||||||
JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
|
# Boost uses imported targets, we need to use a generator expression to extract
|
||||||
|
# the link libraries to be written to the pkg-config file.
|
||||||
|
# Conan & TBB define dependencies as CMake targets too, that's why we do the same for them.
|
||||||
|
foreach(engine_lib ${ENGINE_LIBRARIES})
|
||||||
|
if("${engine_lib}" MATCHES "^Boost.*" OR "${engine_lib}" MATCHES "^CONAN_LIB.*" OR "${engine_lib}" MATCHES "^TBB.*")
|
||||||
|
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$<TARGET_LINKER_FILE:${engine_lib}>")
|
||||||
|
else()
|
||||||
|
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}")
|
||||||
|
endif()
|
||||||
|
endforeach(engine_lib)
|
||||||
|
JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY)
|
||||||
|
file(GENERATE
|
||||||
|
OUTPUT
|
||||||
|
${PROJECT_BINARY_DIR}/libosrm.pc
|
||||||
|
INPUT
|
||||||
|
${PROJECT_BINARY_DIR}/pkgconfig.configured)
|
||||||
|
|
||||||
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig)
|
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig)
|
||||||
|
|
||||||
# uninstall target
|
# uninstall target
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
## Open Source Routing Machine
|
## Open Source Routing Machine
|
||||||
|
|
||||||
| Linux / macOS | Windows | Code Coverage |
|
| Linux / macOS / Windows | Code Coverage |
|
||||||
| ------------- | ------- | ------------- |
|
| ----------------------- | ------------- |
|
||||||
| [](https://travis-ci.org/Project-OSRM/osrm-backend) | [](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) | [](https://codecov.io/gh/Project-OSRM/osrm-backend) |
|
| [](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) | [](https://codecov.io/gh/Project-OSRM/osrm-backend) |
|
||||||
|
|
||||||
High performance routing engine written in C++14 designed to run on OpenStreetMap data.
|
High performance routing engine written in C++14 designed to run on OpenStreetMap data.
|
||||||
|
|
||||||
|
|||||||
@ -1,194 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
SETLOCAL
|
|
||||||
SET EL=0
|
|
||||||
|
|
||||||
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
SET PROJECT_DIR=%CD%
|
|
||||||
ECHO PROJECT_DIR^: %PROJECT_DIR%
|
|
||||||
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
|
||||||
|
|
||||||
|
|
||||||
:: Check CMake version
|
|
||||||
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
|
|
||||||
|
|
||||||
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.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
|
|
||||||
|
|
||||||
:CMAKE_OK
|
|
||||||
ECHO CMAKE_OK
|
|
||||||
cmake --version
|
|
||||||
|
|
||||||
ECHO activating VS command prompt ...
|
|
||||||
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%
|
|
||||||
|
|
||||||
ECHO cl.exe version
|
|
||||||
cl
|
|
||||||
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.2-2019.01.7z
|
|
||||||
|
|
||||||
:: local development
|
|
||||||
ECHO.
|
|
||||||
ECHO LOCAL_DEV^: %LOCAL_DEV%
|
|
||||||
IF NOT DEFINED LOCAL_DEV SET LOCAL_DEV=0
|
|
||||||
IF DEFINED LOCAL_DEV IF %LOCAL_DEV% EQU 1 IF EXIST %DEPSPKG% ECHO skipping deps download && GOTO SKIPDL
|
|
||||||
|
|
||||||
IF EXIST %DEPSPKG% DEL %DEPSPKG%
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
ECHO downloading %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
|
|
||||||
|
|
||||||
IF EXIST osrm-deps ECHO deleting osrm-deps... && RD /S /Q osrm-deps
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
IF EXIST build ECHO deleting build dir... && RD /S /Q build
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
7z -y x %DEPSPKG% | %windir%\system32\FIND "ing archive"
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
::tree osrm-deps
|
|
||||||
|
|
||||||
MKDIR build
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
cd build
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps
|
|
||||||
set PREFIX=%OSRMDEPSDIR%/libs
|
|
||||||
set BOOST_ROOT=%OSRMDEPSDIR%
|
|
||||||
set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib
|
|
||||||
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%
|
|
||||||
REM ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
|
|
||||||
|
|
||||||
|
|
||||||
ECHO calling cmake ....
|
|
||||||
cmake .. ^
|
|
||||||
-G "Visual Studio 16 2019" ^
|
|
||||||
-DBOOST_ROOT=%BOOST_ROOT% ^
|
|
||||||
-DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
|
|
||||||
-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
|
|
||||||
|
|
||||||
ECHO building ...
|
|
||||||
msbuild OSRM.sln ^
|
|
||||||
/p:Configuration=%Configuration% ^
|
|
||||||
/p:Platform=x64 ^
|
|
||||||
/t:rebuild ^
|
|
||||||
/p:BuildInParallel=true ^
|
|
||||||
/m:%NUMBER_OF_PROCESSORS% ^
|
|
||||||
/toolsversion:Current ^
|
|
||||||
/p:PlatformToolset=v142 ^
|
|
||||||
/clp:Verbosity=normal ^
|
|
||||||
/nologo ^
|
|
||||||
/flp1:logfile=build_errors.txt;errorsonly ^
|
|
||||||
/flp2:logfile=build_warnings.txt;warningsonly
|
|
||||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
|
||||||
|
|
||||||
CD %PROJECT_DIR%\build
|
|
||||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
|
||||||
|
|
||||||
SET PATH=%PROJECT_DIR%\osrm-deps\lib;%PATH%
|
|
||||||
|
|
||||||
ECHO running extractor-tests.exe ...
|
|
||||||
unit_tests\%Configuration%\extractor-tests.exe
|
|
||||||
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% EQU 1 GOTO ERROR
|
|
||||||
|
|
||||||
ECHO running util-tests.exe ...
|
|
||||||
unit_tests\%Configuration%\util-tests.exe
|
|
||||||
IF %ERRORLEVEL% EQU 1 GOTO ERROR
|
|
||||||
|
|
||||||
ECHO running server-tests.exe ...
|
|
||||||
unit_tests\%Configuration%\server-tests.exe
|
|
||||||
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
|
|
||||||
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 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\
|
|
||||||
XCOPY %test_region%.osrm ch\
|
|
||||||
MKDIR corech
|
|
||||||
XCOPY %test_region%.osrm.* corech\
|
|
||||||
XCOPY %test_region%.osrm corech\
|
|
||||||
MKDIR mld
|
|
||||||
XCOPY %test_region%.osrm.* mld\
|
|
||||||
XCOPY %test_region%.osrm mld\
|
|
||||||
%Configuration%\osrm-contract.exe %test_region_ch%.osrm
|
|
||||||
%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
|
|
||||||
%Configuration%\osrm-partition.exe %test_region_mld%.osrm
|
|
||||||
%Configuration%\osrm-customize.exe %test_region_mld%.osrm
|
|
||||||
XCOPY /Y ch\*.* ..\test\data\ch\
|
|
||||||
XCOPY /Y corech\*.* ..\test\data\corech\
|
|
||||||
XCOPY /Y mld\*.* ..\test\data\mld\
|
|
||||||
unit_tests\%Configuration%\library-tests.exe
|
|
||||||
|
|
||||||
:ERROR
|
|
||||||
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
ECHO ERRORLEVEL^: %ERRORLEVEL%
|
|
||||||
SET EL=%ERRORLEVEL%
|
|
||||||
|
|
||||||
:DONE
|
|
||||||
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
EXIT /b %EL%
|
|
||||||
27
appveyor.yml
27
appveyor.yml
@ -1,15 +1,3 @@
|
|||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- configuration: Release
|
|
||||||
# - configuration: Debug
|
|
||||||
|
|
||||||
install:
|
|
||||||
- ps: Install-Product node 6
|
|
||||||
|
|
||||||
# scripts that are called at very beginning, before repo cloning
|
|
||||||
init:
|
|
||||||
- git config --global core.autocrlf input
|
|
||||||
|
|
||||||
os: Visual Studio 2019
|
os: Visual Studio 2019
|
||||||
|
|
||||||
# clone directory
|
# clone directory
|
||||||
@ -17,20 +5,11 @@ clone_folder: c:\projects\osrm
|
|||||||
|
|
||||||
platform: x64
|
platform: x64
|
||||||
|
|
||||||
|
# no-op for the time being until someone with access to GitHub checks settings will remove integration with AppVeyor
|
||||||
|
# https://github.com/Project-OSRM/osrm-backend/pull/6312#issuecomment-1217237055
|
||||||
build_script:
|
build_script:
|
||||||
- CALL appveyor-build.bat
|
- EXIT 0
|
||||||
|
|
||||||
before_test:
|
|
||||||
- node --version
|
|
||||||
- npm --version
|
|
||||||
- npm install --ignore-scripts
|
|
||||||
- npm link --ignore-scripts
|
|
||||||
- SET PATH=%CD%\osrm-deps\lib;%PATH%
|
|
||||||
- SET OSRM_BUILD_DIR=build\%Configuration%
|
|
||||||
# TODO tests fail with "JavaScript heap out of memory", need a better host?
|
|
||||||
# - npm test
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ unset(_lua_append_versions)
|
|||||||
|
|
||||||
# this is a function only to have all the variables inside go away automatically
|
# this is a function only to have all the variables inside go away automatically
|
||||||
function(_lua_set_version_vars)
|
function(_lua_set_version_vars)
|
||||||
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
|
set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0)
|
||||||
|
|
||||||
if (Lua_FIND_VERSION_EXACT)
|
if (Lua_FIND_VERSION_EXACT)
|
||||||
if (Lua_FIND_VERSION_COUNT GREATER 1)
|
if (Lua_FIND_VERSION_COUNT GREATER 1)
|
||||||
|
|||||||
@ -1,286 +1,456 @@
|
|||||||
# Locate Intel Threading Building Blocks include paths and libraries
|
# - Find ThreadingBuildingBlocks include dirs and libraries
|
||||||
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
|
# Use this module by invoking find_package with the form:
|
||||||
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
|
# find_package(TBB
|
||||||
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
|
# [REQUIRED] # Fail with error if TBB is not found
|
||||||
# Florian Uhlig <F.Uhlig _at_ gsi.de>,
|
# ) #
|
||||||
# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
|
# Once done, this will define
|
||||||
|
|
||||||
# The MIT License
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Hannes Hofmann
|
# TBB_FOUND - system has TBB
|
||||||
|
# TBB_INCLUDE_DIRS - the TBB include directories
|
||||||
|
# TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
|
||||||
|
# malloc proxy
|
||||||
|
# TBB::tbb - imported target for the TBB library
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# TBB_VERSION_MAJOR - Major Product Version Number
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# TBB_VERSION_MINOR - Minor Product Version Number
|
||||||
# in the Software without restriction, including without limitation the rights
|
# TBB_INTERFACE_VERSION - Engineering Focused Version Number
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
# TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
# still supported. This uses the engineering
|
||||||
# furnished to do so, subject to the following conditions:
|
# focused interface version numbers.
|
||||||
#
|
#
|
||||||
# The above copyright notice and this permission notice shall be included in
|
# TBB_MALLOC_FOUND - system has TBB malloc library
|
||||||
# all copies or substantial portions of the Software.
|
# TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
|
||||||
|
# TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
|
||||||
|
# TBB::malloc - imported target for the TBB malloc library
|
||||||
#
|
#
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
# TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
# TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
# TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
# TBB::malloc_proxy - imported target for the TBB malloc proxy library
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
|
|
||||||
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
|
|
||||||
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
|
|
||||||
# in the TBB installation directory (TBB_INSTALL_DIR).
|
|
||||||
#
|
#
|
||||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
|
||||||
#
|
#
|
||||||
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
|
# This module reads hints about search locations from variables:
|
||||||
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
|
# ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
|
||||||
# which architecture to use
|
# ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
|
||||||
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
|
# ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
|
||||||
# which compiler to use (detected automatically on Windows)
|
# libraries. Should be specified with ENV TBB_ROOT
|
||||||
|
# and optionally...
|
||||||
# This module respects
|
# ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
|
||||||
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
|
#
|
||||||
|
#
|
||||||
# This module defines
|
# Modified by Robert Maynard from the original OGRE source
|
||||||
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
|
#
|
||||||
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
|
#-------------------------------------------------------------------
|
||||||
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
|
# This file is part of the CMake build system for OGRE
|
||||||
# TBB_INSTALL_DIR, the base TBB install directory
|
# (Object-oriented Graphics Rendering Engine)
|
||||||
# TBB_LIBRARIES, the libraries to link against to use TBB.
|
# For the latest info, see http://www.ogre3d.org/
|
||||||
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
|
#
|
||||||
# TBB_FOUND, If false, don't try to use TBB.
|
# The contents of this file are placed in the public domain. Feel
|
||||||
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
|
# free to make use of it in any way you like.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2010-2012 Kitware, Inc.
|
||||||
|
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
|
||||||
if (WIN32)
|
#=============================================================================
|
||||||
# has em64t/vc8 em64t/vc9
|
# FindTBB helper functions and macros
|
||||||
# has ia32/vc7.1 ia32/vc8 ia32/vc9
|
#
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB")
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
if (MSVC71)
|
|
||||||
set (_TBB_COMPILER "vc7.1")
|
|
||||||
endif(MSVC71)
|
|
||||||
if (MSVC80)
|
|
||||||
set(_TBB_COMPILER "vc8")
|
|
||||||
endif(MSVC80)
|
|
||||||
if (MSVC90)
|
|
||||||
set(_TBB_COMPILER "vc9")
|
|
||||||
endif(MSVC90)
|
|
||||||
if(MSVC10)
|
|
||||||
set(_TBB_COMPILER "vc10")
|
|
||||||
endif(MSVC10)
|
|
||||||
# Todo: add other Windows compilers such as ICL.
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif (WIN32)
|
|
||||||
|
|
||||||
if (UNIX)
|
# Use TBBConfig.cmake if possible.
|
||||||
if (APPLE)
|
|
||||||
# MAC
|
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
|
|
||||||
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
# default flavor on apple: ia32/cc4.0.1_os10.4.9
|
|
||||||
# Jiri: There is no reason to presume there is only one flavor and
|
|
||||||
# that user's setting of variables should be ignored.
|
|
||||||
if(NOT TBB_COMPILER)
|
|
||||||
set(_TBB_COMPILER "cc4.0.1_os10.4.9")
|
|
||||||
elseif (NOT TBB_COMPILER)
|
|
||||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
|
||||||
endif(NOT TBB_COMPILER)
|
|
||||||
if(NOT TBB_ARCHITECTURE)
|
|
||||||
set(_TBB_ARCHITECTURE "ia32")
|
|
||||||
elseif(NOT TBB_ARCHITECTURE)
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif(NOT TBB_ARCHITECTURE)
|
|
||||||
else (APPLE)
|
|
||||||
# LINUX
|
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "/usr")
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
|
|
||||||
# has ia32/*
|
|
||||||
# has itanium/*
|
|
||||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif (APPLE)
|
|
||||||
endif (UNIX)
|
|
||||||
|
|
||||||
if (CMAKE_SYSTEM MATCHES "SunOS.*")
|
|
||||||
# SUN
|
|
||||||
# not yet supported
|
|
||||||
# has em64t/cc3.4.3_kernel5.10
|
|
||||||
# has ia32/*
|
|
||||||
endif (CMAKE_SYSTEM MATCHES "SunOS.*")
|
|
||||||
|
|
||||||
|
|
||||||
#-- Clear the public variables
|
|
||||||
set (TBB_FOUND "NO")
|
|
||||||
|
|
||||||
|
|
||||||
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
|
|
||||||
# first: use CMake variable TBB_INSTALL_DIR
|
|
||||||
if (TBB_INSTALL_DIR)
|
|
||||||
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
|
|
||||||
endif (TBB_INSTALL_DIR)
|
|
||||||
# second: use environment variable
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
|
||||||
# Intel recommends setting TBB21_INSTALL_DIR
|
|
||||||
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
|
||||||
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
|
||||||
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
# third: try to find path automatically
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
if (_TBB_DEFAULT_INSTALL_DIR)
|
|
||||||
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
|
|
||||||
endif (_TBB_DEFAULT_INSTALL_DIR)
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
# sanity check
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
|
|
||||||
else (NOT _TBB_INSTALL_DIR)
|
|
||||||
# finally: set the cached CMake variable TBB_INSTALL_DIR
|
|
||||||
if (NOT TBB_INSTALL_DIR)
|
|
||||||
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
|
|
||||||
mark_as_advanced(TBB_INSTALL_DIR)
|
|
||||||
endif (NOT TBB_INSTALL_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
#-- A macro to rewrite the paths of the library. This is necessary, because
|
|
||||||
# find_library() always found the em64t/vc9 version of the TBB libs
|
|
||||||
macro(TBB_CORRECT_LIB_DIR var_name)
|
|
||||||
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
|
||||||
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
|
||||||
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
|
||||||
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
endmacro(TBB_CORRECT_LIB_DIR var_content)
|
|
||||||
|
|
||||||
|
|
||||||
#-- Look for include directory and set ${TBB_INCLUDE_DIR}
|
|
||||||
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
|
|
||||||
# Jiri: tbbvars now sets the CPATH environment variable to the directory
|
|
||||||
# containing the headers.
|
|
||||||
find_path(TBB_INCLUDE_DIR
|
|
||||||
tbb/task_scheduler_init.h
|
|
||||||
HINTS ${TBB_INC_SEARCH_DIR} ENV CPATH
|
|
||||||
)
|
|
||||||
mark_as_advanced(TBB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
#-- Look for libraries
|
|
||||||
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
|
|
||||||
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
|
||||||
set (_TBB_LIBRARY_DIR
|
|
||||||
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
|
|
||||||
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
|
|
||||||
)
|
|
||||||
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
|
||||||
# Jiri: This block isn't mutually exclusive with the previous one
|
|
||||||
# (hence no else), instead I test if the user really specified
|
|
||||||
# the variables in question.
|
|
||||||
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
|
||||||
# HH: deprecated
|
|
||||||
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
|
|
||||||
# Jiri: It doesn't hurt to look in more places, so I store the hints from
|
|
||||||
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
|
|
||||||
# variables and search them both.
|
|
||||||
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
|
|
||||||
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
|
||||||
|
|
||||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
|
||||||
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
|
|
||||||
|
|
||||||
if(EXISTS ${_TBB_INSTALL_DIR}/build)
|
|
||||||
file(GLOB _TBB_BUILD_DIR_RELEASE ${_TBB_INSTALL_DIR}/build/*_release)
|
|
||||||
file(GLOB _TBB_BUILD_DIR_DEBUG ${_TBB_INSTALL_DIR}/build/*_debug)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Jiri: No reason not to check the default paths. From recent versions,
|
|
||||||
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
|
|
||||||
# variables, which now point to the directories of the lib files.
|
|
||||||
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
|
|
||||||
# argument instead of the implicit PATHS as it isn't hard-coded
|
|
||||||
# but computed by system introspection. Searching the LIBRARY_PATH
|
|
||||||
# and LD_LIBRARY_PATH environment variables is now even more important
|
|
||||||
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
|
|
||||||
# the use of TBB built from sources.
|
|
||||||
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR})
|
|
||||||
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR})
|
|
||||||
|
|
||||||
#Extract path from TBB_LIBRARY name
|
|
||||||
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
|
|
||||||
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
|
|
||||||
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
|
|
||||||
|
|
||||||
#-- Look for debug libraries
|
|
||||||
# Jiri: Changed the same way as for the release libraries.
|
|
||||||
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
|
|
||||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
|
||||||
# Extract path from TBB_LIBRARY_DEBUG name
|
|
||||||
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
|
|
||||||
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
|
|
||||||
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
if (TBB_INCLUDE_DIR)
|
|
||||||
if (TBB_LIBRARY)
|
|
||||||
set (TBB_FOUND "YES")
|
|
||||||
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
|
|
||||||
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
|
|
||||||
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
|
|
||||||
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
|
|
||||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
|
||||||
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
|
|
||||||
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
|
|
||||||
message(STATUS "Found Intel TBB")
|
|
||||||
endif (TBB_LIBRARY)
|
|
||||||
endif (TBB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if (NOT TBB_FOUND)
|
|
||||||
message("ERROR: Intel TBB NOT found!")
|
|
||||||
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
|
|
||||||
# do only throw fatal, if this pkg is REQUIRED
|
|
||||||
if (TBB_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "Could NOT find TBB library.")
|
|
||||||
endif (TBB_FIND_REQUIRED)
|
|
||||||
endif (NOT TBB_FOUND)
|
|
||||||
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
|
|
||||||
|
set(_tbb_find_quiet)
|
||||||
|
if (TBB_FIND_QUIETLY)
|
||||||
|
set(_tbb_find_quiet QUIET)
|
||||||
|
endif ()
|
||||||
|
set(_tbb_find_components)
|
||||||
|
set(_tbb_find_optional_components)
|
||||||
|
foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS)
|
||||||
|
if (TBB_FIND_REQUIRED_${_tbb_find_component})
|
||||||
|
list(APPEND _tbb_find_components "${_tbb_find_component}")
|
||||||
|
else ()
|
||||||
|
list(APPEND _tbb_find_optional_components "${_tbb_find_component}")
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
unset(_tbb_find_component)
|
||||||
|
find_package(TBB CONFIG ${_tbb_find_quiet}
|
||||||
|
COMPONENTS ${_tbb_find_components}
|
||||||
|
OPTIONAL_COMPONENTS ${_tbb_find_optional_components})
|
||||||
|
unset(_tbb_find_quiet)
|
||||||
|
unset(_tbb_find_components)
|
||||||
|
unset(_tbb_find_optional_components)
|
||||||
if (TBB_FOUND)
|
if (TBB_FOUND)
|
||||||
set(TBB_INTERFACE_VERSION 0)
|
return ()
|
||||||
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
|
endif ()
|
||||||
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
|
|
||||||
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
|
#====================================================
|
||||||
message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}")
|
# Fix the library path in case it is a linker script
|
||||||
endif (TBB_FOUND)
|
#====================================================
|
||||||
|
function(tbb_extract_real_library library real_library)
|
||||||
|
if(NOT UNIX OR NOT EXISTS ${library})
|
||||||
|
set(${real_library} "${library}" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#Read in the first 4 bytes and see if they are the ELF magic number
|
||||||
|
set(_elf_magic "7f454c46")
|
||||||
|
file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
|
||||||
|
if(_hex_data STREQUAL _elf_magic)
|
||||||
|
#we have opened a elf binary so this is what
|
||||||
|
#we should link to
|
||||||
|
set(${real_library} "${library}" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ ${library} _data OFFSET 0 LIMIT 1024)
|
||||||
|
if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
|
||||||
|
#extract out the .so name from REGEX MATCH command
|
||||||
|
set(_proper_so_name "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
#construct path to the real .so which is presumed to be in the same directory
|
||||||
|
#as the input file
|
||||||
|
get_filename_component(_so_dir "${library}" DIRECTORY)
|
||||||
|
set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
#unable to determine what this library is so just hope everything works
|
||||||
|
#and pass it unmodified.
|
||||||
|
set(${real_library} "${library}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Do the final processing for the package find.
|
||||||
|
#===============================================
|
||||||
|
macro(findpkg_finish PREFIX TARGET_NAME)
|
||||||
|
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
|
||||||
|
set(${PREFIX}_FOUND TRUE)
|
||||||
|
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
|
||||||
|
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
|
||||||
|
else ()
|
||||||
|
if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
|
||||||
|
message(FATAL_ERROR "Required library ${PREFIX} not found.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT TARGET "TBB::${TARGET_NAME}")
|
||||||
|
if (${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
|
||||||
|
endif ()
|
||||||
|
if (${PREFIX}_LIBRARY_DEBUG)
|
||||||
|
tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
|
||||||
|
endif ()
|
||||||
|
add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
|
||||||
|
if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${real_release}"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${real_debug}"
|
||||||
|
IMPORTED_LOCATION_RELEASE "${real_release}")
|
||||||
|
elseif (${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${real_release}")
|
||||||
|
elseif (${PREFIX}_LIBRARY_DEBUG)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${real_debug}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#mark the following variables as internal variables
|
||||||
|
mark_as_advanced(${PREFIX}_INCLUDE_DIR
|
||||||
|
${PREFIX}_LIBRARY
|
||||||
|
${PREFIX}_LIBRARY_DEBUG
|
||||||
|
${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Generate debug names from given release names
|
||||||
|
#===============================================
|
||||||
|
macro(get_debug_names PREFIX)
|
||||||
|
foreach(i ${${PREFIX}})
|
||||||
|
set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# See if we have env vars to help us find tbb
|
||||||
|
#===============================================
|
||||||
|
macro(getenv_path VAR)
|
||||||
|
set(ENV_${VAR} $ENV{${VAR}})
|
||||||
|
# replace won't work if var is blank
|
||||||
|
if (ENV_${VAR})
|
||||||
|
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Couple a set of release AND debug libraries
|
||||||
|
#===============================================
|
||||||
|
macro(make_library_set PREFIX)
|
||||||
|
if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
|
||||||
|
set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
|
||||||
|
elseif (${PREFIX}_RELEASE)
|
||||||
|
set(${PREFIX} ${${PREFIX}_RELEASE})
|
||||||
|
elseif (${PREFIX}_DEBUG)
|
||||||
|
set(${PREFIX} ${${PREFIX}_DEBUG})
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Now to actually find TBB
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get path, convert backslashes as ${ENV_${var}}
|
||||||
|
getenv_path(TBB_ROOT)
|
||||||
|
|
||||||
|
# initialize search paths
|
||||||
|
set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
|
||||||
|
set(TBB_INC_SEARCH_PATH "")
|
||||||
|
set(TBB_LIB_SEARCH_PATH "")
|
||||||
|
|
||||||
|
|
||||||
|
# If user built from sources
|
||||||
|
set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
|
||||||
|
if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
|
||||||
|
getenv_path(TBB_BUILD_DIR)
|
||||||
|
if (NOT ENV_TBB_BUILD_DIR)
|
||||||
|
set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# include directory under ${ENV_TBB_ROOT}/include
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH
|
||||||
|
${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
|
||||||
|
${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
# For Windows, let's assume that the user might be using the precompiled
|
||||||
|
# TBB packages from the main website. These use a rather awkward directory
|
||||||
|
# structure (at least for automatically finding the right files) depending
|
||||||
|
# on platform and compiler, but we'll do our best to accommodate it.
|
||||||
|
# Not adding the same effort for the precompiled linux builds, though. Those
|
||||||
|
# have different versions for CC compiler versions and linux kernels which
|
||||||
|
# will never adequately match the user's setup, so there is no feasible way
|
||||||
|
# to detect the "best" version to use. The user will have to manually
|
||||||
|
# select the right files. (Chances are the distributions are shipping their
|
||||||
|
# custom version of tbb, anyway, so the problem is probably nonexistent.)
|
||||||
|
if (WIN32 AND MSVC)
|
||||||
|
set(COMPILER_PREFIX "vc7.1")
|
||||||
|
if (MSVC_VERSION EQUAL 1400)
|
||||||
|
set(COMPILER_PREFIX "vc8")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1500)
|
||||||
|
set(COMPILER_PREFIX "vc9")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1600)
|
||||||
|
set(COMPILER_PREFIX "vc10")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1700)
|
||||||
|
set(COMPILER_PREFIX "vc11")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1800)
|
||||||
|
set(COMPILER_PREFIX "vc12")
|
||||||
|
elseif(MSVC_VERSION GREATER_EQUAL 1900)
|
||||||
|
set(COMPILER_PREFIX "vc14")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
|
||||||
|
else ()
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
|
||||||
|
# and above and AppleClang
|
||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
|
||||||
|
NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
|
||||||
|
set (USE_LIBCXX OFF)
|
||||||
|
cmake_policy(GET CMP0025 POLICY_VAR)
|
||||||
|
|
||||||
|
if (POLICY_VAR STREQUAL "NEW")
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
set (USE_LIBCXX ON)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
set (USE_LIBCXX ON)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (USE_LIBCXX)
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
|
||||||
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# check compiler ABI
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(COMPILER_PREFIX)
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.8")
|
||||||
|
endif()
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.7")
|
||||||
|
endif()
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.4")
|
||||||
|
endif()
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.1")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
set(COMPILER_PREFIX)
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.8")
|
||||||
|
endif()
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.7")
|
||||||
|
endif()
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.4")
|
||||||
|
else() # Assume compatibility with 4.4 for other compilers
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.4")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# if platform architecture is explicitly specified
|
||||||
|
set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
|
||||||
|
if (TBB_ARCH_PLATFORM)
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
|
||||||
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
foreach (prefix IN LISTS COMPILER_PREFIX)
|
||||||
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
|
||||||
|
else ()
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
|
||||||
|
endif ()
|
||||||
|
endforeach()
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# add general search paths
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
|
||||||
|
${dir}/Libs)
|
||||||
|
list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
|
||||||
|
${dir}/include/tbb)
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
set(TBB_LIBRARY_NAMES tbb)
|
||||||
|
get_debug_names(TBB_LIBRARY_NAMES)
|
||||||
|
|
||||||
|
|
||||||
|
find_path(TBB_INCLUDE_DIR
|
||||||
|
NAMES tbb/tbb.h
|
||||||
|
PATHS ${TBB_INC_SEARCH_PATH})
|
||||||
|
|
||||||
|
find_library(TBB_LIBRARY_RELEASE
|
||||||
|
NAMES ${TBB_LIBRARY_NAMES}
|
||||||
|
PATHS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
find_library(TBB_LIBRARY_DEBUG
|
||||||
|
NAMES ${TBB_LIBRARY_NAMES_DEBUG}
|
||||||
|
PATHS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
make_library_set(TBB_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(TBB tbb)
|
||||||
|
|
||||||
|
#if we haven't found TBB no point on going any further
|
||||||
|
if (NOT TBB_FOUND)
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Look for TBB's malloc package
|
||||||
|
set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
|
||||||
|
get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
|
||||||
|
|
||||||
|
find_path(TBB_MALLOC_INCLUDE_DIR
|
||||||
|
NAMES tbb/tbb.h
|
||||||
|
PATHS ${TBB_INC_SEARCH_PATH})
|
||||||
|
|
||||||
|
find_library(TBB_MALLOC_LIBRARY_RELEASE
|
||||||
|
NAMES ${TBB_MALLOC_LIBRARY_NAMES}
|
||||||
|
PATHS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
find_library(TBB_MALLOC_LIBRARY_DEBUG
|
||||||
|
NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG}
|
||||||
|
PATHS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
make_library_set(TBB_MALLOC_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(TBB_MALLOC tbbmalloc)
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Look for TBB's malloc proxy package
|
||||||
|
set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
|
||||||
|
get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
|
||||||
|
|
||||||
|
find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
|
||||||
|
NAMES tbb/tbbmalloc_proxy.h
|
||||||
|
PATHS ${TBB_INC_SEARCH_PATH})
|
||||||
|
|
||||||
|
find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE
|
||||||
|
NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES}
|
||||||
|
PATHS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG
|
||||||
|
NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG}
|
||||||
|
PATHS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
make_library_set(TBB_MALLOC_PROXY_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
|
||||||
|
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
#parse all the version numbers from tbb
|
||||||
|
if(NOT TBB_VERSION)
|
||||||
|
if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
|
||||||
|
file(STRINGS
|
||||||
|
"${TBB_INCLUDE_DIR}/oneapi/tbb/version.h"
|
||||||
|
TBB_VERSION_CONTENTS
|
||||||
|
REGEX "VERSION")
|
||||||
|
else()
|
||||||
|
#only read the start of the file
|
||||||
|
file(STRINGS
|
||||||
|
"${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
|
||||||
|
TBB_VERSION_CONTENTS
|
||||||
|
REGEX "VERSION")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
|
||||||
|
TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
|
||||||
|
TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
endif()
|
||||||
1026
cmake/conan.cmake
Normal file
1026
cmake/conan.cmake
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,26 @@
|
|||||||
FROM debian:stretch-slim as builder
|
FROM debian:bullseye-slim as builder
|
||||||
ARG DOCKER_TAG
|
ARG DOCKER_TAG
|
||||||
ARG BUILD_CONCURRENCY
|
ARG BUILD_CONCURRENCY
|
||||||
RUN mkdir -p /src && mkdir -p /opt
|
RUN mkdir -p /src && mkdir -p /opt
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
|
||||||
|
libzip-dev libboost1.74-all-dev lua5.4 liblua5.4-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
|
||||||
|
|
||||||
|
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||||
|
ldconfig /usr/local/lib && \
|
||||||
|
git clone --branch v2021.3.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \
|
||||||
|
cd oneTBB && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \
|
||||||
|
cmake --build . && \
|
||||||
|
cmake --install .
|
||||||
|
|
||||||
COPY . /src
|
COPY . /src
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} && \
|
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||||
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}" && \
|
echo "Building OSRM ${DOCKER_TAG}" && \
|
||||||
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
||||||
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
||||||
@ -30,20 +42,26 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null ||
|
|||||||
|
|
||||||
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
# 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)
|
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
|
||||||
FROM debian:stretch-slim as runstage
|
FROM debian:bullseye-slim as runstage
|
||||||
RUN mkdir -p /src && mkdir -p /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 /usr/local /usr/local
|
||||||
COPY --from=builder /opt /opt
|
COPY --from=builder /opt /opt
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends libboost-program-options1.74.0 libboost-regex1.74.0 \
|
||||||
|
libboost-date-time1.74.0 libboost-chrono1.74.0 libboost-filesystem1.74.0 \
|
||||||
|
libboost-iostreams1.74.0 libboost-system1.74.0 libboost-thread1.74.0 \
|
||||||
|
expat liblua5.4-0 && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
# add /usr/local/lib to ldconfig to allow loading libraries from there
|
||||||
|
ldconfig /usr/local/lib
|
||||||
|
|
||||||
RUN /usr/local/bin/osrm-extract --help && \
|
RUN /usr/local/bin/osrm-extract --help && \
|
||||||
/usr/local/bin/osrm-routed --help && \
|
/usr/local/bin/osrm-routed --help && \
|
||||||
/usr/local/bin/osrm-contract --help && \
|
/usr/local/bin/osrm-contract --help && \
|
||||||
/usr/local/bin/osrm-partition --help && \
|
/usr/local/bin/osrm-partition --help && \
|
||||||
/usr/local/bin/osrm-customize --help
|
/usr/local/bin/osrm-customize --help
|
||||||
|
|
||||||
WORKDIR /opt
|
WORKDIR /opt
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|||||||
144
docs/http.md
144
docs/http.md
@ -1,7 +1,7 @@
|
|||||||
# OSRM HTTP server
|
# 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
|
The built-in HTTP server is a basic HTTP/1.0 server that supports a 'keep-alive' extension. Persistent connections are limited to 512 requests per
|
||||||
connection and allow no more then 5 seconds between requests.
|
connection and allow no more than 5 seconds between requests.
|
||||||
|
|
||||||
## General options
|
## General options
|
||||||
|
|
||||||
@ -25,20 +25,20 @@ GET /{service}/{version}/{profile}/{coordinates}[.{format}]?option=value&option=
|
|||||||
|
|
||||||
Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 by default and can be generated using [this package](https://www.npmjs.com/package/polyline).
|
Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 by default and can be generated using [this package](https://www.npmjs.com/package/polyline).
|
||||||
|
|
||||||
To pass parameters to each location some options support an array like encoding:
|
To pass parameters to each location some options support an array-like encoding:
|
||||||
|
|
||||||
**Request options**
|
**Request options**
|
||||||
|
|
||||||
| Option | Values | Description |
|
| Option | Values | Description |
|
||||||
|----------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|----------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in a clockwise direction. |
|
||||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
||||||
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|
||||||
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
||||||
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curb side. |
|
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curbside. |
|
||||||
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, order does not matter. |
|
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, the 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 |
|
|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. |
|
|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 the response and do not want to transfer waste data. |
|
||||||
|
|
||||||
Where the elements follow the following format:
|
Where the elements follow the following format:
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ Where the elements follow the following format:
|
|||||||
|
|
||||||
The number of elements must match exactly the number of locations (except for `generate_hints` and `exclude`). If you don't want to pass a value but instead use the default you can pass an empty `element`.
|
The number of elements must match exactly the number of locations (except for `generate_hints` and `exclude`). If you don't want to pass a value but instead use the default you can pass an empty `element`.
|
||||||
|
|
||||||
Example: 2nd location use the default value for `option`:
|
Example: 2nd location uses the default value for `option`:
|
||||||
|
|
||||||
```
|
```
|
||||||
{option}={element};;{element}
|
{option}={element};;{element}
|
||||||
@ -88,17 +88,17 @@ Every response object has a `code` property containing one of the strings below
|
|||||||
| `InvalidService` | Service name is invalid. |
|
| `InvalidService` | Service name is invalid. |
|
||||||
| `InvalidVersion` | Version is not found. |
|
| `InvalidVersion` | Version is not found. |
|
||||||
| `InvalidOptions` | Options are invalid. |
|
| `InvalidOptions` | Options are invalid. |
|
||||||
| `InvalidQuery` | The query string is synctactically malformed. |
|
| `InvalidQuery` | The query string is syntactically malformed. |
|
||||||
| `InvalidValue` | The successfully parsed query parameters are invalid. |
|
| `InvalidValue` | The successfully parsed query parameters are invalid. |
|
||||||
| `NoSegment` | One of the supplied input coordinates could not snap to street segment. |
|
| `NoSegment` | One of the supplied input coordinates could not snap to the street segment. |
|
||||||
| `TooBig` | The request size violates one of the service specific request size restrictions. |
|
| `TooBig` | The request size violates one of the service-specific request size restrictions. |
|
||||||
|
|
||||||
- `message` is a **optional** human-readable error message. All other status types are service dependent.
|
- `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`.
|
- 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
|
#### 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.
|
Every response object has a `data_version` property containing a timestamp from the original OpenStreetMap file. This field is optional. It can be omitted if the data_version parameter was not set on the osrm-extract stage or the OSM file has not `osmosis_replication_timestamp` section.
|
||||||
|
|
||||||
#### Example response
|
#### Example response
|
||||||
|
|
||||||
@ -129,8 +129,8 @@ 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. |
|
|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
|
As `waypoints` is a single thing, returned by that service, using it with the option `skip_waypoints` set to `true` is quite useless, but still
|
||||||
possible. In that case only `code` field will be returned.
|
possible. In that case, only the `code` field will be returned.
|
||||||
|
|
||||||
**Response**
|
**Response**
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?numb
|
|||||||
|
|
||||||
#### Example Response
|
#### Example Response
|
||||||
|
|
||||||
```json
|
```JSON
|
||||||
{
|
{
|
||||||
"waypoints" : [
|
"waypoints" : [
|
||||||
{
|
{
|
||||||
@ -239,7 +239,7 @@ curl 'http://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397
|
|||||||
|
|
||||||
### Table service
|
### Table service
|
||||||
|
|
||||||
Computes the duration of the fastest route between all pairs of supplied coordinates. Returns the durations or distances or both between the coordinate pairs. Note that the distances are not the shortest distance between two coordinates, but rather the distances of the fastest routes. Duration is in seconds and distances is in meters.
|
Computes the duration of the fastest route between all pairs of supplied coordinates. Returns durations or distances or both between the coordinate pairs. Note that the distances are not the shortest distance between two coordinates, but rather the distances of the fastest routes. Durations are in seconds and distances are in meters.
|
||||||
|
|
||||||
```endpoint
|
```endpoint
|
||||||
GET /table/v1/{profile}/{coordinates}?{sources}=[{elem}...];&{destinations}=[{elem}...]&annotations={duration|distance|duration,distance}
|
GET /table/v1/{profile}/{coordinates}?{sources}=[{elem}...];&{destinations}=[{elem}...]&annotations={duration|distance|duration,distance}
|
||||||
@ -417,7 +417,7 @@ All other properties might be undefined.
|
|||||||
### Match service
|
### Match service
|
||||||
|
|
||||||
Map matching matches/snaps given GPS points to the road network in the most plausible way.
|
Map matching matches/snaps given GPS points to the road network in the most plausible way.
|
||||||
Please note the request might result multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found.
|
Please note the request might result in multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found.
|
||||||
The algorithm might not be able to match all points. Outliers are removed if they can not be matched successfully.
|
The algorithm might not be able to match all points. Outliers are removed if they can not be matched successfully.
|
||||||
|
|
||||||
```endpoint
|
```endpoint
|
||||||
@ -452,11 +452,11 @@ The area to search is chosen such that the correct candidate should be considere
|
|||||||
|
|
||||||
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
|
||||||
- `tracepoints`: Array of `Waypoint` objects representing all points of the trace in order.
|
- `tracepoints`: Array of `Waypoint` objects representing all points of the trace in order.
|
||||||
If the trace point was ommited by map matching because it is an outlier, the entry will be `null`.
|
If the tracepoint was omitted by map matching because it is an outlier, the entry will be `null`.
|
||||||
Each `Waypoint` object has the following additional properties:
|
Each `Waypoint` object has the following additional properties:
|
||||||
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
|
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
|
||||||
- `waypoint_index`: Index of the waypoint inside the matched route.
|
- `waypoint_index`: Index of the waypoint inside the matched route.
|
||||||
- `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching.
|
- `alternatives_count`: Number of probable alternative matchings for this tracepoint. A value of zero indicates that this point was matched unambiguously. Split the trace at these points for incremental map matching.
|
||||||
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
|
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
|
||||||
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.
|
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ All other properties might be undefined.
|
|||||||
### Trip service
|
### Trip service
|
||||||
|
|
||||||
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm) for 10 or more waypoints and uses brute force for less than 10 waypoints.
|
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm) for 10 or more waypoints and uses brute force for less than 10 waypoints.
|
||||||
The returned path does not have to be the fastest path. As TSP is NP-hard it only returns an approximation.
|
The returned path does not have to be the fastest one. As TSP is NP-hard it only returns an approximation.
|
||||||
Note that all input coordinates have to be connected for the trip service to work.
|
Note that all input coordinates have to be connected for the trip service to work.
|
||||||
|
|
||||||
```endpoint
|
```endpoint
|
||||||
@ -492,12 +492,12 @@ In addition to the [general options](#general-options) the following options are
|
|||||||
|
|
||||||
**Fixing Start and End Points**
|
**Fixing Start and End Points**
|
||||||
|
|
||||||
It is possible to explicitely set the start or end coordinate of the trip.
|
It is possible to explicitly set the start or end coordinate of the trip.
|
||||||
When source is set to `first`, the first coordinate is used as start coordinate of the trip in the output. When destination is set to `last`, the last coordinate will be used as destination of the trip in the returned output. If you specify `any`, any of the coordinates can be used as the first or last coordinate in the output.
|
When the source is set to `first`, the first coordinate is used as the start coordinate of the trip in the output. When the destination is set to `last`, the last coordinate will be used as the destination of the trip in the returned output. If you specify `any`, any of the coordinates can be used as the first or last coordinate in the output.
|
||||||
|
|
||||||
However, if `source=any&destination=any` the returned round-trip will still start at the first input coordinate by default.
|
However, if `source=any&destination=any` the returned round-trip will still start at the first input coordinate by default.
|
||||||
|
|
||||||
Currently, not all combinations of `roundtrip`, `source` and `destination` are supported.
|
Currently, not all combinations of `roundtrip`, `source`, and `destination` are supported.
|
||||||
Right now, the following combinations are possible:
|
Right now, the following combinations are possible:
|
||||||
|
|
||||||
| roundtrip | source | destination | supported |
|
| roundtrip | source | destination | supported |
|
||||||
@ -507,8 +507,8 @@ Right now, the following combinations are possible:
|
|||||||
| true | any | last | **yes** |
|
| true | any | last | **yes** |
|
||||||
| true | any | any | **yes** |
|
| true | any | any | **yes** |
|
||||||
| false | first | last | **yes** |
|
| false | first | last | **yes** |
|
||||||
| false | first | any | no |
|
| false | first | any | **yes** |
|
||||||
| false | any | last | no |
|
| false | any | last | **yes** |
|
||||||
| false | any | any | no |
|
| false | any | any | no |
|
||||||
|
|
||||||
#### Example Requests
|
#### Example Requests
|
||||||
@ -576,7 +576,7 @@ Vector tiles contain two layers:
|
|||||||
| `duration` | `float` | how long this segment takes to traverse, in seconds. This value is to calculate the total route ETA. |
|
| `duration` | `float` | how long this segment takes to traverse, in seconds. This value is to calculate the total route ETA. |
|
||||||
| `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. |
|
| `weight ` | `integer` | how long this segment takes to traverse, in units (may differ from `duration` when artificial biasing is applied in the Lua profiles). ACTUAL ROUTING USES THIS VALUE. |
|
||||||
| `name` | `string` | the name of the road this segment belongs to |
|
| `name` | `string` | the name of the road this segment belongs to |
|
||||||
| `rate` | `float` | the value of `length/weight` - analagous to `speed`, but using the `weight` value rather than `duration`, rounded to the nearest integer |
|
| `rate` | `float` | the value of `length/weight` - analogous 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 |
|
| `is_startpoint` | `boolean` | whether this segment can be used as a start/endpoint for routes |
|
||||||
|
|
||||||
`turns` layer:
|
`turns` layer:
|
||||||
@ -601,13 +601,13 @@ Represents a route through (potentially multiple) waypoints.
|
|||||||
|
|
||||||
- `distance`: The distance traveled by the route, in `float` meters.
|
- `distance`: The distance traveled by the route, in `float` meters.
|
||||||
- `duration`: The estimated travel time, in `float` number of seconds.
|
- `duration`: The estimated travel time, in `float` number of seconds.
|
||||||
- `geometry`: The whole geometry of the route value depending on `overview` parameter, format depending on the `geometries` parameter. See `RouteStep`'s `geometry` property for a parameter documentation.
|
- `geometry`: The whole geometry of the route value depending on `overview` parameter, format depending on the `geometries` parameter. See `RouteStep`'s `geometry` property for the parameter documentation.
|
||||||
- `weight`: The calculated weight of the route.
|
- `weight`: The calculated weight of the route.
|
||||||
- `weight_name`: The name of the weight profile used during extraction phase.
|
- `weight_name`: The name of the weight profile used during the extraction phase.
|
||||||
|
|
||||||
| overview | Description |
|
| overview | Description |
|
||||||
|------------|-----------------------------|
|
|------------|-----------------------------|
|
||||||
| simplified | Geometry is simplified according to the highest zoom level it can still be displayed on full. |
|
| simplified | Geometry is simplified according to the highest zoom level it can still be displayed in full. |
|
||||||
| full | Geometry is not simplified. |
|
| full | Geometry is not simplified. |
|
||||||
| false | Geometry is not added. |
|
| false | Geometry is not added. |
|
||||||
|
|
||||||
@ -652,7 +652,7 @@ Represents a route between two waypoints.
|
|||||||
|
|
||||||
| summary | |
|
| summary | |
|
||||||
|--------------|-----------------------------------------------------------------------|
|
|--------------|-----------------------------------------------------------------------|
|
||||||
| true | Names of the two major roads used. Can be empty if route is too short.|
|
| true | Names of the two major roads used. Can be empty if the route is too short.|
|
||||||
| false | empty `string` |
|
| false | empty `string` |
|
||||||
|
|
||||||
- `steps`: Depends on the `steps` parameter.
|
- `steps`: Depends on the `steps` parameter.
|
||||||
@ -662,11 +662,11 @@ Represents a route between two waypoints.
|
|||||||
| true | array of `RouteStep` objects describing the turn-by-turn instructions |
|
| true | array of `RouteStep` objects describing the turn-by-turn instructions |
|
||||||
| false | empty array |
|
| false | empty array |
|
||||||
|
|
||||||
- `annotation`: Additional details about each coordinate along the route geometry:
|
- `annotation`: Additional details about each coordinate along with the route geometry:
|
||||||
|
|
||||||
| annotations | |
|
| annotations | |
|
||||||
|--------------|-------------------------------------------------------------------------------|
|
|--------------|-------------------------------------------------------------------------------|
|
||||||
| true | An `Annotation` object containing node ids, durations, distances and weights. |
|
| true | An `Annotation` object containing node ids, durations, distances, and weights. |
|
||||||
| false | `undefined` |
|
| false | `undefined` |
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
@ -696,14 +696,14 @@ Annotation of the whole route leg with fine-grained information about each segme
|
|||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `distance`: The distance, in metres, between each pair of coordinates
|
- `distance`: The distance, in meters, between each pair of coordinates
|
||||||
- `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns.
|
- `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns.
|
||||||
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`. String-like names are in the `metadata.datasource_names` array.
|
- `datasources`: The index of the data source for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`. String-like names are in the `metadata.datasource_names` array.
|
||||||
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
|
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
|
||||||
- `weight`: The weights between each pair of coordinates. Does not include any turn costs.
|
- `weight`: The weights between each pair of coordinates. Does not include any turn costs.
|
||||||
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
|
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
|
||||||
- `metadata`: Metadata related to other annotations
|
- `metadata`: Metadata related to other annotations
|
||||||
- `datasource_names`: The names of the datasources used for the speed between each pair of coordinates. `lua profile` is the default profile, other values arethe filenames supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`
|
- `datasource_names`: The names of the data sources used for the speed between each pair of coordinates. `lua profile` is the default profile, other values are the filenames supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
@ -803,11 +803,11 @@ step.
|
|||||||
- `bearing_after`: The clockwise angle from true north to the
|
- `bearing_after`: The clockwise angle from true north to the
|
||||||
direction of travel immediately after the maneuver. Range 0-359.
|
direction of travel immediately after the maneuver. Range 0-359.
|
||||||
- `type` A string indicating the type of maneuver. **new identifiers might be introduced without API change**
|
- `type` A string indicating the type of maneuver. **new identifiers might be introduced without API change**
|
||||||
Types unknown to the client should be handled like the `turn` type, the existence of correct `modifier` values is guranteed.
|
Types unknown to the client should be handled like the `turn` type, the existence of correct `modifier` values is guaranteed.
|
||||||
|
|
||||||
| `type` | Description |
|
| `type` | Description |
|
||||||
|------------------|--------------------------------------------------------------|
|
|------------------|--------------------------------------------------------------|
|
||||||
| `turn` | a basic turn into direction of the `modifier` |
|
| `turn` | a basic turn into the direction of the `modifier` |
|
||||||
| `new name` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
|
| `new name` | 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 |
|
| `depart` | indicates the departure of the leg |
|
||||||
| `arrive` | indicates the destination of the leg |
|
| `arrive` | indicates the destination of the leg |
|
||||||
@ -821,9 +821,9 @@ step.
|
|||||||
| `continue` | Turn in direction of `modifier` to stay on the same road |
|
| `continue` | Turn in direction of `modifier` to stay on the same road |
|
||||||
| `roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
|
| `roundabout` | traverse roundabout, 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). |
|
| `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
|
||||||
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. |
|
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as a normal turn. The `modifier` indicates the turn direction. Example instruction: `At the roundabout turn left`. |
|
||||||
| `notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
|
| `notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
|
||||||
| `exit roundabout`| Describes a maneuver exiting a roundabout (usually preceeded by a `roundabout` instruction) |
|
| `exit roundabout`| Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
||||||
| `exit rotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
| `exit rotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||||
|
|
||||||
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
|
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
|
||||||
@ -833,7 +833,7 @@ step.
|
|||||||
|
|
||||||
| `modifier` | Description |
|
| `modifier` | Description |
|
||||||
|-------------------|-------------------------------------------|
|
|-------------------|-------------------------------------------|
|
||||||
| `uturn` | indicates reversal of direction |
|
| `uturn` | indicates the reversal of direction |
|
||||||
| `sharp right` | a sharp right turn |
|
| `sharp right` | a sharp right turn |
|
||||||
| `right` | a normal turn to the right |
|
| `right` | a normal turn to the right |
|
||||||
| `slight right` | a slight turn to the right |
|
| `slight right` | a slight turn to the right |
|
||||||
@ -851,8 +851,8 @@ step.
|
|||||||
| `turn` | `modifier` indicates the change in direction accomplished through the turn |
|
| `turn` | `modifier` indicates the change in direction accomplished through the turn |
|
||||||
| `depart`/`arrive` | `modifier` indicates the position of departure point and arrival point in relation to the current direction of travel |
|
| `depart`/`arrive` | `modifier` indicates the position of departure point and arrival point in relation to the current direction of travel |
|
||||||
|
|
||||||
- `exit` An optional `integer` indicating number of the exit to take. The property exists for the `roundabout` / `rotary` property:
|
- `exit` An optional `integer` indicating the number of the exit to take. The property exists for the `roundabout` / `rotary` property:
|
||||||
Number of the roundabout exit to take. If exit is `undefined` the destination is on the roundabout.
|
Number of the roundabout exit to take. If an exit is `undefined` the destination is on the roundabout.
|
||||||
|
|
||||||
|
|
||||||
New properties (potentially depending on `type`) may be introduced in the future without an API version change.
|
New properties (potentially depending on `type`) may be introduced in the future without an API version change.
|
||||||
@ -863,7 +863,7 @@ A `Lane` represents a turn lane at the corresponding turn location.
|
|||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `indications`: a indication (e.g. marking on the road) specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left). The indications are given in an array, each containing one of the following types. Further indications might be added on without an API version change.
|
- `indications`: an indication (e.g. marking on the road) specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left). The indications are given in an array, each containing one of the following types. Further indications might be added on without an API version change.
|
||||||
|
|
||||||
| `value` | Description |
|
| `value` | Description |
|
||||||
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||||
@ -890,7 +890,7 @@ A `Lane` represents a turn lane at the corresponding turn location.
|
|||||||
|
|
||||||
### Intersection object
|
### Intersection object
|
||||||
|
|
||||||
An intersection gives a full representation of any cross-way the path passes bay. For every step, the very first intersection (`intersections[0]`) corresponds to the
|
An intersection gives a full representation of any cross-way the path passes by. For every step, the very first intersection (`intersections[0]`) corresponds to the
|
||||||
location of the StepManeuver. Further intersections are listed for every cross-way until the next turn instruction.
|
location of the StepManeuver. Further intersections are listed for every cross-way until the next turn instruction.
|
||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
@ -926,15 +926,15 @@ location of the StepManeuver. Further intersections are listed for every cross-w
|
|||||||
|
|
||||||
### Waypoint object
|
### Waypoint object
|
||||||
|
|
||||||
Object used to describe waypoint on a route.
|
The object is used to describe the waypoint on a route.
|
||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `name` Name of the street the coordinate snapped to
|
- `name` Name of the street the coordinate snapped to
|
||||||
- `location` Array that contains the `[longitude, latitude]` pair of the snapped coordinate
|
- `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
|
- `distance` The distance, in meters, from the input coordinate to the snapped coordinate
|
||||||
- `hint` Unique internal identifier of the segment (ephemeral, not constant over data updates)
|
- `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.
|
This can be used on subsequent requests 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.
|
E.g. you can use the `hint` value obtained by the `nearest` query as `hint` values for `route` inputs.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
@ -953,14 +953,14 @@ Object used to describe waypoint on a route.
|
|||||||
|
|
||||||
## Flatbuffers format
|
## Flatbuffers format
|
||||||
|
|
||||||
Default response format is `json`, but OSRM supports binary [`flatbuffers`](https://google.github.io/flatbuffers/) format, which
|
The 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`.
|
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
|
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
|
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.
|
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
|
`Flatbuffers` format provides exactly the same data, as `json` format with a slightly different layout, which was optimized to minimize
|
||||||
in-transfer size.
|
in-transfer size.
|
||||||
|
|
||||||
### Root object
|
### Root object
|
||||||
@ -971,7 +971,7 @@ Root object is the only object, available from a 'raw' `flatbuffers` buffer. It
|
|||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
- `error`: `bool` Marks response as erroneous. Erroneus response should include `code` field set, all the other field may not present.
|
- `error`: `bool` Marks response as erroneous. An erroneous response should include the `code` fieldset, all the other fields may not be present.
|
||||||
- `code`: `Error` Error description object, only present, when `error` is `true`
|
- `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.
|
- `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.
|
- `routes`: `[RouteObject]` Array of `RouteObject` objects. May be empty or absent. Should present for Route/Trip/Match services call.
|
||||||
@ -988,14 +988,14 @@ Contains error information.
|
|||||||
|
|
||||||
### Waypoint object
|
### Waypoint object
|
||||||
|
|
||||||
Almost same as `json` Waypoint object. The following properties differ:
|
Almost the same as `json` Waypoint object. The following properties differ:
|
||||||
|
|
||||||
- `location`: `Position` Same as `json` location field, but different format.
|
- `location`: `Position` Same as `json` location field, but different format.
|
||||||
- `nodes`: `Uint64Pair` Same as `json` nodes field, but different format.
|
- `nodes`: `Uint64Pair` Same as `json` nodes field, but different format.
|
||||||
|
|
||||||
### RouteObject object
|
### RouteObject object
|
||||||
|
|
||||||
Almost same as `json` Route object. The following properties differ:
|
Almost the 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.
|
- `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.
|
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
||||||
@ -1003,14 +1003,14 @@ Almost same as `json` Route object. The following properties differ:
|
|||||||
|
|
||||||
### Leg object
|
### Leg object
|
||||||
|
|
||||||
Almost same as `json` Leg object. The following properties differ:
|
Almost the same as `json` Leg object. The following properties differ:
|
||||||
|
|
||||||
- `annotations`: `Annotation` Same as `json` annotation field, but different format.
|
- `annotations`: `Annotation` Same as `json` annotation field, but different format.
|
||||||
- `steps`: `[Step]` Same as `step` annotation field, but different format.
|
- `steps`: `[Step]` Same as `step` annotation field, but different format.
|
||||||
|
|
||||||
### Step object
|
### Step object
|
||||||
|
|
||||||
Almost same as `json` Step object. The following properties differ:
|
Almost the 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.
|
- `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.
|
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
|
||||||
@ -1018,7 +1018,7 @@ Almost same as `json` Step object. The following properties differ:
|
|||||||
|
|
||||||
| `type` | Description |
|
| `type` | Description |
|
||||||
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `Turn` | a basic turn into direction of the `modifier` |
|
| `Turn` | a basic turn into the direction of the `modifier` |
|
||||||
| `NewName` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `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 |
|
| `Depart` | indicates the departure of the leg |
|
||||||
| `Arrive` | indicates the destination of the leg |
|
| `Arrive` | indicates the destination of the leg |
|
||||||
@ -1030,9 +1030,9 @@ Almost same as `json` Step object. The following properties differ:
|
|||||||
| `Continue` | Turn in direction of `modifier` to stay on the same road |
|
| `Continue` | Turn in direction of `modifier` to stay on the same road |
|
||||||
| `Roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
|
| `Roundabout` | traverse roundabout, 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). |
|
| `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`. |
|
| `RoundaboutTurn` | Describes a turn at a small roundabout that should be treated as a normal turn. The `modifier` indicates the turn direction. Example instruction: `At the roundabout turn left`. |
|
||||||
| `Notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
|
| `Notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
|
||||||
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceeded by a `roundabout` instruction) |
|
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
||||||
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||||
|
|
||||||
- `driving_side`: `bool` Ttrue stands for the left side driving.
|
- `driving_side`: `bool` Ttrue stands for the left side driving.
|
||||||
@ -1040,14 +1040,14 @@ Almost same as `json` Step object. The following properties differ:
|
|||||||
|
|
||||||
### Intersection object
|
### Intersection object
|
||||||
|
|
||||||
Almost same as `json` Intersection object. The following properties differ:
|
Almost the same as `json` Intersection object. The following properties differ:
|
||||||
|
|
||||||
- `location`: `Position` Same as `json` location property, but in different format.
|
- `location`: `Position` Same as `json` location property, but in a different format.
|
||||||
- `lanes`: `[Lane]` Array of `Lane` objects.
|
- `lanes`: `[Lane]` Array of `Lane` objects.
|
||||||
|
|
||||||
### Lane object
|
### Lane object
|
||||||
|
|
||||||
Almost same as `json` Lane object. The following properties differ:
|
Almost the same as `json` Lane object. The following properties differ:
|
||||||
|
|
||||||
- `indications`: `Turn` Array of `Turn` enum values.
|
- `indications`: `Turn` Array of `Turn` enum values.
|
||||||
|
|
||||||
@ -1065,14 +1065,14 @@ Almost same as `json` Lane object. The following properties differ:
|
|||||||
|
|
||||||
### StepManeuver object
|
### StepManeuver object
|
||||||
|
|
||||||
Almost same as `json` StepManeuver object. The following properties differ:
|
Almost the same as `json` StepManeuver object. The following properties differ:
|
||||||
|
|
||||||
- `location`: `Position` Same as `json` location property, but in different format.
|
- `location`: `Position` Same as `json` location property, but in a different format.
|
||||||
- `type`: `ManeuverType` Type of a maneuver (enum)
|
- `type`: `ManeuverType` Type of a maneuver (enum)
|
||||||
|
|
||||||
| `type` | Description |
|
| `type` | Description |
|
||||||
|------------------|--------------------------------------------------------------|
|
|------------------|--------------------------------------------------------------|
|
||||||
| `Turn` | a basic turn into direction of the `modifier` |
|
| `Turn` | a basic turn into the direction of the `modifier` |
|
||||||
| `NewName` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `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 |
|
| `Depart` | indicates the departure of the leg |
|
||||||
| `Arrive` | indicates the destination of the leg |
|
| `Arrive` | indicates the destination of the leg |
|
||||||
@ -1084,16 +1084,16 @@ Almost same as `json` StepManeuver object. The following properties differ:
|
|||||||
| `Continue` | Turn in direction of `modifier` to stay on the same road |
|
| `Continue` | Turn in direction of `modifier` to stay on the same road |
|
||||||
| `Roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
|
| `Roundabout` | traverse roundabout, 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). |
|
| `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`. |
|
| `RoundaboutTurn` | Describes a turn at a small roundabout that should be treated as a normal turn. The `modifier` indicates the turn direction. Example instruction: `At the roundabout turn left`. |
|
||||||
| `Notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
|
| `Notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
|
||||||
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceeded by a `roundabout` instruction) |
|
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
|
||||||
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
|
||||||
|
|
||||||
- `modifier`: `Turn` Maneuver turn (enum)
|
- `modifier`: `Turn` Maneuver turn (enum)
|
||||||
|
|
||||||
### Annotation object
|
### Annotation object
|
||||||
|
|
||||||
Exactly same as `json` annotation object.
|
Exactly the same as `json` annotation object.
|
||||||
|
|
||||||
|
|
||||||
### Position object
|
### Position object
|
||||||
@ -1114,11 +1114,11 @@ A pair of long long integers. Used only by `Waypoint` object.
|
|||||||
|
|
||||||
### Table object
|
### Table object
|
||||||
|
|
||||||
Almost same as `json` Table object. The main difference is that 'sources' field is absent and root's object 'waypoints' field is
|
Almost the same as `json` Table object. The main difference is that 'sources' field is absent and the root's object 'waypoints' field is
|
||||||
used instead. All the other differences follow:
|
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]
|
- `durations`: `[float]` Flat representation of a durations matrix. Element at row;col can be addressed as [row * cols + col]
|
||||||
- `distances`: `[float]` Flat representation of a destinations 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 addressed as [row * cols + col]
|
||||||
- `destinations`: `[Waypoint]` Array of `Waypoint` objects. Will be `null` if `skip_waypoints` will be set to `true`
|
- `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.
|
- `rows`: `ushort` Number of rows in durations/destinations matrices.
|
||||||
- `cols`: `ushort` Number of cols in durations/destinations matrices.
|
- `cols`: `ushort` Number of cols in durations/destinations matrices.
|
||||||
|
|||||||
@ -20,23 +20,24 @@ var osrm = new OSRM('network.osrm');
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`)
|
- `options` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`)
|
||||||
- `options.algorithm` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'.
|
- `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'.
|
||||||
Make sure you prepared the dataset with the correct toolchain.
|
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.
|
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/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.
|
This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
|
||||||
- `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`
|
- `options.dataset_name` **[String](https://developer.mozilla.org/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.
|
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*
|
- `options.memory_file` **[String](https://developer.mozilla.org/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`.
|
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.mmap_memory` **[Boolean](https://developer.mozilla.org/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.path` **[String](https://developer.mozilla.org/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_trip` **[Number](https://developer.mozilla.org/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).
|
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
|
||||||
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
|
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
|
||||||
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited).
|
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited).
|
||||||
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
|
- `options.max_radius_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. radius size supported in map matching query (default: 5).
|
||||||
- `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max.number of alternatives supported in alternative routes query (default: 3).
|
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
|
||||||
|
- `options.max_alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternatives supported in alternative routes query (default: 3).
|
||||||
|
|
||||||
### route
|
### route
|
||||||
|
|
||||||
@ -44,39 +45,42 @@ Returns the fastest route between two or more coordinates while visiting the way
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query.
|
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query.
|
||||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
- `options.bearings` **[Array](https://developer.mozilla.org/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`.
|
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.radiuses` **[Array](https://developer.mozilla.org/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.hints` **[Array](https://developer.mozilla.org/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.exclude` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** List of classes to avoid, order does not matter.
|
||||||
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
|
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/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` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes.
|
- `options.alternatives` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
|
||||||
|
- `options.alternatives` **[Number](https://developer.mozilla.org/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`)
|
_Please note that even if alternative routes are requested, a result cannot be guaranteed._ (optional, default `0`)
|
||||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
|
- `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
|
||||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
- `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
|
- `options.overview` **[String](https://developer.mozilla.org/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.continue_straight` **[Boolean](https://developer.mozilla.org/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.approaches` **[Array](https://developer.mozilla.org/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`
|
`null`/`true`/`false`
|
||||||
- `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.waypoints` **[Array](https://developer.mozilla.org/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.
|
||||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||||
|
- `options.snapping` **[String](https://developer.mozilla.org/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.skip_waypoints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 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. (optional, default `false`)
|
||||||
|
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var osrm = new OSRM("berlin-latest.osrm");
|
var osrm = new OSRM("berlin-latest.osrm");
|
||||||
osrm.route({coordinates: [[13.438640,52.519930], [13.415852,52.513191]]}, function(err, result) {
|
osrm.route({coordinates: [[52.519930,13.438640], [52.513191,13.415852]]}, function(err, result) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
console.log(result.waypoints); // array of Waypoint objects representing all waypoints in order
|
console.log(result.waypoints); // array of Waypoint objects representing all waypoints in order
|
||||||
console.log(result.routes); // array of Route objects ordered by descending recommendation rank
|
console.log(result.routes); // array of Route objects ordered by descending recommendation rank
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank.
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank.
|
||||||
|
|
||||||
### nearest
|
### nearest
|
||||||
|
|
||||||
@ -86,18 +90,19 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query.
|
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query.
|
||||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
- `options.bearings` **[Array](https://developer.mozilla.org/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`.
|
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.radiuses` **[Array](https://developer.mozilla.org/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.hints` **[Array](https://developer.mozilla.org/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.generate_hints` **[Boolean](https://developer.mozilla.org/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.
|
- `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
|
||||||
Must be an integer greater than or equal to `1`. (optional, default `1`)
|
Must be an integer greater than or equal to `1`. (optional, default `1`)
|
||||||
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
- `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.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
- `options.snapping` **[String](https://developer.mozilla.org/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/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -113,37 +118,34 @@ osrm.nearest(options, function(err, response) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`.
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`.
|
||||||
**`waypoints`**: array of [`Ẁaypoint`](#waypoint) objects sorted by distance to the input coordinate.
|
**`waypoints`**: array of [`Ẁaypoint`](#waypoint) objects sorted by distance to the input coordinate.
|
||||||
Each object has an additional `distance` property, which is the distance in meters to the supplied input coordinate.
|
Each object has an additional `distance` property, which is the distance in meters to the supplied input coordinate.
|
||||||
|
|
||||||
### table
|
### table
|
||||||
|
|
||||||
Computes duration table for the given locations. Allows for both symmetric and asymmetric
|
Computes duration table for the given locations. Allows for both symmetric and asymmetric tables.
|
||||||
tables. Optionally returns distance table.
|
Optionally returns distance table.
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query.
|
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query.
|
||||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
- `options.bearings` **[Array](https://developer.mozilla.org/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`.
|
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.radiuses` **[Array](https://developer.mozilla.org/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.hints` **[Array](https://developer.mozilla.org/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.generate_hints` **[Boolean](https://developer.mozilla.org/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
|
- `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use
|
||||||
use
|
|
||||||
location with given index as source. Default is to use all.
|
location with given index as source. Default is to use all.
|
||||||
- `options.destinations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer <
|
- `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
|
||||||
#coordinates`) to use location with given index as destination. Default is to use all.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
- `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.fallback_speed` **[Number](https://developer.mozilla.org/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_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/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 distance between two points.
|
||||||
- `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/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.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/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.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/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default), `[distance']` (return the distance matrix), or `['duration', distance']` (return both the duration matrix and the distance matrix).
|
||||||
- `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/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -158,14 +160,17 @@ var options = {
|
|||||||
};
|
};
|
||||||
osrm.table(options, function(err, response) {
|
osrm.table(options, function(err, response) {
|
||||||
console.log(response.durations); // array of arrays, matrix in row-major order
|
console.log(response.durations); // array of arrays, matrix in row-major order
|
||||||
|
console.log(response.distances); // array of arrays, matrix in row-major order
|
||||||
console.log(response.sources); // array of Waypoint objects
|
console.log(response.sources); // array of Waypoint objects
|
||||||
console.log(response.destinations); // array of Waypoint objects
|
console.log(response.destinations); // array of Waypoint objects
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `sources`, and `destinations`.
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `distances`, `sources`, and `destinations`.
|
||||||
**`durations`**: array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint.
|
**`durations`**: array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint.
|
||||||
Values are given in seconds.
|
Values are given in seconds.
|
||||||
|
**`distances`**: array of arrays that stores the matrix in row-major order. `distances[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint.
|
||||||
|
Values are given in meters.
|
||||||
**`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order.
|
**`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order.
|
||||||
**`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order.
|
**`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order.
|
||||||
**`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.
|
**`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.
|
||||||
@ -181,10 +186,10 @@ and what weights they have applied.
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `ZXY` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like
|
- `ZXY` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like
|
||||||
[wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames)
|
[wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames)
|
||||||
and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/).
|
and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/).
|
||||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -208,23 +213,23 @@ if they can not be matched successfully.
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query.
|
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query.
|
||||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
- `options.bearings` **[Array](https://developer.mozilla.org/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`.
|
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.hints` **[Array](https://developer.mozilla.org/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.generate_hints` **[Boolean](https://developer.mozilla.org/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.steps` **[Boolean](https://developer.mozilla.org/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.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
|
- `options.overview` **[String](https://developer.mozilla.org/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.timestamps` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp).
|
- `options.timestamps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp).
|
||||||
- `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.radiuses` **[Array](https://developer.mozilla.org/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.gaps` **[String](https://developer.mozilla.org/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`).
|
- `options.tidy` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allows the input track modification to obtain better matching quality for noisy tracks. (optional, default `false`)
|
||||||
- `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.waypoints` **[Array](https://developer.mozilla.org/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.
|
- `options.snapping` **[String](https://developer.mozilla.org/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)**
|
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -241,12 +246,15 @@ osrm.match(options, function(err, response) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
|
||||||
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
|
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
|
||||||
If the trace point was ommited by map matching because it is an outlier, the entry will be null.
|
If the trace point was ommited by map matching because it is an outlier, the entry will be null.
|
||||||
Each `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the
|
Each `Waypoint` object has the following additional properties,
|
||||||
[`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of
|
1) `matchings_index`: Index to the
|
||||||
|
[`Route`](#route) object in matchings the sub-trace was matched to,
|
||||||
|
2) `waypoint_index`: Index of
|
||||||
the waypoint inside the matched route.
|
the waypoint inside the matched route.
|
||||||
|
3) `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching.
|
||||||
**`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property,
|
**`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property,
|
||||||
which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct.
|
which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct.
|
||||||
|
|
||||||
@ -274,23 +282,23 @@ Right now, the following combinations are possible:
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
|
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
|
||||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
- `options.bearings` **[Array](https://developer.mozilla.org/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`.
|
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.radiuses` **[Array](https://developer.mozilla.org/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.hints` **[Array](https://developer.mozilla.org/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.generate_hints` **[Boolean](https://developer.mozilla.org/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.steps` **[Boolean](https://developer.mozilla.org/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.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
|
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
|
||||||
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
|
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
|
||||||
- `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.source` **[String](https://developer.mozilla.org/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.destination` **[String](https://developer.mozilla.org/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`.
|
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||||
- `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.snapping` **[String](https://developer.mozilla.org/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)**
|
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -312,19 +320,31 @@ osrm.trip(options, function(err, response) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`.
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`.
|
||||||
**`waypoints`**: an array of [`Waypoint`](#waypoint) objects representing all waypoints in input order.
|
**`waypoints`**: an array of [`Waypoint`](#waypoint) objects representing all waypoints in input order.
|
||||||
Each Waypoint object has the following additional properties,
|
Each Waypoint object has the following additional properties,
|
||||||
1) `trips_index`: index to trips of the sub-trip the point was matched to, and
|
1) `trips_index`: index to trips of the sub-trip the point was matched to, and
|
||||||
2) `waypoint_index`: index of the point in the trip.
|
2) `waypoint_index`: index of the point in the trip.
|
||||||
**`trips`**: an array of [`Route`](#route) objects that assemble the trace.
|
**`trips`**: an array of [`Route`](#route) objects that assemble the trace.
|
||||||
|
|
||||||
## Plugin behaviour
|
## Configuration
|
||||||
|
|
||||||
All plugins support a second additional object that is available to configure some NodeJS specific behaviours.
|
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.
|
**Parameters**
|
||||||
- `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.
|
|
||||||
|
- `plugin_config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Object literal containing parameters for the trip query.
|
||||||
|
- `plugin_config.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls.
|
||||||
|
Valid options are `object` (default if `options.format` is
|
||||||
|
`json`), which returns a standard Javascript object, as described above, and `buffer`(default if
|
||||||
|
`options.format` is `flatbuffers`), which will return a NodeJS
|
||||||
|
**[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers
|
||||||
|
object. 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. Also note that `options.format` set to `flatbuffers`
|
||||||
|
cannot be used with `plugin_config.format` set to `object`. `json_buffer` is deprecated alias for
|
||||||
|
`buffer`.
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -336,7 +356,7 @@ var options = {
|
|||||||
[13.374481201171875, 52.506191342034576]
|
[13.374481201171875, 52.506191342034576]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
osrm.route(options, { format: "json_buffer" }, function(err, response) {
|
osrm.route(options, { format: "buffer" }, function(err, response) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log(response.toString("utf-8"));
|
console.log(response.toString("utf-8"));
|
||||||
});
|
});
|
||||||
@ -350,7 +370,7 @@ Represents a route through (potentially multiple) waypoints.
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- **documentation** in
|
- `external` **documentation** in
|
||||||
[`osrm-backend`](../http.md#route-object)
|
[`osrm-backend`](../http.md#route-object)
|
||||||
|
|
||||||
### RouteLeg
|
### RouteLeg
|
||||||
@ -359,7 +379,7 @@ Represents a route between two waypoints.
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- **documentation** in
|
- `external` **documentation** in
|
||||||
[`osrm-backend`](../http.md#routeleg-object)
|
[`osrm-backend`](../http.md#routeleg-object)
|
||||||
|
|
||||||
### RouteStep
|
### RouteStep
|
||||||
@ -369,14 +389,14 @@ single way to the subsequent step.
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- **documentation** in
|
- `external` **documentation** in
|
||||||
[`osrm-backend`](../http.md#routestep-object)
|
[`osrm-backend`](../http.md#routestep-object)
|
||||||
|
|
||||||
### StepManeuver
|
### StepManeuver
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- **documentation** in
|
- `external` **documentation** in
|
||||||
[`osrm-backend`](../http.md#stepmaneuver-object)
|
[`osrm-backend`](../http.md#stepmaneuver-object)
|
||||||
|
|
||||||
### Waypoint
|
### Waypoint
|
||||||
@ -385,5 +405,5 @@ Object used to describe waypoint on a route.
|
|||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- **documentation** in
|
- `external` **documentation** in
|
||||||
[`osrm-backend`](../http.md#waypoint-object)
|
[`osrm-backend`](../http.md#waypoint-object)
|
||||||
|
|||||||
@ -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`
|
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`,
|
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
|
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
|
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:
|
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.
|
`rm -rf node_modules && npm install` locally.
|
||||||
|
|||||||
@ -12,20 +12,14 @@ Prepare directories for dependencies, build and target file location.Target dire
|
|||||||
|
|
||||||
### Bzip2
|
### Bzip2
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download from https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
|
||||||
* 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.
|
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||||
3. Issue `nmake /f makefile.msc`
|
3. Issue `nmake /f makefile.msc`
|
||||||
4. Copy bzlib.h to $target\include and libbz2.lib to $target\lib
|
4. Copy bzlib.h to $target\include and libbz2.lib to $target\lib
|
||||||
|
|
||||||
### ZLib
|
### ZLib
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download https://www.zlib.net/zlib-1.2.11.tar.gz
|
||||||
* 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.
|
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||||
3. Switch to `contrib\vstudio\vc14`
|
3. Switch to `contrib\vstudio\vc14`
|
||||||
4. If needed, open `zlibvc.sln` with Visual Studio and retarget to your version of compiler and SDK.
|
4. If needed, open `zlibvc.sln` with Visual Studio and retarget to your version of compiler and SDK.
|
||||||
@ -34,10 +28,8 @@ Prepare directories for dependencies, build and target file location.Target dire
|
|||||||
|
|
||||||
### ICU
|
### ICU
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download 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://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
|
* 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
|
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.
|
3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||||
@ -48,10 +40,7 @@ Prepare directories for dependencies, build and target file location.Target dire
|
|||||||
|
|
||||||
### Boost
|
### Boost
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download and unpack https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip
|
||||||
* 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.
|
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||||
3. Build b2:
|
3. Build b2:
|
||||||
bootstrap.bat --with-toolset=msvc-14.2
|
bootstrap.bat --with-toolset=msvc-14.2
|
||||||
@ -61,9 +50,7 @@ Prepare directories for dependencies, build and target file location.Target dire
|
|||||||
|
|
||||||
### Expat
|
### Expat
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download and unpack https://github.com/libexpat/libexpat/archive/R_2_2_9.zip
|
||||||
* 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.
|
2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
||||||
3. Configure build my calling cmake:
|
3. Configure build my calling cmake:
|
||||||
mkdir expat\build
|
mkdir expat\build
|
||||||
@ -74,9 +61,7 @@ Prepare directories for dependencies, build and target file location.Target dire
|
|||||||
|
|
||||||
### LUA
|
### LUA
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download and unpack https://www.lua.org/ftp/lua-5.3.5.tar.gz
|
||||||
* 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.
|
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:
|
3. Lua doesn't have native MSVC support, so you have to compile it by hand:
|
||||||
cd src
|
cd src
|
||||||
@ -88,9 +73,7 @@ Prepare directories for dependencies, build and target file location.Target dire
|
|||||||
|
|
||||||
### TBB
|
### TBB
|
||||||
|
|
||||||
1. Download either from Wolt OSRM mirror or original distribution and unpack.
|
1. Download and unpack https://github.com/oneapi-src/oneTBB/archive/v2020.2.zip
|
||||||
* 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
|
2. Retarget by opening build\vs2013\makefile.sln
|
||||||
3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree.
|
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`
|
4. Switch to build\vs2013 and build: `msbuild makefle.sln /nologo /p:Configuration=Release /p:Platform=x64`
|
||||||
|
|||||||
@ -1,283 +0,0 @@
|
|||||||
# Locate Intel Threading Building Blocks include paths and libraries
|
|
||||||
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
|
|
||||||
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
|
|
||||||
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
|
|
||||||
# Florian Uhlig <F.Uhlig _at_ gsi.de>,
|
|
||||||
# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
|
|
||||||
|
|
||||||
# The MIT License
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011 Hannes Hofmann
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
|
|
||||||
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
|
|
||||||
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
|
|
||||||
# in the TBB installation directory (TBB_INSTALL_DIR).
|
|
||||||
#
|
|
||||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
|
||||||
#
|
|
||||||
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
|
|
||||||
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
|
|
||||||
# which architecture to use
|
|
||||||
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
|
|
||||||
# which compiler to use (detected automatically on Windows)
|
|
||||||
|
|
||||||
# This module respects
|
|
||||||
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
|
|
||||||
|
|
||||||
# This module defines
|
|
||||||
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
|
|
||||||
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
|
|
||||||
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
|
|
||||||
# TBB_INSTALL_DIR, the base TBB install directory
|
|
||||||
# TBB_LIBRARIES, the libraries to link against to use TBB.
|
|
||||||
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
|
|
||||||
# TBB_FOUND, If false, don't try to use TBB.
|
|
||||||
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
|
|
||||||
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
# has em64t/vc8 em64t/vc9
|
|
||||||
# has ia32/vc7.1 ia32/vc8 ia32/vc9
|
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
if (MSVC71)
|
|
||||||
set (_TBB_COMPILER "vc7.1")
|
|
||||||
endif(MSVC71)
|
|
||||||
if (MSVC80)
|
|
||||||
set(_TBB_COMPILER "vc8")
|
|
||||||
endif(MSVC80)
|
|
||||||
if (MSVC90)
|
|
||||||
set(_TBB_COMPILER "vc9")
|
|
||||||
endif(MSVC90)
|
|
||||||
if(MSVC10)
|
|
||||||
set(_TBB_COMPILER "vc10")
|
|
||||||
endif(MSVC10)
|
|
||||||
# Todo: add other Windows compilers such as ICL.
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif (WIN32)
|
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
if (APPLE)
|
|
||||||
# MAC
|
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
|
|
||||||
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
# default flavor on apple: ia32/cc4.0.1_os10.4.9
|
|
||||||
# Jiri: There is no reason to presume there is only one flavor and
|
|
||||||
# that user's setting of variables should be ignored.
|
|
||||||
if(NOT TBB_COMPILER)
|
|
||||||
set(_TBB_COMPILER "cc4.0.1_os10.4.9")
|
|
||||||
elseif (NOT TBB_COMPILER)
|
|
||||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
|
||||||
endif(NOT TBB_COMPILER)
|
|
||||||
if(NOT TBB_ARCHITECTURE)
|
|
||||||
set(_TBB_ARCHITECTURE "ia32")
|
|
||||||
elseif(NOT TBB_ARCHITECTURE)
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif(NOT TBB_ARCHITECTURE)
|
|
||||||
else (APPLE)
|
|
||||||
# LINUX
|
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
|
|
||||||
# has ia32/*
|
|
||||||
# has itanium/*
|
|
||||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif (APPLE)
|
|
||||||
endif (UNIX)
|
|
||||||
|
|
||||||
if (CMAKE_SYSTEM MATCHES "SunOS.*")
|
|
||||||
# SUN
|
|
||||||
# not yet supported
|
|
||||||
# has em64t/cc3.4.3_kernel5.10
|
|
||||||
# has ia32/*
|
|
||||||
endif (CMAKE_SYSTEM MATCHES "SunOS.*")
|
|
||||||
|
|
||||||
|
|
||||||
#-- Clear the public variables
|
|
||||||
set (TBB_FOUND "NO")
|
|
||||||
|
|
||||||
|
|
||||||
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
|
|
||||||
# first: use CMake variable TBB_INSTALL_DIR
|
|
||||||
if (TBB_INSTALL_DIR)
|
|
||||||
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
|
|
||||||
endif (TBB_INSTALL_DIR)
|
|
||||||
# second: use environment variable
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
|
||||||
# Intel recommends setting TBB21_INSTALL_DIR
|
|
||||||
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
|
||||||
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
|
||||||
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
# third: try to find path automatically
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
if (_TBB_DEFAULT_INSTALL_DIR)
|
|
||||||
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
|
|
||||||
endif (_TBB_DEFAULT_INSTALL_DIR)
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
# sanity check
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
|
|
||||||
else (NOT _TBB_INSTALL_DIR)
|
|
||||||
# finally: set the cached CMake variable TBB_INSTALL_DIR
|
|
||||||
if (NOT TBB_INSTALL_DIR)
|
|
||||||
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
|
|
||||||
mark_as_advanced(TBB_INSTALL_DIR)
|
|
||||||
endif (NOT TBB_INSTALL_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
#-- A macro to rewrite the paths of the library. This is necessary, because
|
|
||||||
# find_library() always found the em64t/vc9 version of the TBB libs
|
|
||||||
macro(TBB_CORRECT_LIB_DIR var_name)
|
|
||||||
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
|
||||||
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
|
||||||
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
|
||||||
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
endmacro(TBB_CORRECT_LIB_DIR var_content)
|
|
||||||
|
|
||||||
|
|
||||||
#-- Look for include directory and set ${TBB_INCLUDE_DIR}
|
|
||||||
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
|
|
||||||
# Jiri: tbbvars now sets the CPATH environment variable to the directory
|
|
||||||
# containing the headers.
|
|
||||||
find_path(TBB_INCLUDE_DIR
|
|
||||||
tbb/task_scheduler_init.h
|
|
||||||
PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
|
|
||||||
)
|
|
||||||
mark_as_advanced(TBB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
#-- Look for libraries
|
|
||||||
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
|
|
||||||
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
|
||||||
set (_TBB_LIBRARY_DIR
|
|
||||||
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
|
|
||||||
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
|
|
||||||
)
|
|
||||||
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
|
||||||
# Jiri: This block isn't mutually exclusive with the previous one
|
|
||||||
# (hence no else), instead I test if the user really specified
|
|
||||||
# the variables in question.
|
|
||||||
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
|
||||||
# HH: deprecated
|
|
||||||
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
|
|
||||||
# Jiri: It doesn't hurt to look in more places, so I store the hints from
|
|
||||||
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
|
|
||||||
# variables and search them both.
|
|
||||||
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
|
|
||||||
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
|
||||||
|
|
||||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
|
||||||
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
|
|
||||||
|
|
||||||
# Jiri: No reason not to check the default paths. From recent versions,
|
|
||||||
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
|
|
||||||
# variables, which now point to the directories of the lib files.
|
|
||||||
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
|
|
||||||
# argument instead of the implicit PATHS as it isn't hard-coded
|
|
||||||
# but computed by system introspection. Searching the LIBRARY_PATH
|
|
||||||
# and LD_LIBRARY_PATH environment variables is now even more important
|
|
||||||
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
|
|
||||||
# the use of TBB built from sources.
|
|
||||||
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
|
|
||||||
#Extract path from TBB_LIBRARY name
|
|
||||||
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
|
|
||||||
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
|
|
||||||
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
|
|
||||||
|
|
||||||
#-- Look for debug libraries
|
|
||||||
# Jiri: Changed the same way as for the release libraries.
|
|
||||||
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
|
|
||||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
|
||||||
# Extract path from TBB_LIBRARY_DEBUG name
|
|
||||||
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
|
|
||||||
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
|
|
||||||
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
if (TBB_INCLUDE_DIR)
|
|
||||||
if (TBB_LIBRARY)
|
|
||||||
set (TBB_FOUND "YES")
|
|
||||||
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
|
|
||||||
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
|
|
||||||
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
|
|
||||||
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
|
|
||||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
|
||||||
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
|
|
||||||
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
|
|
||||||
message(STATUS "Found Intel TBB")
|
|
||||||
endif (TBB_LIBRARY)
|
|
||||||
endif (TBB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if (NOT TBB_FOUND)
|
|
||||||
message("ERROR: Intel TBB NOT found!")
|
|
||||||
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
|
|
||||||
# do only throw fatal, if this pkg is REQUIRED
|
|
||||||
if (TBB_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "Could NOT find TBB library.")
|
|
||||||
endif (TBB_FIND_REQUIRED)
|
|
||||||
endif (NOT TBB_FOUND)
|
|
||||||
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
|
|
||||||
if (TBB_FOUND)
|
|
||||||
set(TBB_INTERFACE_VERSION 0)
|
|
||||||
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
|
|
||||||
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
|
|
||||||
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
|
|
||||||
endif (TBB_FOUND)
|
|
||||||
1
example/cmake/FindTBB.cmake
Symbolic link
1
example/cmake/FindTBB.cmake
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cmake/FindTBB.cmake
|
||||||
@ -28,7 +28,7 @@ Feature: Bicycle - Route around alleys
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | a:nodes | weight | # |
|
| from | to | a:nodes | weight | # |
|
||||||
| a | f | 1:2:3:6 | 200.4 | Avoids d,e,f |
|
| a | f | 1:2:3:6 | 196.2 | Avoids d,e,f |
|
||||||
| a | e | 1:2:5 | 176.4 | Take the alley b,e if neccessary |
|
| a | e | 1:2:5 | 172.2 | Take the alley b,e if neccessary |
|
||||||
| d | f | 4:1:2:3:6 | 252.6 | Avoids the alley d,e,f |
|
| d | f | 4:1:2:3:6 | 248.4 | Avoids the alley d,e,f |
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ Feature: Bicycle - Exclude flags
|
|||||||
|
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | matchings | duration |
|
| trace | matchings | duration |
|
||||||
| abcf | abcf | 301.2 |
|
| abcf | abcf | 301 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | f |
|
| | a | f |
|
||||||
|
|||||||
@ -9,7 +9,7 @@ Feature: Bike - Max speed restrictions
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | maxspeed | bothw |
|
| highway | maxspeed | bothw |
|
||||||
| residential | | 15 km/h |
|
| residential | | 15 km/h |
|
||||||
| residential | 10 | 9 km/h |
|
| residential | 10 | 10 km/h |
|
||||||
|
|
||||||
Scenario: Bicycle - Ignore maxspeed when higher than way speed
|
Scenario: Bicycle - Ignore maxspeed when higher than way speed
|
||||||
Then routability should be
|
Then routability should be
|
||||||
@ -65,12 +65,12 @@ Feature: Bike - Max speed restrictions
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
| maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
|
| maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
|
||||||
| | | | 15 km/h | 15 km/h |
|
| | | | 15 km/h | 15 km/h |
|
||||||
| 10 | | | 9 km/h | 9 km/h |
|
| 10 | | | 10 km/h | 10 km/h |
|
||||||
| | 10 | | 9 km/h | 15 km/h |
|
| | 10 | | 10 km/h | 15 km/h |
|
||||||
| | | 10 | 14 km/h | 9 km/h |
|
| | | 10 | 15 km/h | 10 km/h |
|
||||||
| 2 | 10 | | 9 km/h | 2 km/h |
|
| 2 | 10 | | 10 km/h | 2 km/h |
|
||||||
| 2 | | 10 | 2 km/h | 9 km/h |
|
| 2 | | 10 | 2 km/h | 10 km/h |
|
||||||
| 2 | 5 | 10 | 5 km/h | 9 km/h |
|
| 2 | 5 | 10 | 5 km/h | 10 km/h |
|
||||||
|
|
||||||
Scenario: Bike - Maxspeed should not allow routing on unroutable ways
|
Scenario: Bike - Maxspeed should not allow routing on unroutable ways
|
||||||
Then routability should be
|
Then routability should be
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| tertiary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| tertiary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| residential | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| residential | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| cycleway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| cycleway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| footway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| footway | track | 14 km/h | 14 km/h | 4.2 | 4.2 |
|
||||||
| motorway | lane | 15 km/h | | 4.2 | |
|
| motorway | lane | 15 km/h | | 4.2 | |
|
||||||
| primary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| primary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| secondary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| secondary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
@ -41,7 +41,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| primary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| primary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| secondary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| secondary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| tertiary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| tertiary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| residential | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| residential | lane | 14 km/h | 14 km/h | 4.2 | 4.2 |
|
||||||
| cycleway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| cycleway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| footway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| footway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| motorway | shared_lane | 15 km/h | | 4.2 | |
|
| motorway | shared_lane | 15 km/h | | 4.2 | |
|
||||||
@ -59,7 +59,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| tertiary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
|
| tertiary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
|
||||||
| residential | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| residential | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| cycleway | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| cycleway | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| footway | track | | 15 km/h | 4 km/h +-1 | 4.2 | 1.1 |
|
| footway | track | | 14 km/h | 4 km/h +-1 | 4.2 | 1.1 |
|
||||||
| motorway | | track | 15 km/h | | 4.2 | |
|
| motorway | | track | 15 km/h | | 4.2 | |
|
||||||
| primary | | track | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
| primary | | track | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
||||||
| secondary | | track | 15 km/h | 15 km/h | 2.7 | 4.2 |
|
| secondary | | track | 15 km/h | 15 km/h | 2.7 | 4.2 |
|
||||||
@ -67,7 +67,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| primary_link | | track | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
| primary_link | | track | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
||||||
| secondary_link | | track | 15 km/h | 15 km/h | 2.7 | 4.2 |
|
| secondary_link | | track | 15 km/h | 15 km/h | 2.7 | 4.2 |
|
||||||
| tertiary_link | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
|
| tertiary_link | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
|
||||||
| residential | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| residential | | track | 14 km/h | 14 km/h | 4.2 | 4.2 |
|
||||||
| cycleway | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| cycleway | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
| footway | | track | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 |
|
| footway | | track | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 |
|
||||||
| motorway | lane | | 15 km/h | | 4.2 | |
|
| motorway | lane | | 15 km/h | | 4.2 | |
|
||||||
@ -75,7 +75,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| secondary | lane | | 15 km/h | 15 km/h | 4.2 | 2.7 |
|
| secondary | lane | | 15 km/h | 15 km/h | 4.2 | 2.7 |
|
||||||
| tertiary | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
|
| tertiary | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
|
||||||
| primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
|
| primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
|
||||||
| secondary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.7 |
|
| secondary_link | lane | | 14 km/h | 14 km/h | 4.2 | 2.7 |
|
||||||
| tertiary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
|
| tertiary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
|
||||||
| residential | lane | | 15 km/h +-1 | 15 km/h +-1 | 4.2 | 4.2 |
|
| residential | lane | | 15 km/h +-1 | 15 km/h +-1 | 4.2 | 4.2 |
|
||||||
| cycleway | lane | | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| cycleway | lane | | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
@ -84,7 +84,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| primary | | lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
| primary | | lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
||||||
| secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 2.7 | 4.2 |
|
| secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 2.7 | 4.2 |
|
||||||
| tertiary | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
|
| tertiary | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
|
||||||
| primary_link | | lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
| primary_link | | lane | 14 km/h | 14 km/h | 2.1 | 4.2 |
|
||||||
| secondary_link | | lane | 15 km/h | 15 km/h | 2.7 | 4.2 |
|
| secondary_link | | lane | 15 km/h | 15 km/h | 2.7 | 4.2 |
|
||||||
| tertiary_link | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
|
| tertiary_link | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
|
||||||
| residential | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
| residential | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
|
||||||
@ -92,7 +92,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
|
|||||||
| footway | | lane | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 |
|
| footway | | lane | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 |
|
||||||
| motorway | shared_lane | | 15 km/h | | 4.2 | |
|
| motorway | shared_lane | | 15 km/h | | 4.2 | |
|
||||||
| primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
|
| primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
|
||||||
| motorway | | shared_lane | 15 km/h | | 4.2 | |
|
| motorway | | shared_lane | 14 km/h | | 4.2 | |
|
||||||
| primary | | shared_lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
| primary | | shared_lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,26 +8,26 @@ Feature: Bike - Surfaces
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | surface | bothw |
|
| highway | surface | bothw |
|
||||||
| cycleway | | 48 s |
|
| cycleway | | 48 s |
|
||||||
| cycleway | asphalt | 48 s |
|
| cycleway | asphalt | 47.9 s |
|
||||||
| cycleway | cobblestone:flattened | 72 s |
|
| cycleway | cobblestone:flattened | 72 s |
|
||||||
| cycleway | paving_stones | 72 s |
|
| cycleway | paving_stones | 72 s |
|
||||||
| cycleway | compacted | 72 s |
|
| cycleway | compacted | 72 s |
|
||||||
| cycleway | cobblestone | 120 s |
|
| cycleway | cobblestone | 120 s |
|
||||||
| cycleway | fine_gravel | 120 s |
|
| cycleway | fine_gravel | 120 s |
|
||||||
| cycleway | gravel | 120 s |
|
| cycleway | gravel | 120 s |
|
||||||
| cycleway | pebblestone | 120.1 s |
|
| cycleway | pebblestone | 120 s |
|
||||||
| cycleway | dirt | 120 s |
|
| cycleway | dirt | 120 s |
|
||||||
| cycleway | earth | 120 s |
|
| cycleway | earth | 120 s |
|
||||||
| cycleway | grass | 120 s |
|
| cycleway | grass | 120 s |
|
||||||
| cycleway | mud | 240 s |
|
| cycleway | mud | 240 s |
|
||||||
| cycleway | sand | 240.1 s |
|
| cycleway | sand | 240 s |
|
||||||
| cycleway | sett | 72 s |
|
| cycleway | sett | 72 s |
|
||||||
|
|
||||||
Scenario: Bicycle - Good surfaces on small paths
|
Scenario: Bicycle - Good surfaces on small paths
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | surface | bothw |
|
| highway | surface | bothw |
|
||||||
| cycleway | | 48 s |
|
| cycleway | | 48 s |
|
||||||
| path | | 60 s |
|
| path | | 59.9 s |
|
||||||
| track | | 60 s |
|
| track | | 60 s |
|
||||||
| track | asphalt | 60 s |
|
| track | asphalt | 60 s |
|
||||||
| path | asphalt | 60 s |
|
| path | asphalt | 60 s |
|
||||||
|
|||||||
@ -37,6 +37,6 @@ Feature: Turn Penalties
|
|||||||
| from | to | distance | weight | # |
|
| from | to | distance | weight | # |
|
||||||
| a | c | 900m +- 1 | 216 | Going straight has no penalties |
|
| a | c | 900m +- 1 | 216 | Going straight has no penalties |
|
||||||
| a | d | 900m +- 1 | 220.2 | Turning right had penalties |
|
| a | d | 900m +- 1 | 220.2 | Turning right had penalties |
|
||||||
| e | g | 2100m +- 4| 503.9 | Going straght has no penalties |
|
| e | g | 2100m +- 5| 503.9 | Going straght has no penalties |
|
||||||
| e | h | 2100m +- 4| 515.1 | Turn sharp right has even higher penalties|
|
| e | h | 2100m +- 5| 515.1 | Turn sharp right has even higher penalties|
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ Feature: Car - Restricted access
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | hov | bothw | forw_rate | backw_rate |
|
| highway | hov | bothw | forw_rate | backw_rate |
|
||||||
| primary | designated | x | 18.2 | 18.2 |
|
| primary | designated | x | 18.2 | 18.2 |
|
||||||
| primary | yes | x | 18.2 | 18.2 |
|
| primary | yes | x | 18.3 | 18.3 |
|
||||||
| primary | no | x | 18.2 | 18.2 |
|
| primary | no | x | 18.2 | 18.2 |
|
||||||
|
|
||||||
# Models:
|
# Models:
|
||||||
@ -196,7 +196,7 @@ Feature: Car - Restricted access
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | hov | hov:lanes | lanes | access | oneway | forw | backw | forw_rate |
|
| highway | hov | hov:lanes | lanes | access | oneway | forw | backw | forw_rate |
|
||||||
| motorway | designated | designated\|designated\|designated | 3 | hov | yes | x | | 25 |
|
| motorway | designated | designated\|designated\|designated | 3 | hov | yes | x | | 25 |
|
||||||
| motorway | lane | | 3 | designated | yes | x | | 25 |
|
| motorway | lane | | 3 | designated | yes | x | | 25.3 |
|
||||||
|
|
||||||
@hov
|
@hov
|
||||||
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
|
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
|
||||||
@ -206,7 +206,7 @@ Feature: Car - Restricted access
|
|||||||
# This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769
|
# This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769
|
||||||
#| primary | | designated | | | x | x | 18.2 | 18.2 |
|
#| primary | | designated | | | x | x | 18.2 | 18.2 |
|
||||||
#| primary | designated | | | | x | x | 18.2 | 18.2 |
|
#| primary | designated | | | | x | x | 18.2 | 18.2 |
|
||||||
| primary | designated\|designated | designated\|designated | | | x | x | 18.2 | 18.2 |
|
| primary | designated\|designated | designated\|designated | | | x | x | 18.3 | 18.3 |
|
||||||
| primary | designated\|no | designated\|no | | | x | x | 18.2 | 18.2 |
|
| primary | designated\|no | designated\|no | | | x | x | 18.2 | 18.2 |
|
||||||
| primary | yes\|no | yes\|no | | | x | x | 18.2 | 18.2 |
|
| primary | yes\|no | yes\|no | | | x | x | 18.2 | 18.2 |
|
||||||
| primary | | | | | x | x | 18.2 | 18.2 |
|
| primary | | | | | x | x | 18.2 | 18.2 |
|
||||||
|
|||||||
@ -8,7 +8,7 @@ Feature: Car - Destination only, no passing through
|
|||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a e
|
a e
|
||||||
b c d
|
b1 c 2d
|
||||||
|
|
||||||
x y
|
x y
|
||||||
"""
|
"""
|
||||||
@ -23,19 +23,19 @@ Feature: Car - Destination only, no passing through
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| a | b | ab,ab |
|
| a | b | ab,ab |
|
||||||
| a | c | ab,bcd |
|
| a | c | ab,bcd,bcd |
|
||||||
| a | d | ab,bcd,bcd |
|
| a | 2 | ab,bcd,bcd |
|
||||||
| a | e | axye,axye |
|
| a | e | axye,axye |
|
||||||
| e | d | de,de |
|
| e | d | de,de |
|
||||||
| e | c | de,bcd |
|
| e | c | de,bcd,bcd |
|
||||||
| e | b | de,bcd,bcd |
|
| e | 1 | de,bcd,bcd |
|
||||||
| e | a | axye,axye |
|
| e | a | axye,axye |
|
||||||
|
|
||||||
Scenario: Car - Destination only street
|
Scenario: Car - Destination only street
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a e
|
a e
|
||||||
b c d
|
b1 c 2d
|
||||||
|
|
||||||
x y
|
x y
|
||||||
"""
|
"""
|
||||||
@ -51,12 +51,12 @@ Feature: Car - Destination only, no passing through
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| a | b | ab,ab |
|
| a | b | ab,ab |
|
||||||
| a | c | ab,bc |
|
| a | c | ab,bc,bc |
|
||||||
| a | d | ab,cd |
|
| a | 2 | ab,bc,cd |
|
||||||
| a | e | axye,axye |
|
| a | e | axye,axye |
|
||||||
| e | d | de,de |
|
| e | d | de,de |
|
||||||
| e | c | de,cd |
|
| e | c | de,cd,cd |
|
||||||
| e | b | de,bc |
|
| e | 1 | de,cd,bc |
|
||||||
| e | a | axye,axye |
|
| e | a | axye,axye |
|
||||||
|
|
||||||
Scenario: Car - Routing inside a destination only area
|
Scenario: Car - Routing inside a destination only area
|
||||||
@ -117,6 +117,7 @@ Feature: Car - Destination only, no passing through
|
|||||||
+ \
|
+ \
|
||||||
+ |
|
+ |
|
||||||
d |
|
d |
|
||||||
|
1 |
|
||||||
\___e
|
\___e
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ Feature: Car - Destination only, no passing through
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | a | acbe,acbe |
|
| e | a | acbe,acbe |
|
||||||
| d | a | de,acbe,acbe |
|
| 1 | a | de,acbe,acbe |
|
||||||
| c | d | cd,cd |
|
| c | d | cd,cd |
|
||||||
|
|
||||||
Scenario: Car - Routing through a parking lot tagged access=destination,service
|
Scenario: Car - Routing through a parking lot tagged access=destination,service
|
||||||
|
|||||||
@ -46,10 +46,10 @@ Feature: Car - Handle ferry routes
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | modes | speed | time |
|
| from | to | route | modes | speed | time |
|
||||||
| a | g | abc,cde,efg,efg | driving,ferry,driving,driving | 12 km/h | 173.4s |
|
| a | g | abc,cde,efg,efg | driving,ferry,driving,driving | 12 km/h | 173.5s |
|
||||||
| b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.4s |
|
| b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.5s |
|
||||||
| c | e | cde,cde | ferry,ferry | 5 km/h | 151.4s |
|
| c | e | cde,cde | ferry,ferry | 5 km/h | 151.5s |
|
||||||
| e | c | cde,cde | ferry,ferry | 5 km/h | 151.4s |
|
| e | c | cde,cde | ferry,ferry | 5 km/h | 151.5s |
|
||||||
|
|
||||||
Scenario: Car - Properly handle simple durations
|
Scenario: Car - Properly handle simple durations
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -117,4 +117,4 @@ Feature: Car - Handle ferry routes
|
|||||||
# Note that matching *should* work across unsnappable ferries
|
# Note that matching *should* work across unsnappable ferries
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | duration |
|
| 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 |
|
| abcdef| 1,1,1.000898,1,1.000898,1,1.002695,1,1.002695,1,1.003594,1,1.003594,1,1.005391,1,1.005391,1,1.006289,1 | 611 |
|
||||||
|
|||||||
@ -86,57 +86,57 @@ OSRM will use 4/5 of the projected free-flow speed.
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
|
|
||||||
| highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
|
| highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
|
||||||
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
|
| primary | | | | | 64 km/h | 64 km/h | 18.1 | 18.1 |
|
||||||
| primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 |
|
| primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 |
|
||||||
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 |
|
| primary | 60 | | | | 48 km/h | 48 km/h | 13.3 | 13.3 |
|
||||||
| primary | 60 | 3 | | | 47 km/h | 47 km/h | 6.7 | 6.7 |
|
| primary | 60 | 3 | | | 48 km/h | 48 km/h | 6.7 | 6.7 |
|
||||||
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 |
|
| primary | | | 60 | | 48 km/h | 64 km/h | 13.3 | 18.1 |
|
||||||
| primary | | 3 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 |
|
| primary | | 3 | 60 | | 48 km/h | 64 km/h | 6.7 | 9 |
|
||||||
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 |
|
| primary | | | | 60 | 64 km/h | 48 km/h | 18.1 | 13.3 |
|
||||||
| primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 |
|
| primary | | 3 | | 60 | 64 km/h | 48 km/h | 9 | 6.7 |
|
||||||
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 |
|
| primary | 15 | | 60 | | 48 km/h | 12 km/h | 13.3 | 3.3 |
|
||||||
| primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 |
|
| primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 |
|
||||||
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 |
|
| primary | 15 | | | 60 | 12 km/h | 48 km/h | 3.3 | 13.3 |
|
||||||
| primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 |
|
| primary | 15 | 3 | | 60 | 12 km/h | 48 km/h | 1.7 | 6.7 |
|
||||||
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 |
|
| primary | 15 | | 30 | 60 | 24 km/h | 48 km/h | 6.7 | 13.3 |
|
||||||
| primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 |
|
| primary | 15 | 3 | 30 | 60 | 24 km/h | 48 km/h | 3.3 | 6.7 |
|
||||||
|
|
||||||
Scenario: Car - Single lane streets be ignored or incur a penalty
|
Scenario: Car - Single lane streets be ignored or incur a penalty
|
||||||
Then routability should be
|
Then routability should be
|
||||||
|
|
||||||
| highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
|
| highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
|
||||||
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
|
| primary | | | | | 64 km/h | 64 km/h | 18.1 | 18.1 |
|
||||||
| primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 |
|
| primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 |
|
||||||
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 |
|
| primary | 60 | | | | 48 km/h | 48 km/h | 13.3 | 13.3 |
|
||||||
| primary | 60 | 1 | | | 47 km/h | 47 km/h | 6.7 | 6.7 |
|
| primary | 60 | 1 | | | 48 km/h | 48 km/h | 6.7 | 6.7 |
|
||||||
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 |
|
| primary | | | 60 | | 48 km/h | 64 km/h | 13.3 | 18.1 |
|
||||||
| primary | | 1 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 |
|
| primary | | 1 | 60 | | 48 km/h | 64 km/h | 6.7 | 9 |
|
||||||
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 |
|
| primary | | | | 60 | 64 km/h | 48 km/h | 18.1 | 13.3 |
|
||||||
| primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 |
|
| primary | | 1 | | 60 | 64 km/h | 48 km/h | 9 | 6.7 |
|
||||||
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 |
|
| primary | 15 | | 60 | | 48 km/h | 12 km/h | 13.3 | 3.3 |
|
||||||
| primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 |
|
| primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 |
|
||||||
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 |
|
| primary | 15 | | | 60 | 12 km/h | 48 km/h | 3.3 | 13.3 |
|
||||||
| primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 |
|
| primary | 15 | 1 | | 60 | 12 km/h | 48 km/h | 1.7 | 6.7 |
|
||||||
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 |
|
| primary | 15 | | 30 | 60 | 24 km/h | 48 km/h | 6.7 | 13.3 |
|
||||||
| primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 |
|
| primary | 15 | 1 | 30 | 60 | 24 km/h | 48 km/h | 3.3 | 6.7 |
|
||||||
|
|
||||||
Scenario: Car - Single lane streets only incur a penalty for two-way streets
|
Scenario: Car - Single lane streets only incur a penalty for two-way streets
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate |
|
| highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate |
|
||||||
| primary | 30 | 1 | yes | 23 km/h | | 6.7 | |
|
| primary | 30 | 1 | yes | 24 km/h | | 6.7 | |
|
||||||
| primary | 30 | 1 | -1 | | 23 km/h | | 6.7 |
|
| primary | 30 | 1 | -1 | | 24 km/h | | 6.7 |
|
||||||
| primary | 30 | 1 | | 23 km/h | 23 km/h | 3.3 | 3.3 |
|
| primary | 30 | 1 | | 24 km/h | 24 km/h | 3.3 | 3.3 |
|
||||||
| primary | 30 | 2 | | 23 km/h | 23 km/h | 6.7 | 6.7 |
|
| primary | 30 | 2 | | 24 km/h | 24 km/h | 6.7 | 6.7 |
|
||||||
|
|
||||||
Scenario: Car - Forward/backward maxspeed on reverse oneways
|
Scenario: Car - Forward/backward maxspeed on reverse oneways
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate |
|
| highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate |
|
||||||
| primary | | | | -1 | | 64 km/h | | 18 |
|
| primary | | | | -1 | | 64 km/h | | 18.1 |
|
||||||
| primary | 30 | | | -1 | | 23 km/h | | 6.7 |
|
| primary | 30 | | | -1 | | 24 km/h | | 6.7 |
|
||||||
| primary | | 30 | | -1 | | 64 km/h | | 18 |
|
| primary | | 30 | | -1 | | 64 km/h | | 18.1 |
|
||||||
| primary | | | 30 | -1 | | 23 km/h | | 6.7 |
|
| primary | | | 30 | -1 | | 24 km/h | | 6.7 |
|
||||||
| primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 |
|
| primary | 20 | 30 | | -1 | | 16 km/h | | 4.4 |
|
||||||
| primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 |
|
| primary | 20 | | 30 | -1 | | 24 km/h | | 6.7 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Car - Respect source:maxspeed
|
Scenario: Car - Respect source:maxspeed
|
||||||
|
|||||||
@ -1031,3 +1031,61 @@ Feature: Car - Multiple Via Turn restrictions
|
|||||||
| from | to | route | locations |
|
| from | to | route | locations |
|
||||||
| a | f | ab,bc,cd,de,ef,ef | a,b,c,d,e,f |
|
| a | f | ab,bc,cd,de,ef,ef | a,b,c,d,e,f |
|
||||||
|
|
||||||
|
|
||||||
|
@restriction-way
|
||||||
|
Scenario: Snap source/target to via restriction way
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-1-b-2-c-3-d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| cd |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:via | way:to | restriction |
|
||||||
|
| restriction | ab | bc | cd | no_straight_on |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| 1 | 2 | ab,bc,bc |
|
||||||
|
| 2 | 3 | bc,cd,cd |
|
||||||
|
|
||||||
|
|
||||||
|
@restriction-way
|
||||||
|
Scenario: Car - Snap source/target to multi-via restriction way
|
||||||
|
# Example: https://www.openstreetmap.org/relation/11787041
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
|--g---f---e
|
||||||
|
a | 1
|
||||||
|
|--b---c---d
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway | name |
|
||||||
|
| ab | yes | enter |
|
||||||
|
| bc | yes | enter |
|
||||||
|
| cd | yes | right |
|
||||||
|
| de | yes | up |
|
||||||
|
| ef | yes | left |
|
||||||
|
| fc | yes | down |
|
||||||
|
| fg | yes | exit |
|
||||||
|
| ga | yes | exit |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:via | way:to | restriction |
|
||||||
|
| restriction | bc | cd,de,ef | fg | no_u_turn |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | locations |
|
||||||
|
| a | 1 | enter,right,up,up | a,c,d,_ |
|
||||||
|
| 1 | a | up,left,exit,exit | _,e,f,a |
|
||||||
|
|||||||
@ -411,7 +411,7 @@ Feature: Car - Turn restrictions
|
|||||||
y
|
y
|
||||||
i j f b x a e g h
|
i j f b x a e g h
|
||||||
|
|
||||||
c d
|
c1 d
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
@ -438,7 +438,7 @@ Feature: Car - Turn restrictions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| e | f | ae,xa,bx,fb,fb |
|
| e | f | ae,xa,bx,fb,fb |
|
||||||
| c | f | dc,da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
|
| 1 | f | dc,da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
|
||||||
| d | f | da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
|
| d | f | da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
|
||||||
|
|
||||||
@except
|
@except
|
||||||
@ -1008,3 +1008,123 @@ Feature: Car - Turn restrictions
|
|||||||
| from | to | route |
|
| from | to | route |
|
||||||
| d | x | bd,abc,xa,xa |
|
| d | x | bd,abc,xa,xa |
|
||||||
| d | z | bd,abc,cz,cz |
|
| d | z | bd,abc,cz,cz |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Multiple restricted entrances
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b
|
||||||
|
|
|
||||||
|
a----e----c
|
||||||
|
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ae |
|
||||||
|
| be |
|
||||||
|
| ce |
|
||||||
|
| de |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | ae,be | ed | e | no_entry |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | d | ae,ce,ce,de,de |
|
||||||
|
| b | d | be,ce,ce,de,de |
|
||||||
|
| c | d | ce,de,de |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Multiple restricted exits
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b
|
||||||
|
|
|
||||||
|
a----e----c
|
||||||
|
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ae |
|
||||||
|
| be |
|
||||||
|
| ce |
|
||||||
|
| de |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | ae | ce,de | e | no_exit |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | b | ae,be,be |
|
||||||
|
| a | c | ae,be,be,ce,ce |
|
||||||
|
| a | d | ae,be,be,de,de |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Invalid restricted entrances/exits
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b
|
||||||
|
|
|
||||||
|
a----e----c
|
||||||
|
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ae |
|
||||||
|
| be |
|
||||||
|
| ce |
|
||||||
|
| de |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | ae | ce,de | e | no_entry |
|
||||||
|
| restriction | ae,be | ed | e | no_exit |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | b | ae,be,be |
|
||||||
|
| a | c | ae,ce,ce |
|
||||||
|
| a | d | ae,de,de |
|
||||||
|
| b | d | be,de,de |
|
||||||
|
| c | d | ce,de,de |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Invalid multi from/to restrictions
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b
|
||||||
|
|
|
||||||
|
a----e----c
|
||||||
|
|
|
||||||
|
d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ae |
|
||||||
|
| be |
|
||||||
|
| ce |
|
||||||
|
| de |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | ae,de | ce,de | e | no_right_turn |
|
||||||
|
| restriction | ae,be | ce,de | e | no_straight_on |
|
||||||
|
| restriction | ae,be | be,ce | e | only_left_turn |
|
||||||
|
| restriction | ae,be | ce,de | e | only_straight_on |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | b | ae,be,be |
|
||||||
|
| a | c | ae,ce,ce |
|
||||||
|
| a | d | ae,de,de |
|
||||||
|
| b | d | be,de,de |
|
||||||
|
| c | d | ce,de,de |
|
||||||
|
|||||||
@ -9,29 +9,29 @@ Feature: Car - speeds
|
|||||||
Scenario: Car - speed of various way types
|
Scenario: Car - speed of various way types
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | oneway | bothw |
|
| highway | oneway | bothw |
|
||||||
| motorway | no | 89 km/h |
|
| motorway | no | 90 km/h |
|
||||||
| motorway_link | no | 44 km/h |
|
| motorway_link | no | 45 km/h |
|
||||||
| trunk | no | 85 km/h |
|
| trunk | no | 84 km/h |
|
||||||
| trunk_link | no | 39 km/h |
|
| trunk_link | no | 40 km/h |
|
||||||
| primary | no | 64 km/h |
|
| primary | no | 64 km/h |
|
||||||
| primary_link | no | 29 km/h |
|
| primary_link | no | 30 km/h |
|
||||||
| secondary | no | 55 km/h |
|
| secondary | no | 54 km/h |
|
||||||
| secondary_link | no | 24 km/h |
|
| secondary_link | no | 25 km/h |
|
||||||
| tertiary | no | 39 km/h |
|
| tertiary | no | 40 km/h |
|
||||||
| tertiary_link | no | 20 km/h |
|
| tertiary_link | no | 20 km/h |
|
||||||
| unclassified | no | 24 km/h |
|
| unclassified | no | 25 km/h |
|
||||||
| residential | no | 24 km/h |
|
| residential | no | 25 km/h |
|
||||||
| living_street | no | 9 km/h |
|
| living_street | no | 10 km/h |
|
||||||
| service | no | 15 km/h |
|
| service | no | 15 km/h |
|
||||||
|
|
||||||
# Alternating oneways scale rates but not speeds
|
# Alternating oneways scale rates but not speeds
|
||||||
Scenario: Car - scaled speeds for oneway=alternating
|
Scenario: Car - scaled speeds for oneway=alternating
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | oneway | junction | forw | backw | # |
|
| highway | oneway | junction | forw | backw | # |
|
||||||
| tertiary | | | 39 km/h | 39 km/h | |
|
| tertiary | | | 40 km/h | 40 km/h | |
|
||||||
| tertiary | alternating | | 39 km/h | 39 km/h | |
|
| tertiary | alternating | | 40 km/h | 40 km/h | |
|
||||||
| motorway | | | 89 km/h | | implied oneway |
|
| motorway | | | 90 km/h | | implied oneway |
|
||||||
| motorway | alternating | | 89 km/h | | implied oneway |
|
| motorway | alternating | | 90 km/h | | implied oneway |
|
||||||
| motorway | reversible | | | | unroutable |
|
| motorway | reversible | | | | unroutable |
|
||||||
| primary | | roundabout | 64 km/h | | implied oneway |
|
| primary | | roundabout | 64 km/h | | implied oneway |
|
||||||
| primary | alternating | roundabout | 64 km/h | | implied oneway |
|
| primary | alternating | roundabout | 64 km/h | | implied oneway |
|
||||||
@ -42,12 +42,12 @@ Feature: Car - speeds
|
|||||||
|
|
||||||
| highway | maxspeed | forw | backw |
|
| highway | maxspeed | forw | backw |
|
||||||
| primary | | 64 km/h | 64 km/h |
|
| primary | | 64 km/h | 64 km/h |
|
||||||
| primary | 60 | 47 km/h | 47 km/h |
|
| primary | 60 | 48 km/h | 48 km/h |
|
||||||
| primary | 60 | 47 km/h | 47 km/h |
|
| primary | 60 | 48 km/h | 48 km/h |
|
||||||
| primary | 60 | 47 km/h | 47 km/h |
|
| primary | 60 | 48 km/h | 48 km/h |
|
||||||
|
|
||||||
Scenario: Car - Side road penalties
|
Scenario: Car - Side road penalties
|
||||||
Then routability should be
|
Then routability should be
|
||||||
|
|
||||||
| highway | side_road | forw | backw | forw_rate | backw_rate |
|
| highway | side_road | forw | backw | forw_rate | backw_rate |
|
||||||
| primary | yes | 64 km/h | 64 km/h | 14.4 | 14.4 |
|
| primary | yes | 64 km/h | 64 km/h | 14.5 | 14.5 |
|
||||||
|
|||||||
@ -53,8 +53,8 @@ Feature: Car - Allowed start/end modes
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | 2 | c |
|
| | 2 | c |
|
||||||
| 1 | 59.1 | 35.1 |
|
| 1 | 59.1 | 35.2 |
|
||||||
| b | 35.1 | 11.1 |
|
| b | 35 | 11.1 |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
@ -121,5 +121,5 @@ Feature: Car - Allowed start/end modes
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | 2 | c |
|
| | 2 | c |
|
||||||
| 1 | 59.1 | 35.1 |
|
| 1 | 59.1 | 35.2 |
|
||||||
| b | 35.1 | 11.1 |
|
| b | 35 | 11.1 |
|
||||||
@ -65,7 +65,7 @@ Feature: Car - Surfaces
|
|||||||
Then routability should be
|
Then routability should be
|
||||||
| highway | oneway | surface | forw | backw |
|
| highway | oneway | surface | forw | backw |
|
||||||
| motorway | no | | 90 km/h | 90 km/h |
|
| motorway | no | | 90 km/h | 90 km/h |
|
||||||
| motorway | no | asphalt | 90 km/h | 90 km/h +-1 |
|
| motorway | no | asphalt | 91 km/h | 90 km/h +-1 |
|
||||||
| motorway | no | concrete | 90 km/h +-1 | 90 km/h +-1 |
|
| motorway | no | concrete | 90 km/h +-1 | 90 km/h +-1 |
|
||||||
| motorway | no | concrete:plates | 90 km/h +-1 | 90 km/h +-1 |
|
| motorway | no | concrete:plates | 90 km/h +-1 | 90 km/h +-1 |
|
||||||
| motorway | no | concrete:lanes | 90 km/h +-1 | 90 km/h +-1 |
|
| motorway | no | concrete:lanes | 90 km/h +-1 | 90 km/h +-1 |
|
||||||
|
|||||||
@ -59,7 +59,7 @@ Feature: Car - Handle traffic lights
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | geometry |
|
| from | to | route | geometry |
|
||||||
| a | c | abc,abc | _ibE_ibE?gJ?gJ |
|
| a | c | abc,abc | _ibE_ibE?gJ?eJ |
|
||||||
|
|
||||||
@traffic
|
@traffic
|
||||||
Scenario: Traffic update on the edge with a traffic signal
|
Scenario: Traffic update on the edge with a traffic signal
|
||||||
@ -89,5 +89,5 @@ Feature: Car - Handle traffic lights
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
|
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
|
||||||
| a | c | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
| a | c | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||||
| c | a | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||||
|
|||||||
@ -83,4 +83,4 @@ Feature: Car - weights
|
|||||||
| waypoints | bearings | route | distance | weights | times |
|
| waypoints | bearings | route | distance | weights | times |
|
||||||
| a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
|
| a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
|
||||||
| b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
|
| b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
|
||||||
| a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s |
|
| a,d | 90 180 | abc,bd,bd | 400m | 200,200,0 | 13.2s,11.1s,0s |
|
||||||
|
|||||||
@ -20,3 +20,20 @@ Feature: Foot - Street names in instructions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | ref |
|
| from | to | route | ref |
|
||||||
| a | c | My Way,, | ,A7,A7 |
|
| a | c | My Way,, | ,A7,A7 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Foot - Combines named roads with suffix changes
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b c d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name |
|
||||||
|
| ab | High Street W |
|
||||||
|
| bc | High Street E |
|
||||||
|
| cd | Market Street |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | d | High Street W,Market Street,Market Street |
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Feature: Foot - Turn restrictions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| s | w | sj,wj,wj |
|
||||||
| s | n | sj,nj,nj |
|
| s | n | sj,nj |
|
||||||
| s | e | sj,ej,ej |
|
| s | e | sj,ej,ej |
|
||||||
|
|
||||||
@only_turning
|
@only_turning
|
||||||
@ -55,7 +55,7 @@ Feature: Foot - Turn restrictions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| s | w | sj,wj,wj |
|
||||||
| s | n | sj,nj,nj |
|
| s | n | sj,nj |
|
||||||
| s | e | sj,ej,ej |
|
| s | e | sj,ej,ej |
|
||||||
|
|
||||||
@except
|
@except
|
||||||
|
|||||||
@ -103,7 +103,7 @@ Feature: Turn Lane Guidance
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | lanes |
|
| waypoints | route | turns | lanes |
|
||||||
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | ,slight left:false slight left:true,straight:false slight right:true, |
|
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | ,slight left:true slight left:true,straight:false slight right:true, |
|
||||||
|
|
||||||
|
|
||||||
@anticipate
|
@anticipate
|
||||||
@ -364,8 +364,8 @@ Feature: Turn Lane Guidance
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | lanes |
|
| waypoints | route | turns | lanes |
|
||||||
| a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:false straight:true straight:false straight:false right:false;left:false straight:true straight:false right:false,left:true right:false, |
|
| a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:true straight:true straight:true straight:true right:false;left:false straight:true straight:true right:false,left:true right:false, |
|
||||||
| a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:false straight:false straight:true straight:false right:false;left:false straight:false straight:true right:false,left:false right:true, |
|
| a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:true straight:true straight:true straight:true right:false;left:false straight:true straight:true right:false,left:false right:true, |
|
||||||
|
|
||||||
@anticipate
|
@anticipate
|
||||||
Scenario: Anticipate Lanes for through with turn before / after
|
Scenario: Anticipate Lanes for through with turn before / after
|
||||||
@ -391,14 +391,14 @@ Feature: Turn Lane Guidance
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | lanes | # |
|
| waypoints | route | turns | lanes | # |
|
||||||
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
|
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:true right:true right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
|
||||||
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
|
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:true right:true,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
|
||||||
| a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:false right:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
|
| a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:true right:true;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
|
||||||
| a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:false right:false right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
|
| a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:true right:true right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
|
||||||
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
|
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:true left:true,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
|
||||||
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
|
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:true left:true left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
|
||||||
| c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:false left:false left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
|
| c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:true left:true left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
|
||||||
| c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:false left:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
|
| c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:true left:true;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
|
||||||
|
|
||||||
@anticipate
|
@anticipate
|
||||||
Scenario: Anticipate Lanes for turns with through before and after
|
Scenario: Anticipate Lanes for turns with through before and after
|
||||||
@ -812,8 +812,8 @@ Feature: Turn Lane Guidance
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | locations | lanes |
|
| waypoints | route | turns | locations | lanes |
|
||||||
| a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:false;none:true none:true right:false, |
|
| a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;none:true none:true right:false, |
|
||||||
| a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true;left:false none:false none:false none:true,none:false none:false right:true, |
|
| a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true,none:false none:false right:true, |
|
||||||
|
|
||||||
@anticipate
|
@anticipate
|
||||||
Scenario: Oak St, Franklin St
|
Scenario: Oak St, Franklin St
|
||||||
|
|||||||
@ -687,7 +687,7 @@ Feature: Slipways and Dedicated Turn Lanes
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | locations |
|
| waypoints | route | turns | locations |
|
||||||
| s,f | sabc,ae,dbef,dbef | depart,fork slight right,turn right,arrive | s,a,e,f |
|
| s,f | sabc,ae,dbef,dbef | depart,turn straight,turn right,arrive | s,a,e,f |
|
||||||
|
|
||||||
@sliproads
|
@sliproads
|
||||||
Scenario: Traffic Signal on Sliproad
|
Scenario: Traffic Signal on Sliproad
|
||||||
|
|||||||
@ -230,3 +230,100 @@ Feature: Maneuver tag support
|
|||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| z,t | NY Ave,395,395 | depart,on ramp left,arrive |
|
| z,t | NY Ave,395,395 | depart,on ramp left,arrive |
|
||||||
| z,b | NY Ave,,4th St,4th St | depart,on ramp left,fork slight right,arrive |
|
| z,b | NY Ave,,4th St,4th St | depart,on ramp left,fork slight right,arrive |
|
||||||
|
|
||||||
|
Scenario: Gracefully handles maneuvers that are redundant for the profile
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a--b---c---d----f
|
||||||
|
|
|
||||||
|
|
|
||||||
|
e
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes | name | oneway | highway |
|
||||||
|
| abc | A Street | no | primary |
|
||||||
|
| ce | B Street | no | construction |
|
||||||
|
| cdf | A Street | no | primary |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | node:via | way:to | maneuver | direction |
|
||||||
|
| maneuver | abc | c | cdf | turn | slight_left |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,f | A Street,A Street | depart,arrive |
|
||||||
|
|
||||||
|
Scenario: Handles uncompressed nodes in maneuver path
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a--b---c---f
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
g d---h
|
||||||
|
|
|
||||||
|
|
|
||||||
|
i-------e-------j
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes | name | oneway |
|
||||||
|
| abc | A Street | no |
|
||||||
|
| cf | B Street | no |
|
||||||
|
| cde | C Street | no |
|
||||||
|
| bg | D Street | no |
|
||||||
|
| dh | E Street | no |
|
||||||
|
| ei | F Street | no |
|
||||||
|
| ej | G Street | no |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | node:via | way:via | way:to | maneuver | direction |
|
||||||
|
| maneuver | abc | e | cde | ei | turn | sharp_right |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,i | A Street,C Street,F Street,F Street | depart,turn right,turn sharp right,arrive |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Can be used with turn restrictions
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a---b---c
|
||||||
|
|
|
||||||
|
|
|
||||||
|
d
|
||||||
|
|
|
||||||
|
e---f
|
||||||
|
|
|
||||||
|
|
|
||||||
|
h------g---i
|
||||||
|
"""
|
||||||
|
And the ways
|
||||||
|
| nodes | name | oneway |
|
||||||
|
| ab | A Street | no |
|
||||||
|
| bc | B Street | no |
|
||||||
|
| bde | C Street | no |
|
||||||
|
| ef | D Street | no |
|
||||||
|
| eg | E Street | no |
|
||||||
|
| hg | F Street | no |
|
||||||
|
| gi | G Street | no |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | node:via | way:to | maneuver | direction | # |
|
||||||
|
| maneuver | ab | b | bde | turn | sharp_right | ending on a turn restriction via way |
|
||||||
|
| maneuver | bde | e | ef | turn | sharp_left | starting on a turn restriction via way |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | node:via | way:via | way:to | maneuver | direction | # |
|
||||||
|
| maneuver | cb | g | bde,eg | gi | turn | slight_left | turn restricted |
|
||||||
|
| maneuver | cb | g | bde,eg | hg | turn | slight_right | not turn restricted |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:via | way:to | restriction |
|
||||||
|
| restriction | ab | bde,eg | hg | no_right_turn |
|
||||||
|
| restriction | bc | bde,eg | gi | no_left_turn |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns |
|
||||||
|
| a,e | A Street,C Street,C Street | depart,turn sharp right,arrive |
|
||||||
|
| b,f | C Street,D Street,D Street | depart,turn sharp left,arrive |
|
||||||
|
| c,h | B Street,E Street,F Street,F Street | depart,turn left,turn slight right,arrive |
|
||||||
|
| c,i | B Street,A Street,E Street,G Street,G Street | depart,turn uturn,turn right,end of road left,arrive |
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Feature: Merge Segregated Roads
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,f | road,road,road,road | true:90,false:45 true:135 false:270;true:45 true:180 false:315;true:90 false:225 true:315;true:270 |
|
| a,f | road,road,road | true:90,false:45 true:135 false:270;true:45 true:180 false:315,true:90 false:225 true:315;true:270 |
|
||||||
|
|
||||||
#https://www.openstreetmap.org/#map=19/52.50003/13.33915
|
#https://www.openstreetmap.org/#map=19/52.50003/13.33915
|
||||||
@negative
|
@negative
|
||||||
@ -193,7 +193,7 @@ Feature: Merge Segregated Roads
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,g | road,road | true:90,false:90 true:150 false:270,true:90 false:270 true:345;true:270 |
|
| a,g | road,road | true:90,false:90 true:165 false:270,true:90 false:270 true:345;true:270 |
|
||||||
|
|
||||||
Scenario: Merging parallel roads with intermediate bridges
|
Scenario: Merging parallel roads with intermediate bridges
|
||||||
# https://www.mapillary.com/app/?lat=52.466483333333336&lng=13.431908333333332&z=17&focus=photo&pKey=LWXnKqoGqUNLnG0lofiO0Q
|
# https://www.mapillary.com/app/?lat=52.466483333333336&lng=13.431908333333332&z=17&focus=photo&pKey=LWXnKqoGqUNLnG0lofiO0Q
|
||||||
@ -332,10 +332,11 @@ Feature: Merge Segregated Roads
|
|||||||
|
|
|
|
||||||
.b.
|
.b.
|
||||||
c h
|
c h
|
||||||
|
1 |
|
||||||
|
| 4
|
||||||
| |
|
| |
|
||||||
| |
|
2 |
|
||||||
1 2
|
| 3
|
||||||
| |
|
|
||||||
d g
|
d g
|
||||||
'e'
|
'e'
|
||||||
|
|
|
|
||||||
@ -356,11 +357,11 @@ Feature: Merge Segregated Roads
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | turns | route | intersections |
|
| waypoints | turns | route | intersections |
|
||||||
| a,f | depart,arrive | road,road | true:180,false:0 true:180,false:0 true:180;true:0 |
|
| a,f | depart,arrive | road,road | true:180,false:0 true:180,false:0 true:180;true:0 |
|
||||||
| c,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
|
|
||||||
| 1,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
|
| 1,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
|
||||||
|
| 2,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
|
||||||
| f,a | depart,arrive | road,road | true:0,true:0 false:180,true:0 false:180;true:180 |
|
| f,a | depart,arrive | road,road | true:0,true:0 false:180,true:0 false:180;true:180 |
|
||||||
| g,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
|
| 3,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
|
||||||
| 2,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
|
| 4,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
|
||||||
|
|
||||||
@negative
|
@negative
|
||||||
Scenario: Traffic Circle
|
Scenario: Traffic Circle
|
||||||
|
|||||||
@ -277,7 +277,7 @@ Feature: Simple Turns
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | turns |
|
| from | to | route | turns |
|
||||||
| a | c | menz,rem | depart,arrive |
|
| a | c | menz,rem | depart,arrive |
|
||||||
| d | c | rem,rem,rem | depart,continue left,arrive |
|
| d | c | rem,rem | depart,arrive |
|
||||||
| c | d | rem,rem,rem | depart,continue right,arrive |
|
| c | d | rem,rem,rem | depart,continue right,arrive |
|
||||||
| c | a | rem,menz | depart,arrive |
|
| c | a | rem,menz | depart,arrive |
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ Feature: Ramp Guidance
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,d | ab,bd,bd | depart,on ramp right,arrive |
|
| a,d | ab,bd,bd | depart,on ramp right,arrive |
|
||||||
| a,c | ab,bc,bc | depart,turn left,arrive |
|
| a,c | ab,bc | depart,arrive |
|
||||||
|
|
||||||
Scenario: Fork Slight Ramp
|
Scenario: Fork Slight Ramp
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -180,7 +180,7 @@ Feature: Ramp Guidance
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,d | ab,bd,bd | depart,on ramp slight right,arrive |
|
| a,d | ab,bd,bd | depart,on ramp slight right,arrive |
|
||||||
| a,c | ab,bc,bc | depart,turn slight left,arrive |
|
| a,c | ab,bc | depart,arrive |
|
||||||
|
|
||||||
Scenario: Fork Slight Ramp on Through Street
|
Scenario: Fork Slight Ramp on Through Street
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
@ -791,10 +791,10 @@ Feature: Basic Roundabout
|
|||||||
# the turn angles here are quite strange, so we do get uturns for exiting
|
# the turn angles here are quite strange, so we do get uturns for exiting
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | turns | distance |
|
| from | to | route | turns | distance |
|
||||||
| e | f | ed,af,af,af | depart,roundabout-exit-1,exit roundabout left,arrive | 80.1m |
|
| e | f | ed,af,af,af | depart,roundabout-exit-1,exit roundabout left,arrive | 80m |
|
||||||
| f | e | af,ed,ed,ed | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120.1m |
|
| f | e | af,ed,ed,ed | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120m |
|
||||||
| k | l | kg,hl,hl,hl | depart,roundabout-exit-1,exit roundabout right,arrive | 80.1m |
|
| k | l | kg,hl,hl,hl | depart,roundabout-exit-1,exit roundabout right,arrive | 80m |
|
||||||
| l | k | hl,kg,kg,kg | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120.1m |
|
| l | k | hl,kg,kg,kg | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120m |
|
||||||
|
|
||||||
@4030 @4075
|
@4030 @4075
|
||||||
Scenario: Service roundabout with service exits
|
Scenario: Service roundabout with service exits
|
||||||
@ -846,5 +846,5 @@ Feature: Basic Roundabout
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | turns | distance |
|
| from | to | route | turns | distance |
|
||||||
| e | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 189.1m |
|
| e | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 189.2m |
|
||||||
| 1 | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 159.1m |
|
| 1 | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 159.1m |
|
||||||
|
|||||||
@ -837,8 +837,8 @@ Feature: Turn Lane Guidance
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | turns | route | lanes |
|
| waypoints | turns | route | lanes |
|
||||||
| a,d | depart,continue right,continue right,arrive | road,road,road,road | ,straight:false right:true,, |
|
| a,d | depart,continue uturn,arrive | road,road,road | ,straight:false right:true;, |
|
||||||
| d,a | depart,continue left,continue left,arrive | road,road,road,road | ,left:true straight:false,, |
|
| d,a | depart,continue uturn,arrive | road,road,road | ,left:true straight:false;, |
|
||||||
|
|
||||||
@simple
|
@simple
|
||||||
Scenario: Merge Lanes Onto Freeway
|
Scenario: Merge Lanes Onto Freeway
|
||||||
|
|||||||
@ -45,11 +45,12 @@ class OSRMBaseLoader{
|
|||||||
var retryCount = 0;
|
var retryCount = 0;
|
||||||
let retry = (err) => {
|
let retry = (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (retryCount < 10) {
|
if (retryCount < this.scope.OSRM_CONNECTION_RETRIES) {
|
||||||
|
const timeoutMs = 10 * Math.pow(this.scope.OSRM_CONNECTION_EXP_BACKOFF_COEF, retryCount);
|
||||||
retryCount++;
|
retryCount++;
|
||||||
setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, 10);
|
setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, timeoutMs);
|
||||||
} else {
|
} else {
|
||||||
callback(new Error("Could not connect to osrm-routed after ten retries."));
|
callback(new Error(`Could not connect to osrm-routed after ${this.scope.OSRM_CONNECTION_RETRIES} retries.`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -59,6 +59,31 @@ Feature: Locating Nearest node on a Way - pick closest way
|
|||||||
| 3 | u |
|
| 3 | u |
|
||||||
| 4 | w |
|
| 4 | w |
|
||||||
|
|
||||||
|
Scenario: Nearest - inside a oneway triangle
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
c
|
||||||
|
|
||||||
|
y z
|
||||||
|
0 1
|
||||||
|
2 3 4
|
||||||
|
a x u w b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | yes |
|
||||||
|
| bc | yes |
|
||||||
|
| ca | yes |
|
||||||
|
|
||||||
|
When I request nearest I should get
|
||||||
|
| in | out |
|
||||||
|
| 0 | y |
|
||||||
|
| 1 | z |
|
||||||
|
| 2 | x |
|
||||||
|
| 3 | u |
|
||||||
|
| 4 | w |
|
||||||
|
|
||||||
Scenario: Nearest - High lat/lon
|
Scenario: Nearest - High lat/lon
|
||||||
Given the node locations
|
Given the node locations
|
||||||
| node | lat | lon |
|
| node | lat | lon |
|
||||||
@ -78,3 +103,30 @@ Feature: Locating Nearest node on a Way - pick closest way
|
|||||||
| x | a |
|
| x | a |
|
||||||
| y | b |
|
| y | b |
|
||||||
| z | c |
|
| z | c |
|
||||||
|
|
||||||
|
Scenario: Nearest - data version
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
c
|
||||||
|
|
||||||
|
y z
|
||||||
|
0 1
|
||||||
|
2 3 4
|
||||||
|
a x u w b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| ca |
|
||||||
|
|
||||||
|
And the extract extra arguments "--data_version cucumber_data_version"
|
||||||
|
|
||||||
|
When I request nearest I should get
|
||||||
|
| in | out | data_version |
|
||||||
|
| 0 | y | cucumber_data_version |
|
||||||
|
| 1 | z | cucumber_data_version |
|
||||||
|
| 2 | x | cucumber_data_version |
|
||||||
|
| 3 | u | cucumber_data_version |
|
||||||
|
| 4 | w | cucumber_data_version |
|
||||||
|
|||||||
@ -20,6 +20,6 @@ Feature: osrm-extract with a profile containing raster source
|
|||||||
And the data has been saved to disk
|
And the data has been saved to disk
|
||||||
When I run "osrm-extract {osm_file} -p {profile_file}"
|
When I run "osrm-extract {osm_file} -p {profile_file}"
|
||||||
Then stdout should contain "source loader"
|
Then stdout should contain "source loader"
|
||||||
Then stdout should contain "slope: 0.0899"
|
Then stdout should contain "slope: 0.0904"
|
||||||
Then stdout should contain "slope: -0.0899"
|
Then stdout should contain "slope: -0.0904"
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|||||||
@ -117,6 +117,10 @@ module.exports = function () {
|
|||||||
got.duration = duration.toString();
|
got.duration = duration.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (headers.has('data_version')) {
|
||||||
|
got.data_version = json.data_version || '';
|
||||||
|
}
|
||||||
|
|
||||||
// if header matches 'a:*', parse out the values for *
|
// if header matches 'a:*', parse out the values for *
|
||||||
// and return in that header
|
// and return in that header
|
||||||
headers.forEach((k) => {
|
headers.forEach((k) => {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ module.exports = function () {
|
|||||||
this.reprocessAndLoadData((e) => {
|
this.reprocessAndLoadData((e) => {
|
||||||
if (e) return callback(e);
|
if (e) return callback(e);
|
||||||
var testRow = (row, ri, cb) => {
|
var testRow = (row, ri, cb) => {
|
||||||
|
|
||||||
var inNode = this.findNodeByName(row.in);
|
var inNode = this.findNodeByName(row.in);
|
||||||
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ module.exports = function () {
|
|||||||
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
var coord;
|
var coord;
|
||||||
|
var headers = new Set(table.raw()[0]);
|
||||||
|
|
||||||
if (response.statusCode === 200 && response.body.length) {
|
if (response.statusCode === 200 && response.body.length) {
|
||||||
var json = JSON.parse(response.body);
|
var json = JSON.parse(response.body);
|
||||||
@ -25,6 +27,10 @@ module.exports = function () {
|
|||||||
|
|
||||||
var got = { in: row.in, out: row.out };
|
var got = { in: row.in, out: row.out };
|
||||||
|
|
||||||
|
if (headers.has('data_version')) {
|
||||||
|
got.data_version = json.data_version || '';
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(row).forEach((key) => {
|
Object.keys(row).forEach((key) => {
|
||||||
if (key === 'out') {
|
if (key === 'out') {
|
||||||
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
var util = require('util');
|
const util = require('util');
|
||||||
var d3 = require('d3-queue');
|
const d3 = require('d3-queue');
|
||||||
var classes = require('../support/data_classes');
|
const classes = require('../support/data_classes');
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
this.Then(/^routability should be$/, (table, callback) => {
|
this.Then(/^routability should be$/, (table, callback) => {
|
||||||
@ -115,8 +115,11 @@ module.exports = function () {
|
|||||||
var result = {};
|
var result = {};
|
||||||
|
|
||||||
var testDirection = (dir, callback) => {
|
var testDirection = (dir, callback) => {
|
||||||
var a = new classes.Location(this.origin[0] + (1+this.WAY_SPACING*i) * this.zoom, this.origin[1]),
|
const coordA = this.offsetOriginBy(1+this.WAY_SPACING*i, 0);
|
||||||
b = new classes.Location(this.origin[0] + (3+this.WAY_SPACING*i) * this.zoom, this.origin[1]),
|
const coordB = this.offsetOriginBy(3+this.WAY_SPACING*i, 0);
|
||||||
|
|
||||||
|
var a = new classes.Location(coordA[0], coordA[1]),
|
||||||
|
b = new classes.Location(coordB[0], coordB[1]),
|
||||||
r = {};
|
r = {};
|
||||||
|
|
||||||
r.which = dir;
|
r.which = dir;
|
||||||
|
|||||||
@ -43,6 +43,10 @@ module.exports = function () {
|
|||||||
got.message = json.message;
|
got.message = json.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (headers.has('data_version')) {
|
||||||
|
got.data_version = json.data_version || '';
|
||||||
|
}
|
||||||
|
|
||||||
if (headers.has('geometry')) {
|
if (headers.has('geometry')) {
|
||||||
if (this.queryParams['geometries'] === 'polyline') {
|
if (this.queryParams['geometries'] === 'polyline') {
|
||||||
got.geometry = polyline.decode(json.trips[0].geometry).toString();
|
got.geometry = polyline.decode(json.trips[0].geometry).toString();
|
||||||
@ -61,7 +65,8 @@ module.exports = function () {
|
|||||||
var subTrips;
|
var subTrips;
|
||||||
var trip_durations;
|
var trip_durations;
|
||||||
var trip_distance;
|
var trip_distance;
|
||||||
if (res.statusCode === 200) {
|
var ok = res.statusCode === 200;
|
||||||
|
if (ok) {
|
||||||
if (headers.has('trips')) {
|
if (headers.has('trips')) {
|
||||||
subTrips = json.trips.filter(t => !!t).map(t => t.legs).map(tl => Array.prototype.concat.apply([], tl.map((sl, i) => {
|
subTrips = json.trips.filter(t => !!t).map(t => t.legs).map(tl => Array.prototype.concat.apply([], tl.map((sl, i) => {
|
||||||
var toAdd = [];
|
var toAdd = [];
|
||||||
@ -84,8 +89,7 @@ module.exports = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ok = true,
|
var encodedResult = '';
|
||||||
encodedResult = '';
|
|
||||||
|
|
||||||
if (json.trips) row.trips.split(',').forEach((sub, si) => {
|
if (json.trips) row.trips.split(',').forEach((sub, si) => {
|
||||||
if (si >= subTrips.length) {
|
if (si >= subTrips.length) {
|
||||||
|
|||||||
@ -114,9 +114,12 @@ module.exports = function() {
|
|||||||
let dependencies = [
|
let dependencies = [
|
||||||
this.OSRM_EXTRACT_PATH,
|
this.OSRM_EXTRACT_PATH,
|
||||||
this.OSRM_CONTRACT_PATH,
|
this.OSRM_CONTRACT_PATH,
|
||||||
|
this.OSRM_CUSTOMIZE_PATH,
|
||||||
|
this.OSRM_PARTITION_PATH,
|
||||||
this.LIB_OSRM_EXTRACT_PATH,
|
this.LIB_OSRM_EXTRACT_PATH,
|
||||||
this.LIB_OSRM_GUIDANCE_PATH,
|
this.LIB_OSRM_CONTRACT_PATH,
|
||||||
this.LIB_OSRM_CONTRACT_PATH
|
this.LIB_OSRM_CUSTOMIZE_PATH,
|
||||||
|
this.LIB_OSRM_PARTITION_PATH
|
||||||
];
|
];
|
||||||
|
|
||||||
var addLuaFiles = (directory, callback) => {
|
var addLuaFiles = (directory, callback) => {
|
||||||
|
|||||||
@ -9,17 +9,27 @@ const classes = require('./data_classes');
|
|||||||
const tableDiff = require('../lib/table_diff');
|
const tableDiff = require('../lib/table_diff');
|
||||||
const ensureDecimal = require('../lib/utils').ensureDecimal;
|
const ensureDecimal = require('../lib/utils').ensureDecimal;
|
||||||
const errorReason = require('../lib/utils').errorReason;
|
const errorReason = require('../lib/utils').errorReason;
|
||||||
|
const CheapRuler = require('cheap-ruler');
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
this.setGridSize = (meters) => {
|
this.setGridSize = (meters) => {
|
||||||
|
this.gridSize = parseFloat(meters);
|
||||||
|
|
||||||
// the constant is calculated (with BigDecimal as: 1.0/(DEG_TO_RAD*EARTH_RADIUS_IN_METERS
|
// the constant is calculated (with BigDecimal as: 1.0/(DEG_TO_RAD*EARTH_RADIUS_IN_METERS
|
||||||
// see ApproximateDistance() in ExtractorStructs.h
|
// see ApproximateDistance() in ExtractorStructs.h
|
||||||
// it's only accurate when measuring along the equator, or going exactly north-south
|
// it's only accurate when measuring along the equator, or going exactly north-south
|
||||||
this.zoom = parseFloat(meters) * 0.8990679362704610899694577444566908445396483347536032203503E-5;
|
this.zoom = this.gridSize * 0.8990679362704610899694577444566908445396483347536032203503E-5;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setOrigin = (origin) => {
|
this.setOrigin = (origin) => {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
|
// we use C++ version of `cheap-ruler` inside OSRM in order to do distance calculations,
|
||||||
|
// so here we use it too to have a bit more precise assertions
|
||||||
|
this.ruler = new CheapRuler(this.origin[1], 'meters');
|
||||||
|
};
|
||||||
|
|
||||||
|
this.offsetOriginBy = (xCells, yCells) => {
|
||||||
|
return this.ruler.offset(this.origin, xCells * this.gridSize, yCells * this.gridSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.buildWaysFromTable = (table, callback) => {
|
this.buildWaysFromTable = (table, callback) => {
|
||||||
@ -35,9 +45,10 @@ module.exports = function () {
|
|||||||
// add some nodes
|
// add some nodes
|
||||||
|
|
||||||
var makeFakeNode = (namePrefix, offset) => {
|
var makeFakeNode = (namePrefix, offset) => {
|
||||||
|
const coord = this.offsetOriginBy(offset + this.WAY_SPACING * ri, 0);
|
||||||
return new OSM.Node(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP,
|
return new OSM.Node(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP,
|
||||||
this.OSM_UID, this.origin[0]+(offset + this.WAY_SPACING * ri) * this.zoom,
|
this.OSM_UID, coord[0],
|
||||||
this.origin[1], {name: util.format('%s%d', namePrefix, ri)});
|
coord[1], {name: util.format('%s%d', namePrefix, ri)});
|
||||||
};
|
};
|
||||||
|
|
||||||
var nodes = ['a','b','c','d','e'].map((l, i) => makeFakeNode(l, i));
|
var nodes = ['a','b','c','d','e'].map((l, i) => makeFakeNode(l, i));
|
||||||
@ -98,7 +109,7 @@ module.exports = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.tableCoordToLonLat = (ci, ri) => {
|
this.tableCoordToLonLat = (ci, ri) => {
|
||||||
return [this.origin[0] + ci * this.zoom, this.origin[1] - ri * this.zoom].map(ensureDecimal);
|
return this.offsetOriginBy(ci, -ri).map(ensureDecimal);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addOSMNode = (name, lon, lat, id) => {
|
this.addOSMNode = (name, lon, lat, id) => {
|
||||||
|
|||||||
@ -40,6 +40,9 @@ module.exports = function () {
|
|||||||
|
|
||||||
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
||||||
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
|
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
|
||||||
|
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10;
|
||||||
|
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0;
|
||||||
|
|
||||||
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;
|
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;
|
||||||
|
|
||||||
this.OSRM_PROFILE = process.env.OSRM_PROFILE;
|
this.OSRM_PROFILE = process.env.OSRM_PROFILE;
|
||||||
@ -67,10 +70,13 @@ module.exports = function () {
|
|||||||
|
|
||||||
this.OSRM_EXTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-extract', this.EXE));
|
this.OSRM_EXTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-extract', this.EXE));
|
||||||
this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE));
|
this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE));
|
||||||
|
this.OSRM_CUSTOMIZE_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-customize', this.EXE));
|
||||||
|
this.OSRM_PARTITION_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-partition', this.EXE));
|
||||||
this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE));
|
this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE));
|
||||||
this.LIB_OSRM_EXTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_extract'),
|
this.LIB_OSRM_EXTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_extract'),
|
||||||
this.LIB_OSRM_GUIDANCE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_guidance'),
|
|
||||||
this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'),
|
this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'),
|
||||||
|
this.LIB_OSRM_CUSTOMIZE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_customize'),
|
||||||
|
this.LIB_OSRM_PARTITION_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_partition'),
|
||||||
this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm');
|
this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm');
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
@ -111,7 +117,7 @@ module.exports = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var q = d3.queue();
|
var q = d3.queue();
|
||||||
[this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, this.OSRM_ROUTED_PATH].forEach(bin => { q.defer(verify, bin); });
|
[this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, this.OSRM_CUSTOMIZE_PATH, this.OSRM_PARTITION_PATH, this.OSRM_ROUTED_PATH].forEach(bin => { q.defer(verify, bin); });
|
||||||
q.awaitAll(callback);
|
q.awaitAll(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -115,4 +115,4 @@ Feature: Annotations
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | a:speed | a:distance | a:duration | a:nodes |
|
| from | to | route | a:speed | a:distance | a:duration | a:nodes |
|
||||||
| a | c | abc,abc | 10:10 | 249.998641:299.931643 | 25:30 | 1:2:3 |
|
| a | c | abc,abc | 10:10 | 249.987619:299.962882 | 25:30 | 1:2:3 |
|
||||||
|
|||||||
@ -67,10 +67,10 @@ Feature: Compass bearing
|
|||||||
Scenario: Bearing in a roundabout
|
Scenario: Bearing in a roundabout
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
k d c j
|
k d 1c j
|
||||||
e b
|
e b
|
||||||
f a
|
f a
|
||||||
l g h i
|
l g2 h i
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
@ -94,8 +94,8 @@ Feature: Compass bearing
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | bearing |
|
| from | to | route | bearing |
|
||||||
| c | b | cd,de,ef,fg,gh,ha,ab,ab | 0->270,270->225,225->180,180->135,135->90,90->45,45->0,0->0 |
|
| 1 | b | cd,de,ef,fg,gh,ha,ab,ab | 0->270,270->225,225->180,180->135,135->90,90->45,45->0,0->0 |
|
||||||
| g | f | gh,ha,ab,bc,cd,de,ef,ef | 0->90,90->45,45->0,0->315,315->270,270->225,225->180,180->0 |
|
| 2 | f | gh,ha,ab,bc,cd,de,ef,ef | 0->90,90->45,45->0,0->315,315->270,270->225,225->180,180->0 |
|
||||||
|
|
||||||
Scenario: Bearing should stay constant when zig-zagging
|
Scenario: Bearing should stay constant when zig-zagging
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
@ -109,11 +109,11 @@ Feature: Bearing parameter
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | bearings | route | bearing |
|
| from | to | bearings | route | bearing |
|
||||||
| 0 | q | 0 90 | ia,ring,ring,ring,ring,ring | 0->0,0->90,180->270,270->0,0->90,90->0 |
|
| 0 | q | 0 90 | ia,ring,ring,ring,ring,ring,ring | 0->0,0->90,90->180,180->270,270->0,0->90,90->0 |
|
||||||
| 0 | a | 45 90 | jb,ring,ring,ring,ring,ring | 0->45,45->180,180->270,270->0,0->90,90->0 |
|
| 0 | a | 45 90 | jb,ring,ring,ring,ring,ring | 0->45,45->180,180->270,270->0,0->90,90->0 |
|
||||||
| 0 | q | 90 90 | kc,ring,ring,ring,ring | 0->90,90->180,270->0,0->90,90->0 |
|
| 0 | q | 90 90 | kc,ring,ring,ring,ring,ring | 0->90,90->180,180->270,270->0,0->90,90->0 |
|
||||||
| 0 | a | 135 90 | ld,ring,ring,ring,ring | 0->135,135->270,270->0,0->90,90->0 |
|
| 0 | a | 135 90 | ld,ring,ring,ring,ring | 0->135,135->270,270->0,0->90,90->0 |
|
||||||
| 0 | a | 180 90 | me,ring,ring,ring,ring | 0->180,180->270,270->0,0->90,90->0 |
|
| 0 | a | 180 90 | me,ring,ring,ring | 0->180,180->270,0->90,90->0 |
|
||||||
| 0 | a | 225 90 | nf,ring,ring,ring | 0->225,225->0,0->90,90->0 |
|
| 0 | a | 225 90 | nf,ring,ring,ring | 0->225,225->0,0->90,90->0 |
|
||||||
| 0 | a | 270 90 | og,ring,ring,ring | 0->270,270->0,0->90,90->0 |
|
| 0 | a | 270 90 | og,ring,ring | 0->270,270->0,90->0 |
|
||||||
| 0 | a | 315 90 | ph,ring,ring | 0->315,315->90,90->0 |
|
| 0 | a | 315 90 | ph,ring,ring | 0->315,315->90,90->0 |
|
||||||
|
|||||||
@ -20,5 +20,5 @@ Feature: Geometry Compression
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance | speed |
|
| from | to | route | distance | speed |
|
||||||
| b | e | abcdef,abcdef | 588.5m | 36 km/h |
|
| b | e | abcdef,abcdef | 588.7m | 36 km/h |
|
||||||
| e | b | abcdef,abcdef | 588.5m | 36 km/h |
|
| e | b | abcdef,abcdef | 588.7m | 36 km/h |
|
||||||
|
|||||||
@ -90,8 +90,8 @@ Feature: Distance calculation
|
|||||||
| b | a | abc,abc | 100m |
|
| b | a | abc,abc | 100m |
|
||||||
| b | c | abc,abc | 100m |
|
| b | c | abc,abc | 100m |
|
||||||
| c | b | abc,abc | 100m |
|
| c | b | abc,abc | 100m |
|
||||||
| a | c | abc,abc | 200m |
|
| a | c | abc,abc | 199.9m |
|
||||||
| c | a | abc,abc | 200m |
|
| c | a | abc,abc | 199.9m |
|
||||||
|
|
||||||
Scenario: 1km distance
|
Scenario: 1km distance
|
||||||
Given a grid size of 1000 meters
|
Given a grid size of 1000 meters
|
||||||
@ -134,7 +134,7 @@ Feature: Distance calculation
|
|||||||
| a | c | abcdefgh,abcdefgh | 20m |
|
| a | c | abcdefgh,abcdefgh | 20m |
|
||||||
| a | d | abcdefgh,abcdefgh | 30m |
|
| a | d | abcdefgh,abcdefgh | 30m |
|
||||||
| a | e | abcdefgh,abcdefgh | 40m |
|
| a | e | abcdefgh,abcdefgh | 40m |
|
||||||
| a | f | abcdefgh,abcdefgh | 50m |
|
| a | f | abcdefgh,abcdefgh | 50.1m |
|
||||||
| a | g | abcdefgh,abcdefgh | 60m +-1 |
|
| a | g | abcdefgh,abcdefgh | 60m +-1 |
|
||||||
| a | h | abcdefgh,abcdefgh | 70m +-1 |
|
| a | h | abcdefgh,abcdefgh | 70m +-1 |
|
||||||
|
|
||||||
@ -154,9 +154,9 @@ Feature: Distance calculation
|
|||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| a | b | abcdefgh,abcdefgh | 10m |
|
| a | b | abcdefgh,abcdefgh | 10m |
|
||||||
| a | c | abcdefgh,abcdefgh | 20m |
|
| a | c | abcdefgh,abcdefgh | 20m |
|
||||||
| a | d | abcdefgh,abcdefgh | 30m |
|
| a | d | abcdefgh,abcdefgh | 29.9m |
|
||||||
| a | e | abcdefgh,abcdefgh | 40m |
|
| a | e | abcdefgh,abcdefgh | 39.9m |
|
||||||
| a | f | abcdefgh,abcdefgh | 50m |
|
| a | f | abcdefgh,abcdefgh | 49.9m |
|
||||||
| a | g | abcdefgh,abcdefgh | 60m +-1 |
|
| a | g | abcdefgh,abcdefgh | 60m +-1 |
|
||||||
| a | h | abcdefgh,abcdefgh | 70m +-1 |
|
| a | h | abcdefgh,abcdefgh | 70m +-1 |
|
||||||
|
|
||||||
|
|||||||
@ -22,10 +22,10 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
| a | 0 | 100 | 199.9 | 300 |
|
||||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
| b | 100 | 0 | 100 | 200 |
|
||||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
| e | 199.9 | 100 | 0 | 100.1 |
|
||||||
| f | 299.5 | 199.5 | 100.1 | 0 |
|
| f | 300 | 200 | 100.1 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of minimal network exact distances
|
Scenario: Testbot - Travel distance matrix of minimal network exact distances
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -43,11 +43,11 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | z | b | c | d |
|
| | a | z | b | c | d |
|
||||||
| a | 0 | 100.1 | 199.5 | 298.9 | 398.3 |
|
| a | 0 | 100 | 199.9 | 300 | 399.9 |
|
||||||
| z | 100.1 | 0 | 99.4 | 198.8 | 298.2 |
|
| z | 100 | 0 | 100 | 200 | 300 |
|
||||||
| b | 199.5 | 99.4 | 0 | 99.4 | 198.8 |
|
| b | 199.9 | 100 | 0 | 100.1 | 200 |
|
||||||
| c | 298.9 | 198.8 | 99.4 | 0 | 99.4 |
|
| c | 300 | 200 | 100.1 | 0 | 100 |
|
||||||
| d | 398.3 | 298.2 | 198.8 | 99.4 | 0 |
|
| d | 399.9 | 300 | 200 | 100 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of minimal network with toll exclude
|
Scenario: Testbot - Travel distance matrix of minimal network with toll exclude
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -68,10 +68,10 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 100.1 | | |
|
| a | 0 | 100 | | |
|
||||||
| b | 100.1 | 0 | | |
|
| b | 100 | 0 | | |
|
||||||
| c | | | 0 | 100.1 |
|
| c | | | 0 | 100 |
|
||||||
| d | | | 100.1 | 0 |
|
| d | | | 100 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of minimal network with motorway exclude
|
Scenario: Testbot - Travel distance matrix of minimal network with motorway exclude
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -92,7 +92,7 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 298.9 | 99.4 | 199.5 |
|
| a | 0 | 299.9 | 100 | 199.9 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
|
Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -113,7 +113,7 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e |
|
| | a | b | e |
|
||||||
| a | 0 | 50.1 | |
|
| a | 0 | 50 | |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of minimal network with motorway and toll excludes
|
Scenario: Testbot - Travel distance matrix of minimal network with motorway and toll excludes
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -134,7 +134,7 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | g |
|
| | a | b | e | g |
|
||||||
| a | 0 | 100.1 | | |
|
| a | 0 | 100 | | |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix with different way speeds
|
Scenario: Testbot - Travel distance matrix with different way speeds
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -150,21 +150,21 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 100.1 | 200.1 | 300.2 |
|
| a | 0 | 100 | 200 | 300 |
|
||||||
| b | 100.1 | 0 | 100.1 | 200.1 |
|
| b | 100 | 0 | 100.1 | 200 |
|
||||||
| c | 200.1 | 100.1 | 0 | 100.1 |
|
| c | 200 | 100.1 | 0 | 100 |
|
||||||
| d | 300.2 | 200.1 | 100.1 | 0 |
|
| d | 300 | 200 | 100 | 0 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 100.1 | 200.1 | 300.2 |
|
| a | 0 | 100 | 200 | 300 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 100.1 |
|
| b | 100 |
|
||||||
| c | 200.1 |
|
| c | 200 |
|
||||||
| d | 300.2 |
|
| d | 300 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of small grid
|
Scenario: Testbot - Travel distance matrix of small grid
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -183,10 +183,10 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
| a | 0 | 100 | 199.9 | 300 |
|
||||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
| b | 100 | 0 | 100 | 200 |
|
||||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
| e | 199.9 | 100 | 0 | 100.1 |
|
||||||
| f | 299.5 | 199.5 | 100.1 | 0 |
|
| f | 300 | 200 | 100.1 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of network with unroutable parts
|
Scenario: Testbot - Travel distance matrix of network with unroutable parts
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -200,7 +200,7 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b |
|
| | a | b |
|
||||||
| a | 0 | 100.1 |
|
| a | 0 | 100 |
|
||||||
| b | | 0 |
|
| b | | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix of network with oneways
|
Scenario: Testbot - Travel distance matrix of network with oneways
|
||||||
@ -218,10 +218,10 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | x | y | d | e |
|
| | x | y | d | e |
|
||||||
| x | 0 | 300.2 | 399.6 | 299.5 |
|
| x | 0 | 300 | 400 | 300 |
|
||||||
| y | 499 | 0 | 299.5 | 199.5 |
|
| y | 499.9 | 0 | 300 | 199.9 |
|
||||||
| d | 199.5 | 299.5 | 0 | 298.9 |
|
| d | 199.9 | 300 | 0 | 300 |
|
||||||
| e | 299.5 | 399.6 | 100.1 | 0 |
|
| e | 300 | 400 | 100.1 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Rectangular travel distance matrix
|
Scenario: Testbot - Rectangular travel distance matrix
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -240,53 +240,53 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | distance |
|
| from | to | distance |
|
||||||
| e | a | 200m |
|
| e | a | 199.9m |
|
||||||
| e | b | 100m |
|
| e | b | 100m |
|
||||||
| f | a | 299.9m |
|
| f | a | 300m |
|
||||||
| f | b | 200m |
|
| f | b | 200m |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
| a | 0 | 100 | 199.9 | 300 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 100.1 |
|
| b | 100 |
|
||||||
| e | 199.5 |
|
| e | 199.9 |
|
||||||
| f | 299.5 |
|
| f | 300 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
| a | 0 | 100 | 199.9 | 300 |
|
||||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
| b | 100 | 0 | 100 | 200 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b |
|
| | a | b |
|
||||||
| a | 0 | 100.1 |
|
| a | 0 | 100 |
|
||||||
| b | 100.1 | 0 |
|
| b | 100 | 0 |
|
||||||
| e | 199.5 | 99.4 |
|
| e | 199.9 | 100 |
|
||||||
| f | 299.5 | 199.5 |
|
| f | 300 | 200 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
| a | 0 | 100 | 199.9 | 300 |
|
||||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
| b | 100 | 0 | 100 | 200 |
|
||||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
| e | 199.9 | 100 | 0 | 100.1 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e |
|
| | a | b | e |
|
||||||
| a | 0 | 100.1 | 199.5 |
|
| a | 0 | 100 | 199.9 |
|
||||||
| b | 100.1 | 0 | 99.4 |
|
| b | 100 | 0 | 100 |
|
||||||
| e | 199.5 | 99.4 | 0 |
|
| e | 199.9 | 100 | 0 |
|
||||||
| f | 299.5 | 199.5 | 100.1 |
|
| f | 300 | 200 | 100.1 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | e | f |
|
| | a | b | e | f |
|
||||||
| a | 0 | 100.1 | 199.5 | 299.5 |
|
| a | 0 | 100 | 199.9 | 300 |
|
||||||
| b | 100.1 | 0 | 99.4 | 199.5 |
|
| b | 100 | 0 | 100 | 200 |
|
||||||
| e | 199.5 | 99.4 | 0 | 100.1 |
|
| e | 199.9 | 100 | 0 | 100.1 |
|
||||||
| f | 299.5 | 199.5 | 100.1 | 0 |
|
| f | 300 | 200 | 100.1 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance 3x2 matrix
|
Scenario: Testbot - Travel distance 3x2 matrix
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -306,8 +306,8 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | b | e | f |
|
| | b | e | f |
|
||||||
| a | 100.1 | 199.5 | 299.5 |
|
| a | 100 | 199.9 | 300 |
|
||||||
| b | 0 | 99.4 | 199.5 |
|
| b | 0 | 100 | 200 |
|
||||||
|
|
||||||
Scenario: Testbot - All coordinates are from same small component
|
Scenario: Testbot - All coordinates are from same small component
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
@ -328,8 +328,8 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | f | g |
|
| | f | g |
|
||||||
| f | 0 | 298.2 |
|
| f | 0 | 300 |
|
||||||
| g | 298.2 | 0 |
|
| g | 300 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Coordinates are from different small component and snap to big CC
|
Scenario: Testbot - Coordinates are from different small component and snap to big CC
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
@ -362,10 +362,10 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | f | g | h | i |
|
| | f | g | h | i |
|
||||||
| f | 0 | 298.2 | 0 | 298.2 |
|
| f | 0 | 300 | 0 | 300 |
|
||||||
| g | 298.2 | 0 | 298.2 | 0 |
|
| g | 300 | 0 | 300 | 0 |
|
||||||
| h | 0 | 298.2 | 0 | 298.2 |
|
| h | 0 | 300 | 0 | 300 |
|
||||||
| i | 298.2 | 0 | 298.2 | 0 |
|
| i | 300 | 0 | 300 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix with loops
|
Scenario: Testbot - Travel distance matrix with loops
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -383,10 +383,10 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | 1 | 2 | 3 | 4 |
|
| | 1 | 2 | 3 | 4 |
|
||||||
| 1 | 0 | 100.1 | 399.6 | 499.7 |
|
| 1 | 0 | 100.1 | 399.9 | 500 |
|
||||||
| 2 | 699.1 | 0 | 299.5 | 399.6 |
|
| 2 | 699.8 | 0 | 299.9 | 399.9 |
|
||||||
| 3 | 399.6 | 499.7 | 0 | 100.1 |
|
| 3 | 399.9 | 500 | 0 | 100.1 |
|
||||||
| 4 | 299.5 | 399.6 | 699.1 | 0 |
|
| 4 | 299.9 | 399.9 | 699.8 | 0 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix based on segment durations
|
Scenario: Testbot - Travel distance matrix based on segment durations
|
||||||
@ -424,11 +424,11 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d | e |
|
| | a | b | c | d | e |
|
||||||
| a | 0 | 100.1 | 200.1 | 300.2 | 398.9 |
|
| a | 0 | 100 | 200 | 300 | 400 |
|
||||||
| b | 100.1 | 0 | 100.1 | 200.1 | 298.9 |
|
| b | 100 | 0 | 100.1 | 200 | 300.1 |
|
||||||
| c | 200.1 | 100.1 | 0 | 100.1 | 198.8 |
|
| c | 200 | 100.1 | 0 | 100 | 200 |
|
||||||
| d | 300.2 | 200.1 | 100.1 | 0 | 298.9 |
|
| d | 300 | 200 | 100 | 0 | 300 |
|
||||||
| e | 398.9 | 298.9 | 198.8 | 298.9 | 0 |
|
| e | 400 | 300.1 | 200 | 300 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix for alternative loop paths
|
Scenario: Testbot - Travel distance matrix for alternative loop paths
|
||||||
Given the profile file
|
Given the profile file
|
||||||
@ -468,25 +468,25 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
||||||
| 1 | 0 | 1096.7 | 298.9 | 199.5 | 598.4 | 498.3 | 897.3 | 797.9 |
|
| 1 | 0 | 1099.8 | 300 | 199.9 | 600 | 499.9 | 899.9 | 799.9 |
|
||||||
| 2 | 100.1 | 0 | 398.9 | 299.5 | 698.5 | 598.4 | 997.3 | 897.9 |
|
| 2 | 100.1 | 0 | 400 | 300 | 700 | 600 | 1000 | 899.9 |
|
||||||
| 3 | 897.9 | 797.9 | 0 | 1097.4 | 299.5 | 199.5 | 598.4 | 499 |
|
| 3 | 899.9 | 799.9 | 0 | 1099.8 | 300 | 199.9 | 600 | 499.9 |
|
||||||
| 4 | 997.3 | 897.3 | 99.4 | 0 | 398.9 | 298.9 | 697.8 | 598.4 |
|
| 4 | 1000 | 899.9 | 100.1 | 0 | 400 | 300 | 700 | 600 |
|
||||||
| 5 | 598.4 | 498.3 | 897.3 | 797.9 | 0 | 1096.7 | 298.9 | 199.5 |
|
| 5 | 600 | 499.9 | 899.9 | 799.9 | 0 | 1099.8 | 300 | 199.9 |
|
||||||
| 6 | 698.5 | 598.4 | 997.3 | 897.9 | 100.1 | 0 | 398.9 | 299.5 |
|
| 6 | 700 | 600 | 1000 | 899.9 | 100.1 | 0 | 400 | 300 |
|
||||||
| 7 | 299.5 | 199.5 | 598.4 | 499 | 897.9 | 797.9 | 0 | 1097.4 |
|
| 7 | 300 | 199.9 | 600 | 499.9 | 899.9 | 799.9 | 0 | 1099.8 |
|
||||||
| 8 | 398.9 | 298.9 | 697.8 | 598.4 | 997.3 | 897.3 | 99.4 | 0 |
|
| 8 | 400 | 300 | 700 | 600 | 1000 | 899.9 | 100.1 | 0 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | 1 |
|
| | 1 |
|
||||||
| 1 | 0 |
|
| 1 | 0 |
|
||||||
| 2 | 100.1 |
|
| 2 | 100.1 |
|
||||||
| 3 | 897.9 |
|
| 3 | 899.9 |
|
||||||
| 4 | 997.3 |
|
| 4 | 1000 |
|
||||||
| 5 | 598.4 |
|
| 5 | 600 |
|
||||||
| 6 | 698.5 |
|
| 6 | 700 |
|
||||||
| 7 | 299.5 |
|
| 7 | 300 |
|
||||||
| 8 | 398.9 |
|
| 8 | 400 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel distance matrix with ties
|
Scenario: Testbot - Travel distance matrix with ties
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -511,23 +511,23 @@ Feature: Basic Distance Matrix
|
|||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| a | b | ab,ab | 450m |
|
| a | b | ab,ab | 450m |
|
||||||
| a | c | ac,ac | 200m |
|
| a | c | ac,ac | 200m |
|
||||||
| a | d | ac,dc,dc | 499.9m |
|
| a | d | ac,dc,dc | 500m |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 450.3 | 198.8 | 499 |
|
| a | 0 | 450 | 200 | 500 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 450.3 |
|
| b | 450 |
|
||||||
| c | 198.8 |
|
| c | 200 |
|
||||||
| d | 499 |
|
| d | 500 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | c |
|
| | a | c |
|
||||||
| a | 0 | 198.8 |
|
| a | 0 | 200 |
|
||||||
| c | 198.8 | 0 |
|
| c | 200 | 0 |
|
||||||
|
|
||||||
|
|
||||||
# Check rounding errors
|
# Check rounding errors
|
||||||
@ -544,7 +544,7 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 1000.7 | 2001.4 | 3002.1 |
|
| a | 0 | 1000.1 | 2000 | 3000.1 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - OneToMany vs ManyToOne
|
Scenario: Testbot - OneToMany vs ManyToOne
|
||||||
@ -562,12 +562,12 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b |
|
| | a | b |
|
||||||
| b | 240.4 | 0 |
|
| b | 241.3 | 0 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 240.4 |
|
| b | 241.3 |
|
||||||
|
|
||||||
Scenario: Testbot - Varying distances between nodes
|
Scenario: Testbot - Varying distances between nodes
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -589,12 +589,13 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | c | d | e | f |
|
| | a | b | c | d | e | f |
|
||||||
| a | 0 | 100.1 | 300.2 | 650.5 | 1930.6 | 1533 |
|
| a | 0 | 100 | 300 | 650 | 660.5 | 1534.6 |
|
||||||
| b | 759 | 0 | 200.1 | 550.4 | 1830.5 | 1432.9 |
|
| b | 760.6 | 0 | 200 | 550.1 | 560.6 | 1434.6 |
|
||||||
| c | 558.8 | 658.9 | 0 | 350.3 | 1630.4 | 1232.8 |
|
| c | 560.6 | 660.5 | 0 | 350 | 360.5 | 1234.6 |
|
||||||
| d | 1478.9 | 1579 | 1779.1 | 0 | 1280.1 | 882.5 |
|
| d | 1484.6 | 1584.5| 1645.1 | 0 | 1284.5 | 884.6 |
|
||||||
| e | 198.8 | 298.9 | 499 | 710.3 | 0 | 1592.8 |
|
| e | 200 | 300 | 360.5 | 710.6 | 0 | 1595.2 |
|
||||||
| f | 596.4 | 696.5 | 896.6 | 1107.9 | 397.6 | 0 |
|
| f | 600 | 699.9 | 760.5 | 884.6 | 399.9 | 0 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
|
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
@ -614,21 +615,21 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
| a | 0 | 300 | 900 | 1500 |
|
||||||
| b | 300.2 | 0 | 600.5 | 1200.9 |
|
| b | 300 | 0 | 600 | 1200.1 |
|
||||||
| f | 900.7 | 600.5 | 0 | 300.2 |
|
| f | 900 | 600 | 0 | 300 |
|
||||||
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
| 1 | 1500 | 1200.1 | 300 | 0 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
| a | 0 | 300 | 900 | 1500 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 300.2 |
|
| b | 300 |
|
||||||
| f | 900.7 |
|
| f | 900 |
|
||||||
| 1 | 1501.1 |
|
| 1 | 1500 |
|
||||||
|
|
||||||
Scenario: Testbot - Fise input coordinate
|
Scenario: Testbot - Fise input coordinate
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
@ -649,21 +650,21 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
| a | 0 | 300 | 900 | 1500 |
|
||||||
| b | 300.2 | 0 | 600.5 | 1200.9 |
|
| b | 300 | 0 | 600 | 1200.1 |
|
||||||
| f | 900.7 | 600.5 | 0 | 300.2 |
|
| f | 900 | 600 | 0 | 300 |
|
||||||
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
| 1 | 1500 | 1200.1 | 300 | 0 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
| a | 0 | 300 | 900 | 1500 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 300.2 |
|
| b | 300 |
|
||||||
| f | 900.7 |
|
| f | 900 |
|
||||||
| 1 | 1501.1 |
|
| 1 | 1500 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
||||||
@ -685,28 +686,28 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 300.2 | 900.7 | 1200.9 |
|
| a | 0 | 300 | 900 | 1200 |
|
||||||
| b | 300.2 | 0 | 600.5 | 900.7 |
|
| b | 300 | 0 | 600 | 900 |
|
||||||
| f | 900.7 | 600.5 | 0 | 300.2 |
|
| f | 900 | 600 | 0 | 300 |
|
||||||
| 1 | 1200.9 | 900.7 | 300.2 | 0 |
|
| 1 | 1200 | 900 | 300 | 0 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 300.2 | 900.7 | 1200.9 |
|
| a | 0 | 300 | 900 | 1200 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 300.2 |
|
| b | 300 |
|
||||||
| f | 900.7 |
|
| f | 900 |
|
||||||
| 1 | 1200.9 |
|
| 1 | 1200 |
|
||||||
|
|
||||||
Scenario: Ensure consistency with route, and make sure offsets work in both directions
|
Scenario: Ensure consistency with route, and make sure offsets work in both directions
|
||||||
Given a grid size of 100 meters
|
Given a grid size of 100 meters
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b c d e f g h i j
|
a b c d e f g h i j
|
||||||
1 2
|
1 2 3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
@ -716,10 +717,13 @@ Feature: Basic Distance Matrix
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| 1 | 2 | abcdef,fghij,fghij | 999.9m |
|
| 1 | 2 | abcdef,fghij,fghij | 1000.1m |
|
||||||
|
| 1 | 3 | abcdef,fghij,fghij | 1400.1m |
|
||||||
|
| 2 | 3 | fghij,fghij | 400m |
|
||||||
|
|
||||||
|
|
||||||
# TODO: this is "correct", but inconsistent with viaroute
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | 1 | 2 |
|
| | 1 | 2 | 3 |
|
||||||
| 1 | 0 | 1000.7 |
|
| 1 | 0 | 1000.1 | 1400.1 |
|
||||||
| 2 | 1000.7 | 0 |
|
| 2 | 1000.1 | 0 | 400 |
|
||||||
|
| 3 | 1400.1 | 400 | 0 |
|
||||||
|
|||||||
@ -447,14 +447,14 @@ Feature: Basic Duration Matrix
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
||||||
| 1 | 0 | 11 | 3 | 2 | 6 | 5 | 8.9 | 7.9 |
|
| 1 | 0 | 10.9 | 3 | 1.9 | 6 | 4.9 | 9 | 7.9 |
|
||||||
| 2 | 1 | 0 | 4 | 3 | 7 | 6 | 9.9 | 8.9 |
|
| 2 | 1.1 | 0 | 4.1 | 3 | 7.1 | 6 | 10.1 | 9 |
|
||||||
| 3 | 9 | 8 | 0 | 11 | 3 | 2 | 5.9 | 4.9 |
|
| 3 | 9 | 7.9 | 0 | 10.9 | 3 | 1.9 | 6 | 4.9 |
|
||||||
| 4 | 10 | 9 | 1 | 0 | 4 | 3 | 6.9 | 5.9 |
|
| 4 | 10.1 | 9 | 1.1 | 0 | 4.1 | 3 | 7.1 | 6 |
|
||||||
| 5 | 6 | 5 | 9 | 8 | 0 | 11 | 2.9 | 1.9 |
|
| 5 | 6 | 4.9 | 9 | 7.9 | 0 | 10.9 | 3 | 1.9 |
|
||||||
| 6 | 7 | 6 | 10 | 9 | 1 | 0 | 3.9 | 2.9 |
|
| 6 | 7.1 | 6 | 10.1 | 9 | 1.1 | 0 | 4.1 | 3 |
|
||||||
| 7 | 3.1 | 2.1 | 6.1 | 5.1 | 9.1 | 8.1 | 0 | 11 |
|
| 7 | 3 | 1.9 | 6 | 4.9 | 9 | 7.9 | 0 | 10.9 |
|
||||||
| 8 | 4.1 | 3.1 | 7.1 | 6.1 | 10.1 | 9.1 | 1 | 0 |
|
| 8 | 4.1 | 3 | 7.1 | 6 | 10.1 | 9 | 1.1 | 0 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Travel time matrix with ties
|
Scenario: Testbot - Travel time matrix with ties
|
||||||
@ -491,18 +491,18 @@ Feature: Basic Duration Matrix
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance | time | weight |
|
| from | to | route | distance | time | weight |
|
||||||
| a | c | ac,ac | 200m | 5s | 5 |
|
| a | c | ac,ac | 200m | 1s | 1 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | c | d |
|
| | a | b | c | d |
|
||||||
| a | 0 | 1 | 5 | 10 |
|
| a | 0 | 1 | 1 | 6 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 1 |
|
| b | 1 |
|
||||||
| c | 15 |
|
| c | 1 |
|
||||||
| d | 10 |
|
| d | 6 |
|
||||||
|
|
||||||
Scenario: Testbot - OneToMany vs ManyToOne
|
Scenario: Testbot - OneToMany vs ManyToOne
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -544,20 +544,20 @@ Feature: Basic Duration Matrix
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 30 | 18 | 30 |
|
| a | 0 | 30 | 17.9 | 30 |
|
||||||
| b | 30 | 0 | 12 | 24 |
|
| b | 30 | 0 | 12 | 24 |
|
||||||
| f | 18 | 12 | 0 | 30 |
|
| f | 17.9 | 12 | 0 | 30 |
|
||||||
| 1 | 30 | 24 | 30 | 0 |
|
| 1 | 30 | 24 | 30 | 0 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 30 | 18 | 30 |
|
| a | 0 | 30 | 17.9 | 30 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 30 |
|
| b | 30 |
|
||||||
| f | 18 |
|
| f | 17.9 |
|
||||||
| 1 | 30 |
|
| 1 | 30 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get estimates for
|
When I request a travel time matrix I should get estimates for
|
||||||
@ -597,20 +597,20 @@ Feature: Basic Duration Matrix
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 30 | 18 | 30 |
|
| a | 0 | 30 | 17.9 | 30 |
|
||||||
| b | 30 | 0 | 12 | 24 |
|
| b | 30 | 0 | 12 | 24 |
|
||||||
| f | 18 | 12 | 0 | 30 |
|
| f | 17.9 | 12 | 0 | 30 |
|
||||||
| 1 | 30 | 24 | 30 | 0 |
|
| 1 | 30 | 24 | 30 | 0 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 30 | 18 | 30 |
|
| a | 0 | 30 | 17.9 | 30 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 30 |
|
| b | 30 |
|
||||||
| f | 18 |
|
| f | 17.9 |
|
||||||
| 1 | 30 |
|
| 1 | 30 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get estimates for
|
When I request a travel time matrix I should get estimates for
|
||||||
@ -651,21 +651,21 @@ Feature: Basic Duration Matrix
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 30 | 18 | 24 |
|
| a | 0 | 30 | 17.9 | 23.9 |
|
||||||
| b | 30 | 0 | 12 | 18 |
|
| b | 30 | 0 | 12 | 17.9 |
|
||||||
| f | 18 | 12 | 0 | 30 |
|
| f | 17.9 | 12 | 0 | 30 |
|
||||||
| 1 | 24 | 18 | 30 | 0 |
|
| 1 | 23.9 | 17.9 | 30 | 0 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 30 | 18 | 24 |
|
| a | 0 | 30 | 17.9 | 23.9 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 30 |
|
| b | 30 |
|
||||||
| f | 18 |
|
| f | 17.9 |
|
||||||
| 1 | 24 |
|
| 1 | 23.9 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get estimates for
|
When I request a travel time matrix I should get estimates for
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
@ -720,21 +720,21 @@ Feature: Basic Duration Matrix
|
|||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 60 | 36 | 48 |
|
| a | 0 | 60 | 35.8 | 47.8 |
|
||||||
| b | 60 | 0 | 24 | 36 |
|
| b | 60 | 0 | 24 | 35.8 |
|
||||||
| f | 36 | 24 | 0 | 60 |
|
| f | 35.8 | 24 | 0 | 60 |
|
||||||
| 1 | 48 | 36 | 60 | 0 |
|
| 1 | 47.8 | 35.8 | 60 | 0 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 60 | 36 | 48 |
|
| a | 0 | 60 | 35.8 | 47.8 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 60 |
|
| b | 60 |
|
||||||
| f | 36 |
|
| f | 35.8 |
|
||||||
| 1 | 48 |
|
| 1 | 47.8 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get estimates for
|
When I request a travel time matrix I should get estimates for
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
|
|||||||
@ -21,8 +21,27 @@ Feature: Basic Map Matching
|
|||||||
| abcd | no |
|
| abcd | no |
|
||||||
|
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | timestamps | matchings |
|
| trace | timestamps | matchings | data_version |
|
||||||
| ab1d | 0 1 2 3 | ad |
|
| ab1d | 0 1 2 3 | ad | |
|
||||||
|
|
||||||
|
Scenario: Data_version test on matching
|
||||||
|
Given a grid size of 100 meters
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b c d
|
||||||
|
|
||||||
|
1
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the extract extra arguments "--data_version cucumber_data_version"
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| abcd | no |
|
||||||
|
|
||||||
|
When I match I should get
|
||||||
|
| trace | timestamps | matchings | data_version |
|
||||||
|
| ab1d | 0 1 2 3 | ad | cucumber_data_version |
|
||||||
|
|
||||||
Scenario: Testbot - Map matching with trace splitting
|
Scenario: Testbot - Map matching with trace splitting
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -280,7 +299,7 @@ Feature: Basic Map Matching
|
|||||||
|
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | matchings | geometry |
|
| trace | matchings | geometry |
|
||||||
| efbc | efbc | 1,0.99964,1.00036,0.99964,1.00036,1,1.000719,1 |
|
| efbc | efbc | 1,0.999638,1.000359,0.999638,1.000359,1,1.000719,1 |
|
||||||
|
|
||||||
Scenario: Testbot - Geometry details using geojson
|
Scenario: Testbot - Geometry details using geojson
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -356,7 +375,7 @@ Feature: Basic Map Matching
|
|||||||
|
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | matchings | alternatives |
|
| trace | matchings | alternatives |
|
||||||
| abcdef | abcde | 0,0,0,0,1,1 |
|
| abcdef | abcde | 0,0,0,1,1,1 |
|
||||||
|
|
||||||
Scenario: Testbot - Speed greater than speed threshold
|
Scenario: Testbot - Speed greater than speed threshold
|
||||||
Given a grid size of 100 meters
|
Given a grid size of 100 meters
|
||||||
@ -652,7 +671,7 @@ Feature: Basic Map Matching
|
|||||||
|
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | code |
|
| trace | geometry | code |
|
||||||
| defgh | 1,1,1,0.999461,1.000674,0.999461 | Ok |
|
| defgh | 1,1,1,0.999457,1.000674,0.999457 | Ok |
|
||||||
|
|
||||||
@match @testbot
|
@match @testbot
|
||||||
Scenario: Regression test - waypoints trimming too much geometry
|
Scenario: Regression test - waypoints trimming too much geometry
|
||||||
@ -683,7 +702,7 @@ Feature: Basic Map Matching
|
|||||||
| overview | full |
|
| overview | full |
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | code |
|
| trace | geometry | code |
|
||||||
| bgkj | 1.000135,1,1.000135,0.99964,1.000387,0.999137 | Ok |
|
| bgkj | 1.000135,1,1.000135,0.999638,1.000386,0.999132 | Ok |
|
||||||
|
|
||||||
|
|
||||||
@match @testbot
|
@match @testbot
|
||||||
@ -713,11 +732,11 @@ Feature: Basic Map Matching
|
|||||||
| steps | true |
|
| steps | true |
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | turns | code |
|
| trace | geometry | turns | code |
|
||||||
| abc | 1,0.99973,1.00027,0.99973,1.000539,0.99973 | depart,arrive | Ok |
|
| abc | 1,0.999729,1.000269,0.999729,1.000539,0.999729 | depart,arrive | Ok |
|
||||||
| abd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok |
|
| abd | 1,0.999729,1.000269,0.999729,1.000269,0.999457 | depart,turn right,arrive | Ok |
|
||||||
| abe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok |
|
| abe | 1,0.999729,1.000269,0.999729,1.000269,1 | depart,turn left,arrive | Ok |
|
||||||
| ahd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok |
|
| ahd | 1,0.999729,1.000269,0.999729,1.000269,0.999457 | depart,turn right,arrive | Ok |
|
||||||
| ahe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok |
|
| ahe | 1,0.999729,1.000269,0.999729,1.000269,1 | depart,turn left,arrive | Ok |
|
||||||
|
|
||||||
@match @testbot
|
@match @testbot
|
||||||
Scenario: Regression test - add source phantoms properly (one phantom on one edge)
|
Scenario: Regression test - add source phantoms properly (one phantom on one edge)
|
||||||
@ -741,8 +760,8 @@ Feature: Basic Map Matching
|
|||||||
| generate_hints | false |
|
| generate_hints | false |
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | a:duration | a:weight | duration |
|
| trace | geometry | a:duration | a:weight | duration |
|
||||||
| 123 | 1.000135,1,1.000225,1,1.00036,1,1.000405,1,1.00045,1 | 1:1.5:0.5:0.5 | 1:1.5:0.5:0.5 | 3.5 |
|
| 123 | 1.000135,1,1.000225,1,1.000359,1,1.000404,1,1.000449,1 | 1:1.5:0.5:0.4 | 1:1.5:0.5:0.4 | 3.4 |
|
||||||
| 321 | 1.00045,1,1.000405,1,1.00036,1,1.000225,1,1.000135,1 | 0.5:0.5:1.5:1 | 0.5:0.5:1.5:1 | 3.5 |
|
| 321 | 1.000449,1,1.000404,1,1.000359,1,1.000225,1,1.000135,1 | 0.4:0.5:1.5:1 | 0.4:0.5:1.5:1 | 3.4 |
|
||||||
|
|
||||||
@match @testbot
|
@match @testbot
|
||||||
Scenario: Regression test - add source phantom properly (two phantoms on one edge)
|
Scenario: Regression test - add source phantom properly (two phantoms on one edge)
|
||||||
@ -766,8 +785,8 @@ Feature: Basic Map Matching
|
|||||||
| generate_hints | false |
|
| generate_hints | false |
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | a:duration | a:weight | duration |
|
| trace | geometry | a:duration | a:weight | duration |
|
||||||
| 1234 | 1.000135,1,1.000225,1,1.000405,1,1.00045,1 | 1:2:0.5 | 1:2:0.5 | 3.5 |
|
| 1234 | 1.000135,1,1.000225,1,1.000404,1,1.000449,1 | 1:2:0.4 | 1:2:0.4 | 3.4 |
|
||||||
| 4321 | 1.00045,1,1.000405,1,1.000225,1,1.000135,1 | 0.5:2:1 | 0.5:2:1 | 3.5 |
|
| 4321 | 1.000449,1,1.000404,1,1.000225,1,1.000135,1 | 0.4:2:1 | 0.4:2:1 | 3.4 |
|
||||||
|
|
||||||
@match @testbot
|
@match @testbot
|
||||||
Scenario: Regression test - add source phantom properly (two phantoms on one edge)
|
Scenario: Regression test - add source phantom properly (two phantoms on one edge)
|
||||||
@ -791,5 +810,6 @@ Feature: Basic Map Matching
|
|||||||
# These should have the same weights/duration in either direction
|
# These should have the same weights/duration in either direction
|
||||||
When I match I should get
|
When I match I should get
|
||||||
| trace | geometry | a:distance | a:duration | a:weight | duration |
|
| trace | geometry | a:distance | a:duration | a:weight | duration |
|
||||||
| 2345 | 1.00018,1,1.000315,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
|
| 2345 | 1.00018,1,1.000314,1 | 14.914666 | 1.4 | 1.4 | 1.4 |
|
||||||
| 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
|
| 4321 | 1.00027,1,1.000135,1 | 15.02597 | 1.5 | 1.5 | 1.5 |
|
||||||
|
|
||||||
|
|||||||
@ -110,33 +110,34 @@ Feature: Multi level routing
|
|||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | f | l | o |
|
| | a | f | l | o |
|
||||||
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
|
| a | 0 | 2391.6 | 1570.8 | 1370.9 |
|
||||||
| f | 2383.7 | 0 | 1293.3 | 1617.3 |
|
| f | 2391.6 | 0 | 1297.2 | 1620.9 |
|
||||||
| l | 1566.9 | 1293.3 | 0 | 800.5 |
|
| l | 1570.8 | 1297.2 | 0 | 800 |
|
||||||
| o | 1366.8 | 1617.3 | 800.5 | 0 |
|
| o | 1370.9 | 1620.9 | 800 | 0 |
|
||||||
|
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | f | l | o |
|
| | a | f | l | o |
|
||||||
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
|
| a | 0 | 2391.6 | 1570.8 | 1370.9 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| f | 2383.7 |
|
| f | 2391.6 |
|
||||||
| l | 1566.9 |
|
| l | 1570.8 |
|
||||||
| o | 1366.8 |
|
| o | 1370.9 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | f | l | o |
|
| | a | f | l | o |
|
||||||
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
|
| a | 0 | 2391.6 | 1570.8 | 1370.9 |
|
||||||
| f | 2383.7 | 0 | 1293.3 | 1617.3 |
|
| f | 2391.6 | 0 | 1297.2 | 1620.9 |
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a | o |
|
| | a | o |
|
||||||
| a | 0 | 1366.8 |
|
| a | 0 | 1370.9 |
|
||||||
| f | 2383.7 | 1617.3 |
|
| f | 2391.6 | 1620.9 |
|
||||||
| l | 1566.9 | 800.5 |
|
| l | 1570.8 | 800 |
|
||||||
| o | 1366.8 | 0 |
|
| o | 1370.9 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Multi level routing: horizontal road
|
Scenario: Testbot - Multi level routing: horizontal road
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
@ -53,7 +53,7 @@ Feature: Routing close to the [0,0] origin
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| b | d | abcde,abcde | 200m |
|
| b | d | abcde,abcde | 198.8m |
|
||||||
| d | b | | |
|
| d | b | | |
|
||||||
|
|
||||||
Scenario: North-south oneways crossing the origin
|
Scenario: North-south oneways crossing the origin
|
||||||
@ -71,5 +71,5 @@ Feature: Routing close to the [0,0] origin
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| b | d | abcde,abcde | 200m |
|
| b | d | abcde,abcde | 200.2m |
|
||||||
| d | b | | |
|
| d | b | | |
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Feature: Distance calculation
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| c | d | cd,cd | 6028844m ~4.5% |
|
| c | d | cd,cd | 6310675.7m ~4.5% |
|
||||||
|
|
||||||
Scenario: Approximated Longitudinal distances at latitude 80
|
Scenario: Approximated Longitudinal distances at latitude 80
|
||||||
Given the node locations
|
Given the node locations
|
||||||
@ -55,7 +55,7 @@ Feature: Distance calculation
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| a | b | ab,ab | 8905559m ~0.1% |
|
| a | b | ab,ab | 8882574.6m ~0.1% |
|
||||||
|
|
||||||
Scenario: Approximated Latitudinal distances at longitude 45
|
Scenario: Approximated Latitudinal distances at longitude 45
|
||||||
Given the node locations
|
Given the node locations
|
||||||
@ -69,7 +69,7 @@ Feature: Distance calculation
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| a | b | ab,ab | 8905559m ~0.1% |
|
| a | b | ab,ab | 8882574.6m ~0.1% |
|
||||||
|
|
||||||
Scenario: Approximated Latitudinal distances at longitude 80
|
Scenario: Approximated Latitudinal distances at longitude 80
|
||||||
Given the node locations
|
Given the node locations
|
||||||
@ -83,4 +83,4 @@ Feature: Distance calculation
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | distance |
|
| from | to | route | distance |
|
||||||
| a | b | ab,ab | 8905559m ~0.1% |
|
| a | b | ab,ab | 8882574.6m ~0.1% |
|
||||||
|
|||||||
@ -24,12 +24,12 @@ Feature: Projection to nearest point on road
|
|||||||
Scenario: Projection onto way at high latitudes, 1km distance
|
Scenario: Projection onto way at high latitudes, 1km distance
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | bearing | distance |
|
| from | to | route | bearing | distance |
|
||||||
| b | a | abc,abc | 0->225,225->0 | 1000m |
|
| b | a | abc,abc | 0->225,225->0 | 1002.9m |
|
||||||
| b | c | abc,abc | 0->45,45->0 | 1000m +- 3 |
|
| b | c | abc,abc | 0->45,45->0 | 1005m +- 3 |
|
||||||
| a | d | abc,abc | 0->45,45->0 | 1000m |
|
| a | d | abc,abc | 0->45,45->0 | 1002.9m |
|
||||||
| d | a | abc,abc | 0->225,225->0 | 1000m |
|
| d | a | abc,abc | 0->225,225->0 | 1002.9m |
|
||||||
| c | d | abc,abc | 0->225,225->0 | 1000m +- 3 |
|
| c | d | abc,abc | 0->225,225->0 | 1005m +- 3 |
|
||||||
| d | c | abc,abc | 0->45,45->0 | 1000m +- 3 |
|
| d | c | abc,abc | 0->45,45->0 | 1005m +- 3 |
|
||||||
|
|
||||||
Scenario: Projection onto way at high latitudes, no distance
|
Scenario: Projection onto way at high latitudes, no distance
|
||||||
When I route I should get
|
When I route I should get
|
||||||
|
|||||||
@ -47,11 +47,31 @@ Feature: Snap start/end point to the nearest way
|
|||||||
| adb |
|
| adb |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route | data_version |
|
||||||
| 1 | b | adb,adb |
|
| 1 | b | adb,adb | |
|
||||||
| 2 | b | adb,adb |
|
| 2 | b | adb,adb | |
|
||||||
| 6 | b | aub,aub |
|
| 6 | b | aub,aub | |
|
||||||
| 7 | b | aub,aub |
|
| 7 | b | aub,aub | |
|
||||||
|
|
||||||
|
Scenario: Data_version check on nearest
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
4 5 6 7
|
||||||
|
3 a u
|
||||||
|
2
|
||||||
|
1 d b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the extract extra arguments "--data_version cucumber_data_version"
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| aub |
|
||||||
|
| adb |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | data_version |
|
||||||
|
| 1 | b | adb,adb | cucumber_data_version |
|
||||||
|
|
||||||
Scenario: Snap to edge right under start/end point
|
Scenario: Snap to edge right under start/end point
|
||||||
Given the node map
|
Given the node map
|
||||||
|
|||||||
629
features/testbot/snap_intersection.feature
Normal file
629
features/testbot/snap_intersection.feature
Normal file
@ -0,0 +1,629 @@
|
|||||||
|
Feature: Snapping at intersections
|
||||||
|
|
||||||
|
Background:
|
||||||
|
# Use turnbot so that we can validate when we are
|
||||||
|
# snapping to one of many potential candidate ways
|
||||||
|
Given the profile "turnbot"
|
||||||
|
|
||||||
|
# https://github.com/Project-OSRM/osrm-backend/issues/4465
|
||||||
|
Scenario: Snapping source to intersection with one-way roads
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a e c
|
||||||
|
\ | /
|
||||||
|
d
|
||||||
|
|
||||||
|
1
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| da | yes |
|
||||||
|
| dc | yes |
|
||||||
|
| de | yes |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| 1 | e | de,de | 20s |
|
||||||
|
| 1 | a | da,da | 28.3s |
|
||||||
|
| 1 | c | dc,dc | 28.3s |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | c | e |
|
||||||
|
| 1 | 28.3 | 28.3 | 20 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping destination to intersection with one-way roads
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a e c
|
||||||
|
\ | /
|
||||||
|
d
|
||||||
|
|
||||||
|
1
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| da | -1 |
|
||||||
|
| dc | -1 |
|
||||||
|
| de | -1 |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| e | 1 | de,de | 20s |
|
||||||
|
| a | 1 | da,da | 28.3s |
|
||||||
|
| c | 1 | dc,dc | 28.3s |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | 1 |
|
||||||
|
| a | 28.3 |
|
||||||
|
| c | 28.3 |
|
||||||
|
| e | 20 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping to intersection with bi-directional roads
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a e
|
||||||
|
| /
|
||||||
|
d---c
|
||||||
|
|
||||||
|
1
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ad |
|
||||||
|
| ed |
|
||||||
|
| dc |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| 1 | c | dc,dc | 20s | 20 |
|
||||||
|
| 1 | a | ad,ad | 20s | 20 |
|
||||||
|
| 1 | e | ed,ed | 28.3s | 28.3 |
|
||||||
|
| c | 1 | dc,dc | 20s | 20 |
|
||||||
|
| a | 1 | ad,ad | 20s | 20 |
|
||||||
|
| e | 1 | ed,ed | 28.3s | 28.3 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | c | e |
|
||||||
|
| 1 | 20 | 20 | 28.3 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | 1 |
|
||||||
|
| a | 20 |
|
||||||
|
| c | 20 |
|
||||||
|
| e | 28.3 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping at compressible node
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a---b---c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| b | c | abc,abc | 20s | 20 |
|
||||||
|
| b | a | abc,abc | 20s | 20 |
|
||||||
|
| a | b | abc,abc | 20s | 20 |
|
||||||
|
| c | b | abc,abc | 20s | 20 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping at compressible node with traffic lights
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a---b---c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
|
||||||
|
# Turnbot will use the turn penalty instead of traffic penalty.
|
||||||
|
# We do this to induce a penalty between two edges of the same
|
||||||
|
# segment.
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
# Snaps to first edge in forward direction
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| b | c | abc,abc | 40s | 40 |
|
||||||
|
| b | a | abc,abc | 20s | 20 |
|
||||||
|
| a | b | abc,abc | 20s | 20 |
|
||||||
|
| c | b | abc,abc | 40s | 40 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping at compressible node traffic lights, one-way
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-->b-->c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| abc | yes |
|
||||||
|
|
||||||
|
# Turnbot will use the turn penalty instead of traffic penalty.
|
||||||
|
# We do this to induce a penalty between two edges of the same
|
||||||
|
# segment.
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
|
||||||
|
# Snaps to first edge in forward direction
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| b | c | abc,abc | 40s | 40 |
|
||||||
|
| a | b | abc,abc | 20s | 20 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | code |
|
||||||
|
| b | a | NoRoute |
|
||||||
|
| c | b | NoRoute |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping at compressible node traffic lights, reverse one-way
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a<--b<--c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| abc | -1 |
|
||||||
|
|
||||||
|
# Turnbot will use the turn penalty instead of traffic penalty.
|
||||||
|
# We do this to induce a penalty between two edges of the same
|
||||||
|
# segment.
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
|
||||||
|
# Snaps to first edge in forward direction - as this is one-way,
|
||||||
|
# the forward direction has changed.
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| b | a | abc,abc | 40s | 40 |
|
||||||
|
| c | b | abc,abc | 20s | 20 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | code |
|
||||||
|
| b | c | NoRoute |
|
||||||
|
| a | b | NoRoute |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping at traffic lights, reverse disabled
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-->b-->c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
|
||||||
|
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||||
|
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||||
|
And the speed file
|
||||||
|
"""
|
||||||
|
2,1,0
|
||||||
|
3,2,0
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Turnbot will use the turn penalty instead of traffic penalty.
|
||||||
|
# We do this to induce a penalty between two edges of the same
|
||||||
|
# segment.
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
# Snaps to first edge in forward direction.
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| b | c | abc,abc | 40s | 40 |
|
||||||
|
| a | b | abc,abc | 20s | 20 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | code |
|
||||||
|
| b | a | NoRoute |
|
||||||
|
| c | b | NoRoute |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping at traffic lights, forward disabled
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a<--b<--c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
|
||||||
|
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,3,0
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Turnbot will use the turn penalty instead of traffic penalty.
|
||||||
|
# We do this to induce a penalty between two edges of the same
|
||||||
|
# segment.
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
# Forward direction is disabled, still snaps to first edge in forward direction
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| b | a | abc,abc | 20s | 20 |
|
||||||
|
| c | b | abc,abc | 40s | 40 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | code |
|
||||||
|
| b | c | NoRoute |
|
||||||
|
| a | b | NoRoute |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snap to target node with next section of segment blocked
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a-->b---c---d<--e
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
| cde |
|
||||||
|
|
||||||
|
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||||
|
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||||
|
And the speed file
|
||||||
|
"""
|
||||||
|
2,1,0
|
||||||
|
4,5,0
|
||||||
|
"""
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| a | d | abc,cde,cde | 60s | 60 |
|
||||||
|
| e | b | cde,abc,abc | 60s | 60 |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | code |
|
||||||
|
| a | e | NoRoute |
|
||||||
|
| e | a | NoRoute |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snapping to source node with previous section of segment blocked
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a<--b---c---d-->e
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
| cde |
|
||||||
|
|
||||||
|
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
|
||||||
|
5,4,0
|
||||||
|
"""
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | code |
|
||||||
|
| a | e | NoRoute |
|
||||||
|
| b | e | NoRoute |
|
||||||
|
| e | a | NoRoute |
|
||||||
|
| d | a | NoRoute |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Only snaps to one of many equidistant nearest locations
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b-------c
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
a 1 d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| cd |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| 1 | b | ab,ab | 30s | 30 |
|
||||||
|
| 1 | c | ab,bc,bc | 80s +-1 | 80 +-1 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Snaps to alternative big SCC candidate if nearest candidates are not strongly connected
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
g---h---i
|
||||||
|
a-----b-----c
|
||||||
|
|
|
||||||
|
f-----e-----d
|
||||||
|
j---k---l
|
||||||
|
2
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the extract extra arguments "--small-component-size=4"
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
| cd |
|
||||||
|
| fed |
|
||||||
|
| ghi |
|
||||||
|
| jkl |
|
||||||
|
|
||||||
|
# As forward direction is disabled...
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight | locations |
|
||||||
|
| 1 | 2 | abc,cd,fed,fed | 100s +-1 | 100 +-1 | b,c,d,e |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Can use big or small SCC nearest candidates if at same location
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
a-----b-----c
|
||||||
|
| |
|
||||||
|
g |
|
||||||
|
|
|
||||||
|
f-----e-----d
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the extract extra arguments "--small-component-size=4"
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | no |
|
||||||
|
| bc | no |
|
||||||
|
| cd | no |
|
||||||
|
| fed | no |
|
||||||
|
| bg | yes | # small SCC
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | ab | bg | b | no_right_turn |
|
||||||
|
| restriction | bc | bg | b | no_left_turn |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight | locations |
|
||||||
|
| 1 | g | bg,bg | 20s | 20 | b,g |
|
||||||
|
| 1 | e | bc,cd,fed,fed | 120s +-1 | 120 +-1 | b,c,d,e |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Using small SCC candidates when at same location as big SCC alternatives is not supported
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
g---h---i
|
||||||
|
a-----b-----c
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
m |
|
||||||
|
f-----e-----d
|
||||||
|
j---k---l
|
||||||
|
2
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the extract extra arguments "--small-component-size=4"
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | no |
|
||||||
|
| bc | no |
|
||||||
|
| cd | no |
|
||||||
|
| fed | no |
|
||||||
|
| ghi | no |
|
||||||
|
| jkl | no |
|
||||||
|
| bm | yes | # small SCC
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | ab | bm | b | no_right_turn |
|
||||||
|
| restriction | bc | bm | b | no_left_turn |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight | locations |
|
||||||
|
| 1 | 2 | bc,cd,fed,fed | 120s +-1 | 120 +-1 | b,c,d,e |
|
||||||
|
| 1 | m | bc,cd,fed,fed | 120s +-1 | 120 +-1 | b,c,d,e |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Shortest via path with continuation, simple loop
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a---b
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | time | weight |
|
||||||
|
| a,b,a | ab,ab,ab,ab | 60s | 60 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Shortest via path with uturns, simple loop
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a---b
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the query options
|
||||||
|
| continue_straight | false |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
|
||||||
|
# Does not pay the cost of the turn
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | time | weight |
|
||||||
|
| a,b,a | ab,ab,ab,ab | 40s | 40 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Shortest path with multiple endpoint snapping candidates
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b
|
||||||
|
|
||||||
|
c
|
||||||
|
|
||||||
|
a d f
|
||||||
|
|
||||||
|
e
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | no |
|
||||||
|
| ac | no |
|
||||||
|
| ad | no |
|
||||||
|
| ae | no |
|
||||||
|
| bf | no |
|
||||||
|
| cf | yes |
|
||||||
|
| df | yes |
|
||||||
|
| ef | no |
|
||||||
|
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time | weight |
|
||||||
|
| a | f | ad,df,df | 40s | 40 |
|
||||||
|
| f | a | ef,ae,ae | 66.6s | 66.6 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | f |
|
||||||
|
| a | 0 | 40 |
|
||||||
|
| f | 66.6 | 0 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Shortest via path with continuation, multiple waypoint snapping candidates
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b g
|
||||||
|
|
||||||
|
c h
|
||||||
|
|
||||||
|
a d f i
|
||||||
|
k
|
||||||
|
e j
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | no |
|
||||||
|
| ac | no |
|
||||||
|
| ad | no |
|
||||||
|
| ae | no |
|
||||||
|
| bf | no |
|
||||||
|
| cf | yes |
|
||||||
|
| df | yes |
|
||||||
|
| ef | no |
|
||||||
|
| fg | no |
|
||||||
|
| fh | -1 |
|
||||||
|
| fi | -1 |
|
||||||
|
| fj | no |
|
||||||
|
| gk | no |
|
||||||
|
| hk | no |
|
||||||
|
| ik | no |
|
||||||
|
| kj | no |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | df | fg | f | only_left_turn |
|
||||||
|
| restriction | fi | bf | f | only_right_turn |
|
||||||
|
|
||||||
|
# Longer routes can take different paths from sub-routes
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | time | weight |
|
||||||
|
| a,f | ad,df,df | 40s | 40 |
|
||||||
|
| f,k | fj,kj,kj | 65.6s | 65.6 |
|
||||||
|
| a,f,k | ac,cf,cf,fj,kj,kj | 132.8s | 132.8 |
|
||||||
|
| k,f | ik,fi,fi | 54.3s | 54.3 |
|
||||||
|
| f,a | ef,ae,ae | 66.6s | 66.6 |
|
||||||
|
| k,f,a | kj,fj,fj,ef,ae,ae | 141.4s | 141.4 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | f | k |
|
||||||
|
| a | 0 | 40 | 132.8 |
|
||||||
|
| f | 66.6 | 0 | 65.6 |
|
||||||
|
| k | 141.4 | 54.3 | 0 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Shortest via path with uturns, multiple waypoint snapping candidates
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
b g
|
||||||
|
|
||||||
|
c h
|
||||||
|
|
||||||
|
a d f i
|
||||||
|
k
|
||||||
|
e j
|
||||||
|
"""
|
||||||
|
|
||||||
|
Given the query options
|
||||||
|
| continue_straight | false |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | no |
|
||||||
|
| ac | no |
|
||||||
|
| ad | no |
|
||||||
|
| ae | no |
|
||||||
|
| bf | no |
|
||||||
|
| cf | yes |
|
||||||
|
| df | yes |
|
||||||
|
| ef | no |
|
||||||
|
| fg | no |
|
||||||
|
| fh | -1 |
|
||||||
|
| fi | -1 |
|
||||||
|
| fj | no |
|
||||||
|
| gk | no |
|
||||||
|
| hk | no |
|
||||||
|
| ik | no |
|
||||||
|
| kj | no |
|
||||||
|
|
||||||
|
And the relations
|
||||||
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
| restriction | df | fg | f | only_left_turn |
|
||||||
|
| restriction | fi | bf | f | only_right_turn |
|
||||||
|
|
||||||
|
# Longer routes use same path as sub-routes
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | time | weight |
|
||||||
|
| a,f | ad,df,df | 40s | 40 |
|
||||||
|
| f,k | fj,kj,kj | 65.6s | 65.6 |
|
||||||
|
| a,f,k | ad,df,df,fj,kj,kj | 105.6s | 105.6 |
|
||||||
|
| k,f | ik,fi,fi | 54.3s | 54.3 |
|
||||||
|
| f,a | ef,ae,ae | 66.6s | 66.6 |
|
||||||
|
| k,f,a | ik,fi,fi,ef,ae,ae | 120.9s | 120.9 |
|
||||||
@ -48,13 +48,13 @@ Feature: Traffic - speeds
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | weights | a:datasources |
|
| from | to | route | speed | weights | a:datasources |
|
||||||
| a | b | ad,de,eb,eb | 30 km/h | 1275.7,400.4,378.2,0 | 1:0:0 |
|
| a | b | ad,de,eb,eb | 30 km/h | 1273.9,400.8,378.5,0 | 1:0:0 |
|
||||||
| a | c | ad,dc,dc | 31 km/h | 1275.7,956.8,0 | 1:0 |
|
| a | c | ad,dc,dc | 31 km/h | 1273.9,955.4,0 | 1:0 |
|
||||||
| b | c | bc,bc | 27 km/h | 741.5,0 | 1 |
|
| b | c | bc,bc | 27 km/h | 737.2,0 | 1 |
|
||||||
| a | d | ad,ad | 27 km/h | 1275.7,0 | 1 |
|
| a | d | ad,ad | 27 km/h | 1273.9,0 | 1 |
|
||||||
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 |
|
| d | c | dc,dc | 36 km/h | 955.4,0 | 0 |
|
||||||
| g | b | fb,fb | 36 km/h | 164.7,0 | 0 |
|
| g | b | fb,fb | 36 km/h | 164.4,0 | 0 |
|
||||||
| a | g | ad,df,fb,fb | 30 km/h | 1295.7,487.5,304.7,0 | 1:0:0 |
|
| a | g | ad,df,fb,fb | 30 km/h | 1293.9,486.8,304.3,0 | 1:0:0 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Weighting based on speed file weights, ETA based on file durations
|
Scenario: Weighting based on speed file weights, ETA based on file durations
|
||||||
@ -74,13 +74,13 @@ Feature: Traffic - speeds
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | weights | a:datasources |
|
| from | to | route | speed | weights | a:datasources |
|
||||||
| a | b | ad,de,eb,eb | 30 km/h | 1275.7,400.4,378.2,0 | 1:0:0 |
|
| a | b | ad,de,eb,eb | 30 km/h | 1273.9,400.8,378.5,0 | 1:0:0 |
|
||||||
| a | c | ad,dc,dc | 31 km/h | 1275.7,956.8,0 | 1:0 |
|
| a | c | ad,dc,dc | 31 km/h | 1273.9,955.4,0 | 1:0 |
|
||||||
| b | c | bc,bc | 27 km/h | 741.5,0 | 1 |
|
| b | c | bc,bc | 27 km/h | 737.2,0 | 1 |
|
||||||
| a | d | ad,ad | 27 km/h | 1275.7,0 | 1 |
|
| a | d | ad,ad | 27 km/h | 1273.9,0 | 1 |
|
||||||
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 |
|
| d | c | dc,dc | 36 km/h | 955.4,0 | 0 |
|
||||||
| g | b | ab,ab | 1 km/h | 10010.4,0 | 1 |
|
| g | b | ab,ab | 1 km/h | 9951.7,0 | 1 |
|
||||||
| a | g | ab,ab | 1 km/h | 10010.3,0 | 1 |
|
| a | g | ab,ab | 1 km/h | 9951.7,0 | 1 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Weighting based on speed file weights, ETA based on file durations
|
Scenario: Weighting based on speed file weights, ETA based on file durations
|
||||||
@ -106,14 +106,14 @@ Feature: Traffic - speeds
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | weights | a:datasources |
|
| from | to | route | speed | weights | a:datasources |
|
||||||
| a | b | ab,ab | 1 km/h | 20020.73,0 | 1 |
|
| a | b | ab,ab | 1 km/h | 19903.37,0 | 1 |
|
||||||
| a | c | ab,bc,bc | 2 km/h | 20020.73,741.51,0 | 1:1 |
|
| a | c | ab,bc,bc | 2 km/h | 19903.37,737.16,0 | 1:1 |
|
||||||
| b | c | bc,bc | 27 km/h | 741.51,0 | 1 |
|
| b | c | bc,bc | 27 km/h | 737.16,0 | 1 |
|
||||||
| a | d | ab,eb,de,de | 2 km/h | 20020.73,378.17,400.41,0 | 1:0:0 |
|
| a | d | ab,eb,de,de | 2 km/h | 19903.37,378.49,400.75,0 | 1:0:0 |
|
||||||
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 |
|
| d | c | dc,dc | 36 km/h | 955.45,0 | 0 |
|
||||||
| g | b | ab,ab | 1 km/h | 10010.37,0 | 1 |
|
| g | b | ab,ab | 1 km/h | 9951.69,0 | 1 |
|
||||||
| a | g | ab,ab | 1 km/h | 10010.36,0 | 1 |
|
| a | g | ab,ab | 1 km/h | 9951.68,0 | 1 |
|
||||||
| g | a | ab,ab | 1 km/h | 10010.36,0 | 1 |
|
| g | a | ab,ab | 1 km/h | 9951.68,0 | 1 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Speeds that isolate a single node (a)
|
Scenario: Speeds that isolate a single node (a)
|
||||||
@ -136,13 +136,13 @@ Feature: Traffic - speeds
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | weights | a:datasources | a:speed | a:nodes|
|
| from | to | route | speed | weights | a:datasources | a:speed | a:nodes|
|
||||||
| a | b | fb,fb | 36 km/h | 329.4,0 | 0 | 10 | 6:2 |
|
| a | b | fb,fb | 36 km/h | 328.9,0 | 0 | 10 | 6:2 |
|
||||||
| a | c | fb,bc,bc | 30 km/h | 329.4,741.5,0 | 0:1 | 10:7.5 | 6:2:3 |
|
| a | c | fb,bc,bc | 30 km/h | 328.9,737.2,0 | 0:1 | 10:7.5 | 6:2:3 |
|
||||||
| b | c | bc,bc | 27 km/h | 741.5,0 | 1 | 7.5 | 2:3 |
|
| b | c | bc,bc | 27 km/h | 737.2,0 | 1 | 7.5 | 2:3 |
|
||||||
| a | d | fb,df,df | 36 km/h | 140,487.5,0 | 0:0 | 10:10 | 2:6:4 |
|
| a | d | fb,df,df | 36 km/h | 139.8,486.8,0 | 0:0 | 10:10 | 2:6:4 |
|
||||||
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 | 10 | 4:3 |
|
| d | c | dc,dc | 36 km/h | 955.4,0 | 0 | 10 | 4:3 |
|
||||||
| g | b | fb,fb | 36 km/h | 164.7,0 | 0 | 10 | 6:2 |
|
| g | b | fb,fb | 36 km/h | 164.4,0 | 0 | 10 | 6:2 |
|
||||||
| a | g | fb,fb | 36 km/h | 164.7,0 | 0 | 10 | 6:2 |
|
| a | g | fb,fb | 36 km/h | 164.5,0 | 0 | 10 | 6:2 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Verify that negative values cause an error, they're not valid at all
|
Scenario: Verify that negative values cause an error, they're not valid at all
|
||||||
|
|||||||
@ -47,7 +47,7 @@ Feature: Traffic - turn penalties applied to turn onto which a phantom node snap
|
|||||||
| 1 | e | ab,be,be | 36 km/h | 30s +-1 |
|
| 1 | e | ab,be,be | 36 km/h | 30s +-1 |
|
||||||
| b | f | bc,cf,cf | 36 km/h | 40s +-1 |
|
| b | f | bc,cf,cf | 36 km/h | 40s +-1 |
|
||||||
| 2 | f | bc,cf,cf | 36 km/h | 30s +-1 |
|
| 2 | f | bc,cf,cf | 36 km/h | 30s +-1 |
|
||||||
| c | g | cd,dg,dg | 144 km/h | 10s +-1 |
|
| c | g | cd,dg,dg | 72 km/h | 20s +-1 |
|
||||||
| 3 | g | cd,dg,dg | 54 km/h | 20s +-1 |
|
| 3 | g | cd,dg,dg | 54 km/h | 20s +-1 |
|
||||||
|
|
||||||
Scenario: Weighting based on turn penalty file with weights
|
Scenario: Weighting based on turn penalty file with weights
|
||||||
@ -62,8 +62,8 @@ Feature: Traffic - turn penalties applied to turn onto which a phantom node snap
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | speed | time | weights |
|
| from | to | route | speed | time | weights |
|
||||||
| a | e | ab,be,be | 36 km/h | 40s +-1 | 16.7,20,0 |
|
| a | e | ab,be,be | 36 km/h | 40s +-1 | 16.7,20,0 |
|
||||||
| 1 | e | ab,be,be | 36 km/h | 30s +-1 | 6.7,20,0 |
|
| 1 | e | ab,be,be | 36 km/h | 30s +-1 | 6.8,20,0 |
|
||||||
| b | f | bc,cf,cf | 36 km/h | 40s +-1 | 20,20,0 |
|
| b | f | bc,cf,cf | 36 km/h | 40s +-1 | 20,20,0 |
|
||||||
| 2 | f | bc,cf,cf | 36 km/h | 30s +-1 | 10,20,0 |
|
| 2 | f | bc,cf,cf | 36 km/h | 30s +-1 | 10.1,20,0 |
|
||||||
| c | g | cd,dg,dg | 144 km/h | 10s +-1 | 120.8,20,0 |
|
| c | g | cd,dg,dg | 72 km/h | 20s +-1 | 120.8,20,0 |
|
||||||
| 3 | g | cd,dg,dg | 54 km/h | 20s +-1 | 110.8,20,0 |
|
| 3 | g | cd,dg,dg | 54 km/h | 20s +-1 | 110.9,20,0 |
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Feature: Basic trip planning
|
|||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
Given a grid size of 10 meters
|
Given a grid size of 10 meters
|
||||||
|
|
||||||
Scenario: Testbot - Trip: Roundtrip with one waypoint
|
Scenario: Testbot - Trip: Invalid options (like was in test suite for a long time)
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b
|
a b
|
||||||
@ -20,8 +20,46 @@ Feature: Basic trip planning
|
|||||||
| da |
|
| da |
|
||||||
|
|
||||||
When I plan a trip I should get
|
When I plan a trip I should get
|
||||||
| waypoints | trips |
|
| waypoints | trips | code |
|
||||||
| a | aa |
|
| a | | InvalidOptions |
|
||||||
|
|
||||||
|
Scenario: Testbot - Trip: Roundtrip between same waypoint
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
c d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| cb |
|
||||||
|
| da |
|
||||||
|
|
||||||
|
When I plan a trip I should get
|
||||||
|
| waypoints | trips | code |
|
||||||
|
| a,a | aa | Ok |
|
||||||
|
|
||||||
|
Scenario: Testbot - Trip: data version check
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b
|
||||||
|
c d
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| cb |
|
||||||
|
| da |
|
||||||
|
|
||||||
|
And the extract extra arguments "--data_version cucumber_data_version"
|
||||||
|
|
||||||
|
When I plan a trip I should get
|
||||||
|
| waypoints | trips | data_version | code |
|
||||||
|
| a,a | aa | cucumber_data_version | Ok |
|
||||||
|
|
||||||
Scenario: Testbot - Trip: Roundtrip with waypoints (less than 10)
|
Scenario: Testbot - Trip: Roundtrip with waypoints (less than 10)
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -38,9 +76,9 @@ Feature: Basic trip planning
|
|||||||
| da |
|
| da |
|
||||||
|
|
||||||
When I plan a trip I should get
|
When I plan a trip I should get
|
||||||
| waypoints | trips | durations |
|
| waypoints | trips | durations | code |
|
||||||
| a,b,c,d | abcda | 7.6 |
|
| a,b,c,d | abcda | 7.6 | Ok |
|
||||||
| d,b,c,a | dbcad | 7.6 |
|
| d,b,c,a | dbcad | 7.6 | Ok |
|
||||||
|
|
||||||
Scenario: Testbot - Trip: Roundtrip waypoints (more than 10)
|
Scenario: Testbot - Trip: Roundtrip waypoints (more than 10)
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -69,36 +107,37 @@ Feature: Basic trip planning
|
|||||||
| waypoints | trips |
|
| waypoints | trips |
|
||||||
| a,b,c,d,e,f,g,h,i,j,k,l | alkjihgfedcba |
|
| a,b,c,d,e,f,g,h,i,j,k,l | alkjihgfedcba |
|
||||||
|
|
||||||
Scenario: Testbot - Trip: Roundtrip FS waypoints (more than 10)
|
Scenario: Testbot - Trip: FS waypoints (less than 10)
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
a b c d
|
|
||||||
l e
|
|
||||||
k f
|
|
||||||
j i h g
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| ab |
|
|
||||||
| bc |
|
|
||||||
| de |
|
|
||||||
| ef |
|
|
||||||
| fg |
|
|
||||||
| gh |
|
|
||||||
| hi |
|
|
||||||
| ij |
|
|
||||||
| jk |
|
|
||||||
| kl |
|
|
||||||
| la |
|
|
||||||
|
|
||||||
When I plan a trip I should get
|
|
||||||
| waypoints | source | trips |
|
|
||||||
| a,b,c,d,e,f,g,h,i,j,k,l | first | alkjihgfedcba |
|
|
||||||
|
|
||||||
Scenario: Testbot - Trip: Roundtrip FE waypoints (more than 10)
|
|
||||||
Given the query options
|
Given the query options
|
||||||
| source | last |
|
| source | first |
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b c d
|
||||||
|
l e
|
||||||
|
|
||||||
|
j i g
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| de |
|
||||||
|
| eg |
|
||||||
|
| gi |
|
||||||
|
| ij |
|
||||||
|
| jl |
|
||||||
|
| la |
|
||||||
|
|
||||||
|
When I plan a trip I should get
|
||||||
|
| waypoints | trips | roundtrip | durations |
|
||||||
|
| a,b,c,d,e,g,i,j,l | abcdegijla | true | 22 |
|
||||||
|
| a,b,c,d,e,g,i,j,l | abcljiged | false | 13 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Testbot - Trip: FS waypoints (more than 10)
|
||||||
|
Given the query options
|
||||||
|
| source | first |
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b c d
|
a b c d
|
||||||
@ -122,8 +161,67 @@ Feature: Basic trip planning
|
|||||||
| la |
|
| la |
|
||||||
|
|
||||||
When I plan a trip I should get
|
When I plan a trip I should get
|
||||||
| waypoints | trips |
|
| waypoints | trips | roundtrip | durations |
|
||||||
| a,b,c,d,e,f,g,h,i,j,k,l | lkjihgfedcbal |
|
| a,b,c,d,e,f,g,h,i,j,k,l | alkjihgfedcba | true | 22 |
|
||||||
|
| a,b,c,d,e,f,g,h,i,j,k,l | acblkjihgfed | false | 13 |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Testbot - Trip: FE waypoints (less than 10)
|
||||||
|
Given the query options
|
||||||
|
| destination | last |
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b c d
|
||||||
|
l e
|
||||||
|
|
||||||
|
j i g
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| de |
|
||||||
|
| eg |
|
||||||
|
| gi |
|
||||||
|
| ij |
|
||||||
|
| jl |
|
||||||
|
| la |
|
||||||
|
|
||||||
|
When I plan a trip I should get
|
||||||
|
| waypoints | trips | roundtrip | durations |
|
||||||
|
| a,b,c,d,e,g,i,j,l | labcdegijl | true | 22 |
|
||||||
|
| a,b,c,d,e,g,i,j,l | degijabcl | false | 14 |
|
||||||
|
|
||||||
|
Scenario: Testbot - Trip: FE waypoints (more than 10)
|
||||||
|
Given the query options
|
||||||
|
| destination | last |
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
a b c d
|
||||||
|
l e
|
||||||
|
k f
|
||||||
|
j i h g
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| bc |
|
||||||
|
| de |
|
||||||
|
| ef |
|
||||||
|
| fg |
|
||||||
|
| gh |
|
||||||
|
| hi |
|
||||||
|
| ij |
|
||||||
|
| jk |
|
||||||
|
| kl |
|
||||||
|
| la |
|
||||||
|
|
||||||
|
When I plan a trip I should get
|
||||||
|
| waypoints | trips | roundtrip | durations |
|
||||||
|
| a,b,c,d,e,f,g,h,i,j,k,l | lkjihgfedcbal | true | 22 |
|
||||||
|
| a,b,c,d,e,f,g,h,i,j,k,l | cbakjihgfedl | false | 19 |
|
||||||
|
|
||||||
Scenario: Testbot - Trip: Unroutable roundtrip with waypoints (less than 10)
|
Scenario: Testbot - Trip: Unroutable roundtrip with waypoints (less than 10)
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -221,7 +319,7 @@ Feature: Basic trip planning
|
|||||||
|
|
||||||
When I plan a trip I should get
|
When I plan a trip I should get
|
||||||
| waypoints | source | destination |roundtrip | trips | durations | distance |
|
| waypoints | source | destination |roundtrip | trips | durations | distance |
|
||||||
| a,b,d,e,c | first | last | false | abedc | 8.200000000000001 | 81.6 |
|
| a,b,d,e,c | first | last | false | abedc | 8.200000000000001 | 81.4 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Trip: FSE with waypoints (more than 10)
|
Scenario: Testbot - Trip: FSE with waypoints (more than 10)
|
||||||
@ -274,7 +372,7 @@ Feature: Basic trip planning
|
|||||||
| a,b,d,e,c | first | last | true | abedca |
|
| a,b,d,e,c | first | last | true | abedca |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Trip: midway points in isoldated roads should return no trips
|
Scenario: Testbot - Trip: midway points in isolated roads should return no trips
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a 1 b
|
a 1 b
|
||||||
|
|||||||
@ -29,11 +29,11 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | a:weight |
|
| waypoints | route | a:weight |
|
||||||
| s,t | abc,cde | 1.1:2:2:1 |
|
| s,t | abc,cde | 1.1:2:2:0.9 |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | times | weight_name | weights |
|
| waypoints | route | times | weight_name | weights |
|
||||||
| s,t | abc,cde | 6.1s,0s | duration | 6.1,0 |
|
| s,t | abc,cde | 6s,0s | duration | 6,0 |
|
||||||
|
|
||||||
# FIXME include/engine/guidance/assemble_geometry.hpp:95
|
# FIXME include/engine/guidance/assemble_geometry.hpp:95
|
||||||
Scenario: Start and target on the same and adjacent edge
|
Scenario: Start and target on the same and adjacent edge
|
||||||
@ -53,10 +53,10 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed |
|
| waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed |
|
||||||
| s,t | abc,abc | 20m,0m | 2.1,0 | 2.1s,0s | 20.017685 | 2.1 | 2.1 | 9.5 |
|
| s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034627 | 2 | 2 | 10 |
|
||||||
| t,s | abc,abc | 20m,0m | 2.1,0 | 2.1s,0s | 20.017685 | 2.1 | 2.1 | 9.5 |
|
| t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034627 | 2 | 2 | 10 |
|
||||||
| s,e | abc,abc | 40m,0m | 4.1,0 | 4.1s,0s | 30.026527:10.008842 | 3.1:1 | 3.1:1 | 9.7:10 |
|
| s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.940636:10.017313 | 3:0.9 | 3:0.9 | 10:11.1 |
|
||||||
| e,s | abc,abc | 40m,0m | 4.1,0 | 4.1s,0s | 10.008842:30.026527 | 1:3.1 | 1:3.1 | 10:9.7 |
|
| e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.017313:29.940636 | 0.9:3 | 0.9:3 | 11.1:10 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property
|
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property
|
||||||
@ -174,12 +174,12 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,f | , | 100m | 99.9,0 | 30s,0s |
|
| a,f | , | 100m | 99.8,0 | 30s,0s |
|
||||||
| f,a | , | 100m | 199.8,0 | 30s,0s |
|
| f,a | , | 100m | 199.9,0 | 30s,0s |
|
||||||
| a,h | , | 140m | 139.9,0 | 42s,0s |
|
| a,h | , | 140m | 139.8,0 | 42s,0s |
|
||||||
| h,a | , | 140m | 279.8,0 | 42s,0s |
|
| h,a | , | 140m | 280.1,0 | 42s,0s |
|
||||||
| f,h | , | 40m | 40,0 | 12s,0s |
|
| f,h | , | 40.1m | 40,0 | 12s,0s |
|
||||||
| h,f | , | 40m | 80,0 | 12s,0s |
|
| h,f | , | 40.1m | 80.2,0 | 12s,0s |
|
||||||
|
|
||||||
Scenario: Step weights -- segment_function
|
Scenario: Step weights -- segment_function
|
||||||
Given the profile file
|
Given the profile file
|
||||||
@ -281,11 +281,11 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,c | , | 40m +-.1 | 5.119,0 | 289.9s,0s |
|
| a,c | , | 40m +-.1 | 2.22,0 | 200s,0s |
|
||||||
| a,e | ,, | 60m +-.1 | 5.119,1.11,0 | 289.9s,100s,0s |
|
| a,e | ,, | 60m +-.1 | 5.12,1.11,0 | 290s,100s,0s |
|
||||||
| e,a | ,, | 60m +-.1 | 2.21,2.22,0 | 10.1s,200s,0s |
|
| e,a | ,, | 60m +-.1 | 2.21,2.22,0 | 10s,200s,0s |
|
||||||
| e,d | ,, | 40m +-.1 | 4.009,1.11,0 | 189.9s,100s,0s |
|
| e,d | ,, | 40m +-.1 | 4.01,1.11,0 | 190s,100s,0s |
|
||||||
| d,e | ,, | 40m +-.1 | 2.21,1.11,0 | 10.1s,100s,0s |
|
| d,e | ,, | 40m +-.1 | 2.21,1.11,0 | 10s,100s,0s |
|
||||||
|
|
||||||
@traffic @speed
|
@traffic @speed
|
||||||
Scenario: Step weights -- segment_function with speed and turn updates
|
Scenario: Step weights -- segment_function with speed and turn updates
|
||||||
@ -341,9 +341,9 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,d | , | 59.9m | 20.5,0 | 24s,0s |
|
| a,d | , | 60m | 20.5,0 | 24s,0s |
|
||||||
| a,e | ,, | 60.1m | 27.2,10,0 | 38.5s,11s,0s |
|
| a,e | ,, | 60m | 27.2,10,0 | 38.5s,11s,0s |
|
||||||
| d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s |
|
| d,e | ,, | 40m | 10,10,0 | 11s,11s,0s |
|
||||||
|
|
||||||
@traffic @speed
|
@traffic @speed
|
||||||
Scenario: Step weights -- segment_function with speed and turn updates with fallback to durations
|
Scenario: Step weights -- segment_function with speed and turn updates with fallback to durations
|
||||||
@ -376,9 +376,9 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,d | abcd,abcd | 59.9m | 6.996,0 | 7s,0s |
|
| a,d | abcd,abcd | 60m | 7,0 | 7s,0s |
|
||||||
| a,e | abcd,ce,ce | 60.1m | 6.005,2.002,0 | 6s,2s,0s |
|
| a,e | abcd,ce,ce | 60m | 5.997,2.001,0 | 6s,2s,0s |
|
||||||
| d,e | abcd,ce,ce | 39.9m | 1.991,2.002,0 | 2s,2s,0s |
|
| d,e | abcd,ce,ce | 40m | 2.003,2.001,0 | 2s,2s,0s |
|
||||||
|
|
||||||
@traffic @speed
|
@traffic @speed
|
||||||
Scenario: Updating speeds without affecting weights.
|
Scenario: Updating speeds without affecting weights.
|
||||||
@ -411,4 +411,4 @@ Feature: Weight tests
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | distance | weights | times |
|
| waypoints | route | distance | weights | times |
|
||||||
| a,b | acdb,acdb | 78.3m | 11.744,0 | 56.4s,0s |
|
| a,b | acdb,acdb | 78.3m | 11.742,0 | 56.4s,0s |
|
||||||
|
|||||||
@ -187,5 +187,5 @@ Feature: Check zero speed updates
|
|||||||
|
|
||||||
When I plan a trip I should get
|
When I plan a trip I should get
|
||||||
| waypoints | trips | code |
|
| waypoints | trips | code |
|
||||||
| a,b,c,d | abcda | NoTrips |
|
| a,b,c,d | | NoTrips |
|
||||||
| d,b,c,a | dbcad | NoTrips |
|
| d,b,c,a | | NoTrips |
|
||||||
|
|||||||
@ -38,8 +38,7 @@ if (ENABLE_FUZZING)
|
|||||||
"table_parameters"
|
"table_parameters"
|
||||||
"tile_parameters"
|
"tile_parameters"
|
||||||
"trip_parameters"
|
"trip_parameters"
|
||||||
"url_parser"
|
"url_parser")
|
||||||
"request_parser")
|
|
||||||
|
|
||||||
foreach (target ${ServerTargets})
|
foreach (target ${ServerTargets})
|
||||||
add_fuzz_target(${target})
|
add_fuzz_target(${target})
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
#include "server/request_parser.hpp"
|
|
||||||
#include "server/http/request.hpp"
|
|
||||||
|
|
||||||
#include "util.hpp"
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
using osrm::server::RequestParser;
|
|
||||||
using osrm::server::http::request;
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size)
|
|
||||||
{
|
|
||||||
std::string in(reinterpret_cast<const char *>(data), size);
|
|
||||||
|
|
||||||
auto first = begin(in);
|
|
||||||
auto last = end(in);
|
|
||||||
|
|
||||||
RequestParser parser;
|
|
||||||
request req;
|
|
||||||
|
|
||||||
// &(*it) is needed to go from iterator to underlying item to pointer to underlying item
|
|
||||||
parser.parse(req, &(*first), &(*last));
|
|
||||||
|
|
||||||
escape(&req);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -18,12 +18,12 @@ inline auto contractFullGraph(ContractorGraph contractor_graph,
|
|||||||
std::vector<EdgeWeight> node_weights)
|
std::vector<EdgeWeight> node_weights)
|
||||||
{
|
{
|
||||||
auto num_nodes = contractor_graph.GetNumberOfNodes();
|
auto num_nodes = contractor_graph.GetNumberOfNodes();
|
||||||
contractGraph(contractor_graph, node_weights);
|
contractGraph(contractor_graph, std::move(node_weights));
|
||||||
|
|
||||||
auto edges = toEdges<QueryEdge>(std::move(contractor_graph));
|
auto edges = toEdges<QueryEdge>(std::move(contractor_graph));
|
||||||
std::vector<bool> edge_filter(edges.size(), true);
|
std::vector<bool> edge_filter(edges.size(), true);
|
||||||
|
|
||||||
return GraphAndFilter{QueryGraph{num_nodes, std::move(edges)}, {std::move(edge_filter)}};
|
return GraphAndFilter{QueryGraph{num_nodes, edges}, {std::move(edge_filter)}};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
||||||
@ -91,7 +91,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
|
|||||||
edge_container.Merge(toEdges<QueryEdge>(std::move(filtered_core_graph)));
|
edge_container.Merge(toEdges<QueryEdge>(std::move(filtered_core_graph)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return GraphAndFilter{QueryGraph{num_nodes, std::move(edge_container.edges)},
|
return GraphAndFilter{QueryGraph{num_nodes, edge_container.edges},
|
||||||
edge_container.MakeEdgeFilters()};
|
edge_container.MakeEdgeFilters()};
|
||||||
}
|
}
|
||||||
} // namespace contractor
|
} // namespace contractor
|
||||||
|
|||||||
@ -43,10 +43,8 @@ namespace contractor
|
|||||||
struct ContractorConfig final : storage::IOConfig
|
struct ContractorConfig final : storage::IOConfig
|
||||||
{
|
{
|
||||||
ContractorConfig()
|
ContractorConfig()
|
||||||
: IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"},
|
: IOConfig(
|
||||||
{},
|
{".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"}, {}, {".osrm.hsgr", ".osrm.enw"})
|
||||||
{".osrm.hsgr", ".osrm.enw"}),
|
|
||||||
requested_num_threads(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,16 +60,16 @@ struct ContractorConfig final : storage::IOConfig
|
|||||||
updater::UpdaterConfig updater_config;
|
updater::UpdaterConfig updater_config;
|
||||||
|
|
||||||
// DEPRECATED to be removed in v6.0
|
// DEPRECATED to be removed in v6.0
|
||||||
bool use_cached_priority;
|
bool use_cached_priority = false;
|
||||||
|
|
||||||
unsigned requested_num_threads;
|
unsigned requested_num_threads = 0;
|
||||||
|
|
||||||
// DEPRECATED to be removed in v6.0
|
// DEPRECATED to be removed in v6.0
|
||||||
// A percentage of vertices that will be contracted for the hierarchy.
|
// A percentage of vertices that will be contracted for the hierarchy.
|
||||||
// Offers a trade-off between preprocessing and query time.
|
// Offers a trade-off between preprocessing and query time.
|
||||||
// The remaining vertices form the core of the hierarchy
|
// The remaining vertices form the core of the hierarchy
|
||||||
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
|
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
|
||||||
double core_factor;
|
double core_factor = 1.0;
|
||||||
};
|
};
|
||||||
} // namespace contractor
|
} // namespace contractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
|||||||
@ -58,8 +58,8 @@ struct QueryEdge
|
|||||||
|
|
||||||
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
||||||
|
|
||||||
QueryEdge(NodeID source, NodeID target, EdgeData data)
|
QueryEdge(NodeID source, NodeID target, const EdgeData &data)
|
||||||
: source(source), target(target), data(std::move(data))
|
: source(source), target(target), data(data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>;
|
using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>;
|
||||||
}
|
} // namespace detail
|
||||||
|
|
||||||
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
|
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
|
||||||
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
|
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
|
||||||
|
|||||||
@ -9,9 +9,12 @@
|
|||||||
#include "engine/hint.hpp"
|
#include "engine/hint.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/range/adaptor/transformed.hpp>
|
||||||
#include <boost/range/algorithm/transform.hpp>
|
#include <boost/range/algorithm/transform.hpp>
|
||||||
|
|
||||||
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -22,6 +25,8 @@ namespace engine
|
|||||||
namespace api
|
namespace api
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static const constexpr char *INTERSECTION_DELIMITER = " / ";
|
||||||
|
|
||||||
class BaseAPI
|
class BaseAPI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -30,92 +35,129 @@ class BaseAPI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
util::json::Array MakeWaypoints(const std::vector<PhantomNodes> &segment_end_coordinates) const
|
util::json::Array
|
||||||
|
MakeWaypoints(const std::vector<PhantomNodeCandidates> &waypoint_candidates) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
||||||
BOOST_ASSERT(parameters.coordinates.size() == segment_end_coordinates.size() + 1);
|
BOOST_ASSERT(parameters.coordinates.size() == waypoint_candidates.size());
|
||||||
|
|
||||||
util::json::Array waypoints;
|
util::json::Array waypoints;
|
||||||
waypoints.values.resize(parameters.coordinates.size());
|
waypoints.values.resize(parameters.coordinates.size());
|
||||||
waypoints.values[0] = MakeWaypoint(segment_end_coordinates.front().source_phantom);
|
|
||||||
|
|
||||||
auto out_iter = std::next(waypoints.values.begin());
|
|
||||||
boost::range::transform(
|
boost::range::transform(
|
||||||
segment_end_coordinates, out_iter, [this](const PhantomNodes &phantom_pair) {
|
waypoint_candidates,
|
||||||
return MakeWaypoint(phantom_pair.target_phantom);
|
waypoints.values.begin(),
|
||||||
});
|
[this](const PhantomNodeCandidates &candidates) { return MakeWaypoint(candidates); });
|
||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
||||||
// protected:
|
// protected:
|
||||||
util::json::Object MakeWaypoint(const PhantomNode &phantom) const
|
util::json::Object MakeWaypoint(const PhantomNodeCandidates &candidates) const
|
||||||
{
|
|
||||||
if (parameters.generate_hints)
|
|
||||||
{
|
{
|
||||||
// TODO: check forward/reverse
|
// TODO: check forward/reverse
|
||||||
|
const auto toName = [this](const auto &phantom) {
|
||||||
|
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
||||||
|
.to_string();
|
||||||
|
};
|
||||||
|
const auto noEmpty = [](const auto &name) { return !name.empty(); };
|
||||||
|
|
||||||
|
// At an intersection we may have multiple phantom node candidates.
|
||||||
|
// Combine them to represent the waypoint name.
|
||||||
|
std::string waypoint_name = boost::algorithm::join(
|
||||||
|
candidates | boost::adaptors::transformed(toName) | boost::adaptors::filtered(noEmpty),
|
||||||
|
INTERSECTION_DELIMITER);
|
||||||
|
|
||||||
|
const auto &snapped_location = candidatesSnappedLocation(candidates);
|
||||||
|
const auto &input_location = candidatesInputLocation(candidates);
|
||||||
|
if (parameters.generate_hints)
|
||||||
|
{
|
||||||
|
std::vector<SegmentHint> seg_hints(candidates.size());
|
||||||
|
std::transform(candidates.begin(),
|
||||||
|
candidates.end(),
|
||||||
|
seg_hints.begin(),
|
||||||
|
[this](const auto &phantom) {
|
||||||
|
return SegmentHint{phantom, facade.GetCheckSum()};
|
||||||
|
});
|
||||||
|
|
||||||
return json::makeWaypoint(
|
return json::makeWaypoint(
|
||||||
phantom.location,
|
snapped_location,
|
||||||
util::coordinate_calculation::fccApproximateDistance(phantom.location,
|
util::coordinate_calculation::greatCircleDistance(snapped_location, input_location),
|
||||||
phantom.input_location),
|
waypoint_name,
|
||||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string(),
|
{std::move(seg_hints)});
|
||||||
Hint{phantom, facade.GetCheckSum()});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: check forward/reverse
|
|
||||||
return json::makeWaypoint(
|
return json::makeWaypoint(
|
||||||
phantom.location,
|
snapped_location,
|
||||||
util::coordinate_calculation::fccApproximateDistance(phantom.location,
|
util::coordinate_calculation::greatCircleDistance(snapped_location, input_location),
|
||||||
phantom.input_location),
|
waypoint_name);
|
||||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
|
||||||
.to_string());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
MakeWaypoints(flatbuffers::FlatBufferBuilder *builder,
|
MakeWaypoints(flatbuffers::FlatBufferBuilder *builder,
|
||||||
const std::vector<PhantomNodes> &segment_end_coordinates) const
|
const std::vector<PhantomNodeCandidates> &waypoint_candidates) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
BOOST_ASSERT(parameters.coordinates.size() > 0);
|
||||||
BOOST_ASSERT(parameters.coordinates.size() == segment_end_coordinates.size() + 1);
|
BOOST_ASSERT(parameters.coordinates.size() == waypoint_candidates.size());
|
||||||
|
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.resize(parameters.coordinates.size());
|
waypoints.resize(parameters.coordinates.size());
|
||||||
waypoints[0] =
|
|
||||||
MakeWaypoint(builder, segment_end_coordinates.front().source_phantom)->Finish();
|
|
||||||
|
|
||||||
std::transform(segment_end_coordinates.begin(),
|
std::transform(waypoint_candidates.begin(),
|
||||||
segment_end_coordinates.end(),
|
waypoint_candidates.end(),
|
||||||
std::next(waypoints.begin()),
|
waypoints.begin(),
|
||||||
[this, builder](const PhantomNodes &phantom_pair) {
|
[this, builder](const PhantomNodeCandidates &candidates) {
|
||||||
return MakeWaypoint(builder, phantom_pair.target_phantom)->Finish();
|
return MakeWaypoint(builder, candidates)->Finish();
|
||||||
});
|
});
|
||||||
return builder->CreateVector(waypoints);
|
return builder->CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
// FIXME: gcc 4.9 does not like MakeWaypoints to be protected
|
||||||
// protected:
|
// protected:
|
||||||
std::unique_ptr<fbresult::WaypointBuilder> MakeWaypoint(flatbuffers::FlatBufferBuilder *builder,
|
std::unique_ptr<fbresult::WaypointBuilder>
|
||||||
const PhantomNode &phantom) const
|
MakeWaypoint(flatbuffers::FlatBufferBuilder *builder,
|
||||||
|
const PhantomNodeCandidates &candidates) const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const auto &snapped_location = candidatesSnappedLocation(candidates);
|
||||||
|
const auto &input_location = candidatesInputLocation(candidates);
|
||||||
auto location =
|
auto location =
|
||||||
fbresult::Position(static_cast<double>(util::toFloating(phantom.location.lon)),
|
fbresult::Position(static_cast<double>(util::toFloating(snapped_location.lon)),
|
||||||
static_cast<double>(util::toFloating(phantom.location.lat)));
|
static_cast<double>(util::toFloating(snapped_location.lat)));
|
||||||
auto name_string = builder->CreateString(
|
|
||||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string());
|
const auto toName = [this](const auto &phantom) {
|
||||||
|
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
||||||
|
.to_string();
|
||||||
|
};
|
||||||
|
const auto noEmpty = [](const auto &name) { return !name.empty(); };
|
||||||
|
|
||||||
|
// At an intersection we may have multiple phantom node candidates.
|
||||||
|
// Combine them to represent the waypoint name.
|
||||||
|
std::string waypoint_name = boost::algorithm::join(
|
||||||
|
candidates | boost::adaptors::transformed(toName) | boost::adaptors::filtered(noEmpty),
|
||||||
|
INTERSECTION_DELIMITER);
|
||||||
|
auto name_string = builder->CreateString(waypoint_name);
|
||||||
|
|
||||||
flatbuffers::Offset<flatbuffers::String> hint_string;
|
flatbuffers::Offset<flatbuffers::String> hint_string;
|
||||||
if (parameters.generate_hints)
|
if (parameters.generate_hints)
|
||||||
{
|
{
|
||||||
hint_string = builder->CreateString(Hint{phantom, facade.GetCheckSum()}.ToBase64());
|
std::vector<SegmentHint> seg_hints(candidates.size());
|
||||||
|
std::transform(candidates.begin(),
|
||||||
|
candidates.end(),
|
||||||
|
seg_hints.begin(),
|
||||||
|
[this](const auto &phantom) {
|
||||||
|
return SegmentHint{phantom, facade.GetCheckSum()};
|
||||||
|
});
|
||||||
|
Hint hint{std::move(seg_hints)};
|
||||||
|
hint_string = builder->CreateString(hint.ToBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waypoint = std::make_unique<fbresult::WaypointBuilder>(*builder);
|
auto waypoint = std::make_unique<fbresult::WaypointBuilder>(*builder);
|
||||||
waypoint->add_location(&location);
|
waypoint->add_location(&location);
|
||||||
waypoint->add_distance(util::coordinate_calculation::fccApproximateDistance(
|
waypoint->add_distance(
|
||||||
phantom.location, phantom.input_location));
|
util::coordinate_calculation::greatCircleDistance(snapped_location, input_location));
|
||||||
waypoint->add_name(name_string);
|
waypoint->add_name(name_string);
|
||||||
if (parameters.generate_hints)
|
if (parameters.generate_hints)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,14 +51,14 @@ namespace api
|
|||||||
* Holds member attributes:
|
* Holds member attributes:
|
||||||
* - coordinates: for specifying location(s) to services
|
* - coordinates: for specifying location(s) to services
|
||||||
* - hints: hint for the service to derive the position(s) in the road network more efficiently,
|
* - hints: hint for the service to derive the position(s) in the road network more efficiently,
|
||||||
* optional per coordinate
|
* optional per coordinate. Multiple hints can be provided for a coordinate.
|
||||||
* - radiuses: limits the search for segments in the road network to given radius(es) in meter,
|
* - radiuses: limits the search for segments in the road network to given radius(es) in meter,
|
||||||
* optional per coordinate
|
* optional per coordinate
|
||||||
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
|
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
|
||||||
* towards true north in clockwise direction, optional per coordinate
|
* towards true north in clockwise direction, optional per coordinate
|
||||||
* - approaches: force the phantom node to start towards the node with the road country side.
|
* - approaches: force the phantom node to start towards the node with the road country side.
|
||||||
*
|
*
|
||||||
* \see OSRM, Coordinate, Hint, Bearing, RouteParame, RouteParameters, TableParameters,
|
* \see OSRM, Coordinate, Hint, Bearing, RouteParameters, TableParameters,
|
||||||
* NearestParameters, TripParameters, MatchParameters and TileParameters
|
* NearestParameters, TripParameters, MatchParameters and TileParameters
|
||||||
*/
|
*/
|
||||||
struct BaseParameters
|
struct BaseParameters
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class MatchAPI final : public RouteAPI
|
|||||||
routes.values.reserve(number_of_routes);
|
routes.values.reserve(number_of_routes);
|
||||||
for (auto index : util::irange<std::size_t>(0UL, sub_matchings.size()))
|
for (auto index : util::irange<std::size_t>(0UL, sub_matchings.size()))
|
||||||
{
|
{
|
||||||
auto route = MakeRoute(sub_routes[index].segment_end_coordinates,
|
auto route = MakeRoute(sub_routes[index].leg_endpoints,
|
||||||
sub_routes[index].unpacked_path_segments,
|
sub_routes[index].unpacked_path_segments,
|
||||||
sub_routes[index].source_traversed_in_reverse,
|
sub_routes[index].source_traversed_in_reverse,
|
||||||
sub_routes[index].target_traversed_in_reverse);
|
sub_routes[index].target_traversed_in_reverse);
|
||||||
@ -89,6 +89,11 @@ class MatchAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
response.values["matchings"] = std::move(routes);
|
response.values["matchings"] = std::move(routes);
|
||||||
response.values["code"] = "Ok";
|
response.values["code"] = "Ok";
|
||||||
|
auto data_timestamp = facade.GetTimestamp();
|
||||||
|
if (!data_timestamp.empty())
|
||||||
|
{
|
||||||
|
response.values["data_version"] = data_timestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -141,7 +146,7 @@ class MatchAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
const auto &phantom =
|
const auto &phantom =
|
||||||
sub_matchings[matching_index.sub_matching_index].nodes[matching_index.point_index];
|
sub_matchings[matching_index.sub_matching_index].nodes[matching_index.point_index];
|
||||||
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, phantom);
|
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, {phantom});
|
||||||
waypoint->add_matchings_index(matching_index.sub_matching_index);
|
waypoint->add_matchings_index(matching_index.sub_matching_index);
|
||||||
waypoint->add_alternatives_count(sub_matchings[matching_index.sub_matching_index]
|
waypoint->add_alternatives_count(sub_matchings[matching_index.sub_matching_index]
|
||||||
.alternatives_count[matching_index.point_index]);
|
.alternatives_count[matching_index.point_index]);
|
||||||
@ -195,7 +200,7 @@ class MatchAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
const auto &phantom =
|
const auto &phantom =
|
||||||
sub_matchings[matching_index.sub_matching_index].nodes[matching_index.point_index];
|
sub_matchings[matching_index.sub_matching_index].nodes[matching_index.point_index];
|
||||||
auto waypoint = BaseAPI::MakeWaypoint(phantom);
|
auto waypoint = BaseAPI::MakeWaypoint({phantom});
|
||||||
waypoint.values["matchings_index"] = matching_index.sub_matching_index;
|
waypoint.values["matchings_index"] = matching_index.sub_matching_index;
|
||||||
waypoint.values["waypoint_index"] = matching_index.point_index;
|
waypoint.values["waypoint_index"] = matching_index.point_index;
|
||||||
waypoint.values["alternatives_count"] =
|
waypoint.values["alternatives_count"] =
|
||||||
|
|||||||
@ -122,7 +122,7 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5})
|
|||||||
// Walk over adjacent (coord, ts)-pairs, with rhs being the candidate to discard or keep
|
// Walk over adjacent (coord, ts)-pairs, with rhs being the candidate to discard or keep
|
||||||
for (std::size_t current = 0, next = 1; next < params.coordinates.size() - 1; ++current, ++next)
|
for (std::size_t current = 0, next = 1; next < params.coordinates.size() - 1; ++current, ++next)
|
||||||
{
|
{
|
||||||
auto distance_delta = util::coordinate_calculation::haversineDistance(
|
auto distance_delta = util::coordinate_calculation::greatCircleDistance(
|
||||||
params.coordinates[current], params.coordinates[next]);
|
params.coordinates[current], params.coordinates[next]);
|
||||||
running.distance_in_meters += distance_delta;
|
running.distance_in_meters += distance_delta;
|
||||||
const auto over_distance = running.distance_in_meters >= cfg.distance_in_meters;
|
const auto over_distance = running.distance_in_meters >= cfg.distance_in_meters;
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class NearestAPI final : public BaseAPI
|
|||||||
auto node_values = MakeNodes(phantom_node);
|
auto node_values = MakeNodes(phantom_node);
|
||||||
fbresult::Uint64Pair nodes{node_values.first, node_values.second};
|
fbresult::Uint64Pair nodes{node_values.first, node_values.second};
|
||||||
|
|
||||||
auto waypoint = MakeWaypoint(&fb_result, phantom_node);
|
auto waypoint = MakeWaypoint(&fb_result, {phantom_node});
|
||||||
waypoint->add_nodes(&nodes);
|
waypoint->add_nodes(&nodes);
|
||||||
return waypoint->Finish();
|
return waypoint->Finish();
|
||||||
});
|
});
|
||||||
@ -100,7 +100,7 @@ class NearestAPI final : public BaseAPI
|
|||||||
waypoints.values.begin(),
|
waypoints.values.begin(),
|
||||||
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
[this](const PhantomNodeWithDistance &phantom_with_distance) {
|
||||||
auto &phantom_node = phantom_with_distance.phantom_node;
|
auto &phantom_node = phantom_with_distance.phantom_node;
|
||||||
auto waypoint = MakeWaypoint(phantom_node);
|
auto waypoint = MakeWaypoint({phantom_node});
|
||||||
|
|
||||||
util::json::Array nodes;
|
util::json::Array nodes;
|
||||||
|
|
||||||
@ -116,6 +116,11 @@ class NearestAPI final : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.values["code"] = "Ok";
|
response.values["code"] = "Ok";
|
||||||
|
auto data_timestamp = facade.GetTimestamp();
|
||||||
|
if (!data_timestamp.empty())
|
||||||
|
{
|
||||||
|
response.values["data_version"] = data_timestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const NearestParameters ¶meters;
|
const NearestParameters ¶meters;
|
||||||
|
|||||||
@ -47,8 +47,8 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
void
|
void
|
||||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||||
const std::vector<PhantomNodes>
|
const std::vector<PhantomNodeCandidates>
|
||||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
&waypoint_candidates, // all used coordinates, ignoring waypoints= parameter
|
||||||
osrm::engine::api::ResultT &response) const
|
osrm::engine::api::ResultT &response) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!raw_routes.routes.empty());
|
BOOST_ASSERT(!raw_routes.routes.empty());
|
||||||
@ -56,19 +56,19 @@ class RouteAPI : public BaseAPI
|
|||||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
{
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(raw_routes, all_start_end_points, fb_result);
|
MakeResponse(raw_routes, waypoint_candidates, fb_result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(raw_routes, all_start_end_points, json_result);
|
MakeResponse(raw_routes, waypoint_candidates, json_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||||
const std::vector<PhantomNodes>
|
const std::vector<PhantomNodeCandidates>
|
||||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
&waypoint_candidates, // all used coordinates, ignoring waypoints= parameter
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ class RouteAPI : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto response =
|
auto response =
|
||||||
MakeFBResponse(raw_routes, fb_result, [this, &all_start_end_points, &fb_result]() {
|
MakeFBResponse(raw_routes, fb_result, [this, &waypoint_candidates, &fb_result]() {
|
||||||
return BaseAPI::MakeWaypoints(&fb_result, all_start_end_points);
|
return BaseAPI::MakeWaypoints(&fb_result, waypoint_candidates);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data_timestamp.empty())
|
if (!data_timestamp.empty())
|
||||||
@ -93,8 +93,8 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
void
|
void
|
||||||
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
MakeResponse(const InternalManyRoutesResult &raw_routes,
|
||||||
const std::vector<PhantomNodes>
|
const std::vector<PhantomNodeCandidates>
|
||||||
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
|
&waypoint_candidates, // all used coordinates, ignoring waypoints= parameter
|
||||||
util::json::Object &response) const
|
util::json::Object &response) const
|
||||||
{
|
{
|
||||||
util::json::Array jsRoutes;
|
util::json::Array jsRoutes;
|
||||||
@ -104,7 +104,7 @@ class RouteAPI : public BaseAPI
|
|||||||
if (!route.is_valid())
|
if (!route.is_valid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
jsRoutes.values.push_back(MakeRoute(route.segment_end_coordinates,
|
jsRoutes.values.push_back(MakeRoute(route.leg_endpoints,
|
||||||
route.unpacked_path_segments,
|
route.unpacked_path_segments,
|
||||||
route.source_traversed_in_reverse,
|
route.source_traversed_in_reverse,
|
||||||
route.target_traversed_in_reverse));
|
route.target_traversed_in_reverse));
|
||||||
@ -112,7 +112,7 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
response.values["waypoints"] = BaseAPI::MakeWaypoints(all_start_end_points);
|
response.values["waypoints"] = BaseAPI::MakeWaypoints(waypoint_candidates);
|
||||||
}
|
}
|
||||||
response.values["routes"] = std::move(jsRoutes);
|
response.values["routes"] = std::move(jsRoutes);
|
||||||
response.values["code"] = "Ok";
|
response.values["code"] = "Ok";
|
||||||
@ -138,7 +138,7 @@ class RouteAPI : public BaseAPI
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
routes.push_back(MakeRoute(fb_result,
|
routes.push_back(MakeRoute(fb_result,
|
||||||
raw_route.segment_end_coordinates,
|
raw_route.leg_endpoints,
|
||||||
raw_route.unpacked_path_segments,
|
raw_route.unpacked_path_segments,
|
||||||
raw_route.source_traversed_in_reverse,
|
raw_route.source_traversed_in_reverse,
|
||||||
raw_route.target_traversed_in_reverse));
|
raw_route.target_traversed_in_reverse));
|
||||||
@ -328,12 +328,12 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
flatbuffers::Offset<fbresult::RouteObject>
|
flatbuffers::Offset<fbresult::RouteObject>
|
||||||
MakeRoute(flatbuffers::FlatBufferBuilder &fb_result,
|
MakeRoute(flatbuffers::FlatBufferBuilder &fb_result,
|
||||||
const std::vector<PhantomNodes> &segment_end_coordinates,
|
const std::vector<PhantomEndpoints> &leg_endpoints,
|
||||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||||
const std::vector<bool> &source_traversed_in_reverse,
|
const std::vector<bool> &source_traversed_in_reverse,
|
||||||
const std::vector<bool> &target_traversed_in_reverse) const
|
const std::vector<bool> &target_traversed_in_reverse) const
|
||||||
{
|
{
|
||||||
auto legs_info = MakeLegs(segment_end_coordinates,
|
auto legs_info = MakeLegs(leg_endpoints,
|
||||||
unpacked_path_segments,
|
unpacked_path_segments,
|
||||||
source_traversed_in_reverse,
|
source_traversed_in_reverse,
|
||||||
target_traversed_in_reverse);
|
target_traversed_in_reverse);
|
||||||
@ -367,7 +367,7 @@ class RouteAPI : public BaseAPI
|
|||||||
// To maintain support for uses of the old default constructors, we check
|
// To maintain support for uses of the old default constructors, we check
|
||||||
// if annotations property was set manually after default construction
|
// if annotations property was set manually after default construction
|
||||||
auto requested_annotations = parameters.annotations_type;
|
auto requested_annotations = parameters.annotations_type;
|
||||||
if ((parameters.annotations == true) &&
|
if (parameters.annotations &&
|
||||||
(parameters.annotations_type == RouteParameters::AnnotationsType::None))
|
(parameters.annotations_type == RouteParameters::AnnotationsType::None))
|
||||||
{
|
{
|
||||||
requested_annotations = RouteParameters::AnnotationsType::All;
|
requested_annotations = RouteParameters::AnnotationsType::All;
|
||||||
@ -497,10 +497,10 @@ class RouteAPI : public BaseAPI
|
|||||||
std::vector<uint32_t> nodes;
|
std::vector<uint32_t> nodes;
|
||||||
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
||||||
{
|
{
|
||||||
nodes.reserve(leg_geometry.osm_node_ids.size());
|
nodes.reserve(leg_geometry.node_ids.size());
|
||||||
for (const auto node_id : leg_geometry.osm_node_ids)
|
for (const auto node_id : leg_geometry.node_ids)
|
||||||
{
|
{
|
||||||
nodes.emplace_back(static_cast<uint64_t>(node_id));
|
nodes.emplace_back(static_cast<uint64_t>(facade.GetOSMNodeIDOfNode(node_id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto nodes_vector = fb_result.CreateVector(nodes);
|
auto nodes_vector = fb_result.CreateVector(nodes);
|
||||||
@ -515,7 +515,7 @@ class RouteAPI : public BaseAPI
|
|||||||
{
|
{
|
||||||
const auto name = facade.GetDatasourceName(i);
|
const auto name = facade.GetDatasourceName(i);
|
||||||
// Length of 0 indicates the first empty name, so we can stop here
|
// Length of 0 indicates the first empty name, so we can stop here
|
||||||
if (name.size() == 0)
|
if (name.empty())
|
||||||
break;
|
break;
|
||||||
names.emplace_back(
|
names.emplace_back(
|
||||||
fb_result.CreateString(std::string(facade.GetDatasourceName(i))));
|
fb_result.CreateString(std::string(facade.GetDatasourceName(i))));
|
||||||
@ -688,7 +688,7 @@ class RouteAPI : public BaseAPI
|
|||||||
intersection.classes.begin(),
|
intersection.classes.begin(),
|
||||||
intersection.classes.end(),
|
intersection.classes.end(),
|
||||||
classes.begin(),
|
classes.begin(),
|
||||||
[&fb_result](const std::string cls) { return fb_result.CreateString(cls); });
|
[&fb_result](const std::string &cls) { return fb_result.CreateString(cls); });
|
||||||
auto classes_vector = fb_result.CreateVector(classes);
|
auto classes_vector = fb_result.CreateVector(classes);
|
||||||
auto entry_vector = fb_result.CreateVector(intersection.entry);
|
auto entry_vector = fb_result.CreateVector(intersection.entry);
|
||||||
|
|
||||||
@ -705,12 +705,12 @@ class RouteAPI : public BaseAPI
|
|||||||
return fb_result.CreateVector(intersections);
|
return fb_result.CreateVector(intersections);
|
||||||
}
|
}
|
||||||
|
|
||||||
util::json::Object MakeRoute(const std::vector<PhantomNodes> &segment_end_coordinates,
|
util::json::Object MakeRoute(const std::vector<PhantomEndpoints> &leg_endpoints,
|
||||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||||
const std::vector<bool> &source_traversed_in_reverse,
|
const std::vector<bool> &source_traversed_in_reverse,
|
||||||
const std::vector<bool> &target_traversed_in_reverse) const
|
const std::vector<bool> &target_traversed_in_reverse) const
|
||||||
{
|
{
|
||||||
auto legs_info = MakeLegs(segment_end_coordinates,
|
auto legs_info = MakeLegs(leg_endpoints,
|
||||||
unpacked_path_segments,
|
unpacked_path_segments,
|
||||||
source_traversed_in_reverse,
|
source_traversed_in_reverse,
|
||||||
target_traversed_in_reverse);
|
target_traversed_in_reverse);
|
||||||
@ -763,7 +763,7 @@ class RouteAPI : public BaseAPI
|
|||||||
// To maintain support for uses of the old default constructors, we check
|
// To maintain support for uses of the old default constructors, we check
|
||||||
// if annotations property was set manually after default construction
|
// if annotations property was set manually after default construction
|
||||||
auto requested_annotations = parameters.annotations_type;
|
auto requested_annotations = parameters.annotations_type;
|
||||||
if ((parameters.annotations == true) &&
|
if (parameters.annotations &&
|
||||||
(parameters.annotations_type == RouteParameters::AnnotationsType::None))
|
(parameters.annotations_type == RouteParameters::AnnotationsType::None))
|
||||||
{
|
{
|
||||||
requested_annotations = RouteParameters::AnnotationsType::All;
|
requested_annotations = RouteParameters::AnnotationsType::All;
|
||||||
@ -825,10 +825,11 @@ class RouteAPI : public BaseAPI
|
|||||||
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
if (requested_annotations & RouteParameters::AnnotationsType::Nodes)
|
||||||
{
|
{
|
||||||
util::json::Array nodes;
|
util::json::Array nodes;
|
||||||
nodes.values.reserve(leg_geometry.osm_node_ids.size());
|
nodes.values.reserve(leg_geometry.node_ids.size());
|
||||||
for (const auto node_id : leg_geometry.osm_node_ids)
|
for (const auto node_id : leg_geometry.node_ids)
|
||||||
{
|
{
|
||||||
nodes.values.push_back(static_cast<std::uint64_t>(node_id));
|
nodes.values.push_back(
|
||||||
|
static_cast<std::uint64_t>(facade.GetOSMNodeIDOfNode(node_id)));
|
||||||
}
|
}
|
||||||
annotation.values["nodes"] = std::move(nodes);
|
annotation.values["nodes"] = std::move(nodes);
|
||||||
}
|
}
|
||||||
@ -842,7 +843,7 @@ class RouteAPI : public BaseAPI
|
|||||||
{
|
{
|
||||||
const auto name = facade.GetDatasourceName(i);
|
const auto name = facade.GetDatasourceName(i);
|
||||||
// Length of 0 indicates the first empty name, so we can stop here
|
// Length of 0 indicates the first empty name, so we can stop here
|
||||||
if (name.size() == 0)
|
if (name.empty())
|
||||||
break;
|
break;
|
||||||
datasource_names.values.push_back(std::string(facade.GetDatasourceName(i)));
|
datasource_names.values.push_back(std::string(facade.GetDatasourceName(i)));
|
||||||
}
|
}
|
||||||
@ -867,7 +868,7 @@ class RouteAPI : public BaseAPI
|
|||||||
const RouteParameters ¶meters;
|
const RouteParameters ¶meters;
|
||||||
|
|
||||||
std::pair<std::vector<guidance::RouteLeg>, std::vector<guidance::LegGeometry>>
|
std::pair<std::vector<guidance::RouteLeg>, std::vector<guidance::LegGeometry>>
|
||||||
MakeLegs(const std::vector<PhantomNodes> &segment_end_coordinates,
|
MakeLegs(const std::vector<PhantomEndpoints> &leg_endpoints,
|
||||||
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
const std::vector<std::vector<PathData>> &unpacked_path_segments,
|
||||||
const std::vector<bool> &source_traversed_in_reverse,
|
const std::vector<bool> &source_traversed_in_reverse,
|
||||||
const std::vector<bool> &target_traversed_in_reverse) const
|
const std::vector<bool> &target_traversed_in_reverse) const
|
||||||
@ -876,35 +877,47 @@ class RouteAPI : public BaseAPI
|
|||||||
std::make_pair(std::vector<guidance::RouteLeg>(), std::vector<guidance::LegGeometry>());
|
std::make_pair(std::vector<guidance::RouteLeg>(), std::vector<guidance::LegGeometry>());
|
||||||
auto &legs = result.first;
|
auto &legs = result.first;
|
||||||
auto &leg_geometries = result.second;
|
auto &leg_geometries = result.second;
|
||||||
auto number_of_legs = segment_end_coordinates.size();
|
auto number_of_legs = leg_endpoints.size();
|
||||||
legs.reserve(number_of_legs);
|
legs.reserve(number_of_legs);
|
||||||
leg_geometries.reserve(number_of_legs);
|
leg_geometries.reserve(number_of_legs);
|
||||||
|
|
||||||
for (auto idx : util::irange<std::size_t>(0UL, number_of_legs))
|
for (auto idx : util::irange<std::size_t>(0UL, number_of_legs))
|
||||||
{
|
{
|
||||||
const auto &phantoms = segment_end_coordinates[idx];
|
const auto &phantoms = leg_endpoints[idx];
|
||||||
const auto &path_data = unpacked_path_segments[idx];
|
const auto &path_data = unpacked_path_segments[idx];
|
||||||
|
|
||||||
const bool reversed_source = source_traversed_in_reverse[idx];
|
const bool reversed_source = source_traversed_in_reverse[idx];
|
||||||
const bool reversed_target = target_traversed_in_reverse[idx];
|
const bool reversed_target = target_traversed_in_reverse[idx];
|
||||||
|
|
||||||
auto leg_geometry = guidance::assembleGeometry(BaseAPI::facade,
|
auto leg = guidance::assembleLeg(facade,
|
||||||
|
path_data,
|
||||||
|
phantoms.source_phantom,
|
||||||
|
phantoms.target_phantom,
|
||||||
|
reversed_target);
|
||||||
|
|
||||||
|
guidance::LegGeometry leg_geometry;
|
||||||
|
|
||||||
|
// Generate additional geometry data if request includes turn-by-turn steps,
|
||||||
|
// overview geometry or route geometry annotations.
|
||||||
|
// Note that overview geometry and route geometry annotations can return different
|
||||||
|
// results depending on whether turn-by-turn steps are also requested.
|
||||||
|
if (parameters.steps || parameters.annotations ||
|
||||||
|
parameters.overview != RouteParameters::OverviewType::False)
|
||||||
|
{
|
||||||
|
|
||||||
|
leg_geometry = guidance::assembleGeometry(BaseAPI::facade,
|
||||||
path_data,
|
path_data,
|
||||||
phantoms.source_phantom,
|
phantoms.source_phantom,
|
||||||
phantoms.target_phantom,
|
phantoms.target_phantom,
|
||||||
reversed_source,
|
reversed_source,
|
||||||
reversed_target);
|
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;
|
util::Log(logDEBUG) << "Assembling steps " << std::endl;
|
||||||
if (parameters.steps)
|
if (parameters.steps)
|
||||||
{
|
{
|
||||||
|
leg.summary = guidance::assembleSummary(
|
||||||
|
facade, path_data, phantoms.target_phantom, reversed_target);
|
||||||
|
|
||||||
auto steps = guidance::assembleSteps(BaseAPI::facade,
|
auto steps = guidance::assembleSteps(BaseAPI::facade,
|
||||||
path_data,
|
path_data,
|
||||||
leg_geometry,
|
leg_geometry,
|
||||||
@ -924,10 +937,11 @@ class RouteAPI : public BaseAPI
|
|||||||
*
|
*
|
||||||
* Using post-processing on basis of route-steps for a single leg at a time
|
* Using post-processing on basis of route-steps for a single leg at a time
|
||||||
* comes at the cost that we cannot count the correct exit for roundabouts.
|
* 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.
|
* We can only emit the exit nr/intersections up to/starting at a part of the
|
||||||
* If a roundabout is not terminated in a leg, we will end up with a
|
*leg. If a roundabout is not terminated in a leg, we will end up with a
|
||||||
*enter-roundabout
|
*enter-roundabout
|
||||||
* and exit-roundabout-nr where the exit nr is out of sync with the previous enter.
|
* and exit-roundabout-nr where the exit nr is out of sync with the previous
|
||||||
|
*enter.
|
||||||
*
|
*
|
||||||
* | S |
|
* | S |
|
||||||
* * *
|
* * *
|
||||||
@ -938,14 +952,11 @@ class RouteAPI : public BaseAPI
|
|||||||
* | |
|
* | |
|
||||||
* | |
|
* | |
|
||||||
*
|
*
|
||||||
* Coming from S via V to T, we end up with the legs S->V and V->T. V-T will say to
|
* Coming from S via V to T, we end up with the legs S->V and V->T. V-T will say
|
||||||
*take
|
*to take the second exit, even though counting from S it would be the third.
|
||||||
* 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
|
||||||
* For S, we only emit `roundabout` without an exit number, showing that we enter a
|
*enter a roundabout to find a via point. The same exit will be emitted, though,
|
||||||
*roundabout
|
*if we should start routing at S, making the overall response consistent.
|
||||||
* 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
|
* ⚠ CAUTION: order of post-processing steps is important
|
||||||
* - handleRoundabouts must be called before collapseTurnInstructions that
|
* - handleRoundabouts must be called before collapseTurnInstructions that
|
||||||
@ -964,6 +975,7 @@ class RouteAPI : public BaseAPI
|
|||||||
phantoms.target_phantom);
|
phantoms.target_phantom);
|
||||||
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
|
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
leg_geometries.push_back(std::move(leg_geometry));
|
leg_geometries.push_back(std::move(leg_geometry));
|
||||||
legs.push_back(std::move(leg));
|
legs.push_back(std::move(leg));
|
||||||
|
|||||||
@ -48,25 +48,25 @@ class TableAPI final : public BaseAPI
|
|||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||||
osrm::engine::api::ResultT &response) const
|
osrm::engine::api::ResultT &response) const
|
||||||
{
|
{
|
||||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
{
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(tables, phantoms, fallback_speed_cells, fb_result);
|
MakeResponse(tables, candidates, fallback_speed_cells, fb_result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(tables, phantoms, fallback_speed_cells, json_result);
|
MakeResponse(tables, candidates, fallback_speed_cells, json_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
{
|
{
|
||||||
@ -86,15 +86,15 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
sources = MakeWaypoints(fb_result, phantoms);
|
sources = MakeWaypoints(fb_result, candidates);
|
||||||
}
|
}
|
||||||
number_of_sources = phantoms.size();
|
number_of_sources = candidates.size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
sources = MakeWaypoints(fb_result, phantoms, parameters.sources);
|
sources = MakeWaypoints(fb_result, candidates, parameters.sources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,15 +104,15 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
destinations = MakeWaypoints(fb_result, phantoms);
|
destinations = MakeWaypoints(fb_result, candidates);
|
||||||
}
|
}
|
||||||
number_of_destinations = phantoms.size();
|
number_of_destinations = candidates.size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
destinations = MakeWaypoints(fb_result, phantoms, parameters.destinations);
|
destinations = MakeWaypoints(fb_result, candidates, parameters.destinations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ class TableAPI final : public BaseAPI
|
|||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
const std::vector<TableCellRef> &fallback_speed_cells,
|
const std::vector<TableCellRef> &fallback_speed_cells,
|
||||||
util::json::Object &response) const
|
util::json::Object &response) const
|
||||||
{
|
{
|
||||||
@ -180,15 +180,15 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
response.values["sources"] = MakeWaypoints(phantoms);
|
response.values["sources"] = MakeWaypoints(candidates);
|
||||||
}
|
}
|
||||||
number_of_sources = phantoms.size();
|
number_of_sources = candidates.size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
response.values["sources"] = MakeWaypoints(phantoms, parameters.sources);
|
response.values["sources"] = MakeWaypoints(candidates, parameters.sources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,15 +196,16 @@ class TableAPI final : public BaseAPI
|
|||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
response.values["destinations"] = MakeWaypoints(phantoms);
|
response.values["destinations"] = MakeWaypoints(candidates);
|
||||||
}
|
}
|
||||||
number_of_destinations = phantoms.size();
|
number_of_destinations = candidates.size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
response.values["destinations"] = MakeWaypoints(phantoms, parameters.destinations);
|
response.values["destinations"] =
|
||||||
|
MakeWaypoints(candidates, parameters.destinations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,36 +227,43 @@ class TableAPI final : public BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.values["code"] = "Ok";
|
response.values["code"] = "Ok";
|
||||||
|
auto data_timestamp = facade.GetTimestamp();
|
||||||
|
if (!data_timestamp.empty())
|
||||||
|
{
|
||||||
|
response.values["data_version"] = data_timestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||||
const std::vector<PhantomNode> &phantoms) const
|
const std::vector<PhantomNodeCandidates> &candidates) const
|
||||||
{
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.reserve(phantoms.size());
|
waypoints.reserve(candidates.size());
|
||||||
BOOST_ASSERT(phantoms.size() == parameters.coordinates.size());
|
BOOST_ASSERT(candidates.size() == parameters.coordinates.size());
|
||||||
|
|
||||||
boost::range::transform(
|
boost::range::transform(candidates,
|
||||||
phantoms, std::back_inserter(waypoints), [this, &builder](const PhantomNode &phantom) {
|
std::back_inserter(waypoints),
|
||||||
return BaseAPI::MakeWaypoint(&builder, phantom)->Finish();
|
[this, &builder](const PhantomNodeCandidates &candidates) {
|
||||||
|
return BaseAPI::MakeWaypoint(&builder, candidates)->Finish();
|
||||||
});
|
});
|
||||||
return builder.CreateVector(waypoints);
|
return builder.CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
virtual flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
MakeWaypoints(flatbuffers::FlatBufferBuilder &builder,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
const std::vector<std::size_t> &indices) const
|
const std::vector<std::size_t> &indices) const
|
||||||
{
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.reserve(indices.size());
|
waypoints.reserve(indices.size());
|
||||||
boost::range::transform(indices,
|
boost::range::transform(
|
||||||
|
indices,
|
||||||
std::back_inserter(waypoints),
|
std::back_inserter(waypoints),
|
||||||
[this, &builder, phantoms](const std::size_t idx) {
|
[this, &builder, &candidates](const std::size_t idx) {
|
||||||
BOOST_ASSERT(idx < phantoms.size());
|
BOOST_ASSERT(idx < candidates.size());
|
||||||
return BaseAPI::MakeWaypoint(&builder, phantoms[idx])->Finish();
|
return BaseAPI::MakeWaypoint(&builder, candidates[idx])->Finish();
|
||||||
});
|
});
|
||||||
return builder.CreateVector(waypoints);
|
return builder.CreateVector(waypoints);
|
||||||
}
|
}
|
||||||
@ -308,29 +316,31 @@ class TableAPI final : public BaseAPI
|
|||||||
return builder.CreateVector(fb_table);
|
return builder.CreateVector(fb_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual util::json::Array MakeWaypoints(const std::vector<PhantomNode> &phantoms) const
|
virtual util::json::Array
|
||||||
|
MakeWaypoints(const std::vector<PhantomNodeCandidates> &candidates) const
|
||||||
{
|
{
|
||||||
util::json::Array json_waypoints;
|
util::json::Array json_waypoints;
|
||||||
json_waypoints.values.reserve(phantoms.size());
|
json_waypoints.values.reserve(candidates.size());
|
||||||
BOOST_ASSERT(phantoms.size() == parameters.coordinates.size());
|
BOOST_ASSERT(candidates.size() == parameters.coordinates.size());
|
||||||
|
|
||||||
boost::range::transform(
|
boost::range::transform(candidates,
|
||||||
phantoms,
|
|
||||||
std::back_inserter(json_waypoints.values),
|
std::back_inserter(json_waypoints.values),
|
||||||
[this](const PhantomNode &phantom) { return BaseAPI::MakeWaypoint(phantom); });
|
[this](const PhantomNodeCandidates &candidates) {
|
||||||
|
return BaseAPI::MakeWaypoint(candidates);
|
||||||
|
});
|
||||||
return json_waypoints;
|
return json_waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual util::json::Array MakeWaypoints(const std::vector<PhantomNode> &phantoms,
|
virtual util::json::Array MakeWaypoints(const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
const std::vector<std::size_t> &indices) const
|
const std::vector<std::size_t> &indices) const
|
||||||
{
|
{
|
||||||
util::json::Array json_waypoints;
|
util::json::Array json_waypoints;
|
||||||
json_waypoints.values.reserve(indices.size());
|
json_waypoints.values.reserve(indices.size());
|
||||||
boost::range::transform(indices,
|
boost::range::transform(indices,
|
||||||
std::back_inserter(json_waypoints.values),
|
std::back_inserter(json_waypoints.values),
|
||||||
[this, phantoms](const std::size_t idx) {
|
[this, &candidates](const std::size_t idx) {
|
||||||
BOOST_ASSERT(idx < phantoms.size());
|
BOOST_ASSERT(idx < candidates.size());
|
||||||
return BaseAPI::MakeWaypoint(phantoms[idx]);
|
return BaseAPI::MakeWaypoint(candidates[idx]);
|
||||||
});
|
});
|
||||||
return json_waypoints;
|
return json_waypoints;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class TripAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<InternalRouteResult> &sub_routes,
|
const std::vector<InternalRouteResult> &sub_routes,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
osrm::engine::api::ResultT &response) const
|
osrm::engine::api::ResultT &response) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(sub_trips.size() == sub_routes.size());
|
BOOST_ASSERT(sub_trips.size() == sub_routes.size());
|
||||||
@ -34,17 +34,17 @@ class TripAPI final : public RouteAPI
|
|||||||
if (response.is<flatbuffers::FlatBufferBuilder>())
|
if (response.is<flatbuffers::FlatBufferBuilder>())
|
||||||
{
|
{
|
||||||
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
auto &fb_result = response.get<flatbuffers::FlatBufferBuilder>();
|
||||||
MakeResponse(sub_trips, sub_routes, phantoms, fb_result);
|
MakeResponse(sub_trips, sub_routes, candidates, fb_result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto &json_result = response.get<util::json::Object>();
|
auto &json_result = response.get<util::json::Object>();
|
||||||
MakeResponse(sub_trips, sub_routes, phantoms, json_result);
|
MakeResponse(sub_trips, sub_routes, candidates, json_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<InternalRouteResult> &sub_routes,
|
const std::vector<InternalRouteResult> &sub_routes,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||||
{
|
{
|
||||||
auto data_timestamp = facade.GetTimestamp();
|
auto data_timestamp = facade.GetTimestamp();
|
||||||
@ -55,8 +55,8 @@ class TripAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto response =
|
auto response =
|
||||||
MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &phantoms]() {
|
MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &candidates]() {
|
||||||
return MakeWaypoints(fb_result, sub_trips, phantoms);
|
return MakeWaypoints(fb_result, sub_trips, candidates);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data_timestamp.empty())
|
if (!data_timestamp.empty())
|
||||||
@ -67,7 +67,7 @@ class TripAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
void MakeResponse(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<InternalRouteResult> &sub_routes,
|
const std::vector<InternalRouteResult> &sub_routes,
|
||||||
const std::vector<PhantomNode> &phantoms,
|
const std::vector<PhantomNodeCandidates> &candidates,
|
||||||
util::json::Object &response) const
|
util::json::Object &response) const
|
||||||
{
|
{
|
||||||
auto number_of_routes = sub_trips.size();
|
auto number_of_routes = sub_trips.size();
|
||||||
@ -75,7 +75,7 @@ class TripAPI final : public RouteAPI
|
|||||||
routes.values.reserve(number_of_routes);
|
routes.values.reserve(number_of_routes);
|
||||||
for (auto index : util::irange<std::size_t>(0UL, sub_trips.size()))
|
for (auto index : util::irange<std::size_t>(0UL, sub_trips.size()))
|
||||||
{
|
{
|
||||||
auto route = MakeRoute(sub_routes[index].segment_end_coordinates,
|
auto route = MakeRoute(sub_routes[index].leg_endpoints,
|
||||||
sub_routes[index].unpacked_path_segments,
|
sub_routes[index].unpacked_path_segments,
|
||||||
sub_routes[index].source_traversed_in_reverse,
|
sub_routes[index].source_traversed_in_reverse,
|
||||||
sub_routes[index].target_traversed_in_reverse);
|
sub_routes[index].target_traversed_in_reverse);
|
||||||
@ -83,10 +83,15 @@ class TripAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
if (!parameters.skip_waypoints)
|
if (!parameters.skip_waypoints)
|
||||||
{
|
{
|
||||||
response.values["waypoints"] = MakeWaypoints(sub_trips, phantoms);
|
response.values["waypoints"] = MakeWaypoints(sub_trips, candidates);
|
||||||
}
|
}
|
||||||
response.values["trips"] = std::move(routes);
|
response.values["trips"] = std::move(routes);
|
||||||
response.values["code"] = "Ok";
|
response.values["code"] = "Ok";
|
||||||
|
auto data_timestamp = facade.GetTimestamp();
|
||||||
|
if (!data_timestamp.empty())
|
||||||
|
{
|
||||||
|
response.values["data_version"] = data_timestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -115,7 +120,7 @@ class TripAPI final : public RouteAPI
|
|||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
|
||||||
MakeWaypoints(flatbuffers::FlatBufferBuilder &fb_result,
|
MakeWaypoints(flatbuffers::FlatBufferBuilder &fb_result,
|
||||||
const std::vector<std::vector<NodeID>> &sub_trips,
|
const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<PhantomNode> &phantoms) const
|
const std::vector<PhantomNodeCandidates> &candidates) const
|
||||||
{
|
{
|
||||||
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
std::vector<flatbuffers::Offset<fbresult::Waypoint>> waypoints;
|
||||||
waypoints.reserve(parameters.coordinates.size());
|
waypoints.reserve(parameters.coordinates.size());
|
||||||
@ -127,7 +132,7 @@ class TripAPI final : public RouteAPI
|
|||||||
auto trip_index = input_idx_to_trip_idx[input_index];
|
auto trip_index = input_idx_to_trip_idx[input_index];
|
||||||
BOOST_ASSERT(!trip_index.NotUsed());
|
BOOST_ASSERT(!trip_index.NotUsed());
|
||||||
|
|
||||||
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, phantoms[input_index]);
|
auto waypoint = BaseAPI::MakeWaypoint(&fb_result, candidates[input_index]);
|
||||||
waypoint->add_waypoint_index(trip_index.point_index);
|
waypoint->add_waypoint_index(trip_index.point_index);
|
||||||
waypoint->add_trips_index(trip_index.sub_trip_index);
|
waypoint->add_trips_index(trip_index.sub_trip_index);
|
||||||
waypoints.push_back(waypoint->Finish());
|
waypoints.push_back(waypoint->Finish());
|
||||||
@ -137,7 +142,7 @@ class TripAPI final : public RouteAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
util::json::Array MakeWaypoints(const std::vector<std::vector<NodeID>> &sub_trips,
|
util::json::Array MakeWaypoints(const std::vector<std::vector<NodeID>> &sub_trips,
|
||||||
const std::vector<PhantomNode> &phantoms) const
|
const std::vector<PhantomNodeCandidates> &candidates) const
|
||||||
{
|
{
|
||||||
util::json::Array waypoints;
|
util::json::Array waypoints;
|
||||||
waypoints.values.reserve(parameters.coordinates.size());
|
waypoints.values.reserve(parameters.coordinates.size());
|
||||||
@ -149,7 +154,7 @@ class TripAPI final : public RouteAPI
|
|||||||
auto trip_index = input_idx_to_trip_idx[input_index];
|
auto trip_index = input_idx_to_trip_idx[input_index];
|
||||||
BOOST_ASSERT(!trip_index.NotUsed());
|
BOOST_ASSERT(!trip_index.NotUsed());
|
||||||
|
|
||||||
auto waypoint = BaseAPI::MakeWaypoint(phantoms[input_index]);
|
auto waypoint = BaseAPI::MakeWaypoint(candidates[input_index]);
|
||||||
waypoint.values["trips_index"] = trip_index.sub_trip_index;
|
waypoint.values["trips_index"] = trip_index.sub_trip_index;
|
||||||
waypoint.values["waypoint_index"] = trip_index.point_index;
|
waypoint.values["waypoint_index"] = trip_index.point_index;
|
||||||
waypoints.values.push_back(std::move(waypoint));
|
waypoints.values.push_back(std::move(waypoint));
|
||||||
|
|||||||
@ -36,24 +36,27 @@ template <> class AlgorithmDataFacade<CH>
|
|||||||
|
|
||||||
virtual unsigned GetNumberOfEdges() const = 0;
|
virtual unsigned GetNumberOfEdges() const = 0;
|
||||||
|
|
||||||
virtual unsigned GetOutDegree(const NodeID n) const = 0;
|
virtual unsigned GetOutDegree(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual NodeID GetTarget(const EdgeID e) const = 0;
|
virtual NodeID GetTarget(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual const EdgeData &GetEdgeData(const EdgeID e) const = 0;
|
virtual const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeRange GetAdjacentEdgeRange(const NodeID node) const = 0;
|
virtual EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0;
|
virtual EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const = 0;
|
||||||
|
|
||||||
virtual EdgeID FindEdgeInEitherDirection(const NodeID from, const NodeID to) const = 0;
|
virtual EdgeID FindEdgeInEitherDirection(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const = 0;
|
||||||
|
|
||||||
virtual EdgeID
|
virtual EdgeID FindEdgeIndicateIfReverse(const NodeID edge_based_node_from,
|
||||||
FindEdgeIndicateIfReverse(const NodeID from, const NodeID to, bool &result) const = 0;
|
const NodeID edge_based_node_to,
|
||||||
|
bool &result) const = 0;
|
||||||
|
|
||||||
virtual EdgeID FindSmallestEdge(const NodeID from,
|
virtual EdgeID FindSmallestEdge(const NodeID edge_based_node_from,
|
||||||
const NodeID to,
|
const NodeID edge_based_node_to,
|
||||||
const std::function<bool(EdgeData)> filter) const = 0;
|
const std::function<bool(EdgeData)> filter) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,23 +73,24 @@ template <> class AlgorithmDataFacade<MLD>
|
|||||||
|
|
||||||
virtual unsigned GetNumberOfEdges() const = 0;
|
virtual unsigned GetNumberOfEdges() const = 0;
|
||||||
|
|
||||||
virtual unsigned GetOutDegree(const NodeID n) const = 0;
|
virtual unsigned GetOutDegree(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeRange GetAdjacentEdgeRange(const NodeID node) const = 0;
|
virtual EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeWeight GetNodeWeight(const NodeID node) const = 0;
|
virtual EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual EdgeWeight GetNodeDuration(const NodeID node) const = 0; // TODO: to be removed
|
virtual EdgeWeight
|
||||||
|
GetNodeDuration(const NodeID edge_based_node_id) const = 0; // TODO: to be removed
|
||||||
|
|
||||||
virtual EdgeDistance GetNodeDistance(const NodeID node) const = 0;
|
virtual EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsForwardEdge(EdgeID edge) const = 0;
|
virtual bool IsForwardEdge(EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsBackwardEdge(EdgeID edge) const = 0;
|
virtual bool IsBackwardEdge(EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual NodeID GetTarget(const EdgeID e) const = 0;
|
virtual NodeID GetTarget(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual const EdgeData &GetEdgeData(const EdgeID e) const = 0;
|
virtual const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual const partitioner::MultiLevelPartitionView &GetMultiLevelPartition() const = 0;
|
virtual const partitioner::MultiLevelPartitionView &GetMultiLevelPartition() const = 0;
|
||||||
|
|
||||||
@ -94,10 +98,12 @@ template <> class AlgorithmDataFacade<MLD>
|
|||||||
|
|
||||||
virtual const customizer::CellMetricView &GetCellMetric() const = 0;
|
virtual const customizer::CellMetricView &GetCellMetric() const = 0;
|
||||||
|
|
||||||
virtual EdgeRange GetBorderEdgeRange(const LevelID level, const NodeID node) const = 0;
|
virtual EdgeRange GetBorderEdgeRange(const LevelID level,
|
||||||
|
const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0;
|
virtual EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const = 0;
|
||||||
};
|
};
|
||||||
} // namespace datafacade
|
} // namespace datafacade
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|||||||
@ -73,45 +73,52 @@ class ContiguousInternalMemoryAlgorithmDataFacade<CH> : public datafacade::Algor
|
|||||||
|
|
||||||
unsigned GetNumberOfEdges() const override final { return m_query_graph.GetNumberOfEdges(); }
|
unsigned GetNumberOfEdges() const override final { return m_query_graph.GetNumberOfEdges(); }
|
||||||
|
|
||||||
unsigned GetOutDegree(const NodeID n) const override final
|
unsigned GetOutDegree(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.GetOutDegree(n);
|
return m_query_graph.GetOutDegree(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID GetTarget(const EdgeID e) const override final { return m_query_graph.GetTarget(e); }
|
NodeID GetTarget(const EdgeID edge_based_edge_id) const override final
|
||||||
|
|
||||||
const EdgeData &GetEdgeData(const EdgeID e) const override final
|
|
||||||
{
|
{
|
||||||
return m_query_graph.GetEdgeData(e);
|
return m_query_graph.GetTarget(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final
|
const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.GetAdjacentEdgeRange(node);
|
return m_query_graph.GetEdgeData(edge_based_edge_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const override final
|
||||||
|
{
|
||||||
|
return m_query_graph.GetAdjacentEdgeRange(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
EdgeID FindEdge(const NodeID from, const NodeID to) const override final
|
EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindEdge(from, to);
|
return m_query_graph.FindEdge(edge_based_node_from, edge_based_node_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeID FindEdgeInEitherDirection(const NodeID from, const NodeID to) const override final
|
EdgeID FindEdgeInEitherDirection(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindEdgeInEitherDirection(from, to);
|
return m_query_graph.FindEdgeInEitherDirection(edge_based_node_from, edge_based_node_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeID
|
EdgeID FindEdgeIndicateIfReverse(const NodeID edge_based_node_from,
|
||||||
FindEdgeIndicateIfReverse(const NodeID from, const NodeID to, bool &result) const override final
|
const NodeID edge_based_node_to,
|
||||||
|
bool &result) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindEdgeIndicateIfReverse(from, to, result);
|
return m_query_graph.FindEdgeIndicateIfReverse(
|
||||||
|
edge_based_node_from, edge_based_node_to, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeID FindSmallestEdge(const NodeID from,
|
EdgeID FindSmallestEdge(const NodeID edge_based_node_from,
|
||||||
const NodeID to,
|
const NodeID edge_based_node_to,
|
||||||
std::function<bool(EdgeData)> filter) const override final
|
std::function<bool(EdgeData)> filter) const override final
|
||||||
{
|
{
|
||||||
return m_query_graph.FindSmallestEdge(from, to, filter);
|
return m_query_graph.FindSmallestEdge(edge_based_node_from, edge_based_node_to, filter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -126,11 +133,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using super = BaseDataFacade;
|
using super = BaseDataFacade;
|
||||||
using IndexBlock = util::RangeTable<16, storage::Ownership::View>::BlockT;
|
|
||||||
using RTreeLeaf = super::RTreeLeaf;
|
using RTreeLeaf = super::RTreeLeaf;
|
||||||
using SharedRTree = util::StaticRTree<RTreeLeaf, storage::Ownership::View>;
|
using SharedRTree = util::StaticRTree<RTreeLeaf, storage::Ownership::View>;
|
||||||
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
||||||
using RTreeNode = SharedRTree::TreeNode;
|
|
||||||
|
|
||||||
extractor::ClassData exclude_mask;
|
extractor::ClassData exclude_mask;
|
||||||
extractor::ProfileProperties *m_profile_properties;
|
extractor::ProfileProperties *m_profile_properties;
|
||||||
@ -231,76 +236,80 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
}
|
}
|
||||||
|
|
||||||
// node and edge information access
|
// node and edge information access
|
||||||
util::Coordinate GetCoordinateOfNode(const NodeID id) const override final
|
util::Coordinate GetCoordinateOfNode(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return m_coordinate_list[id];
|
return m_coordinate_list[node_based_node_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
OSMNodeID GetOSMNodeIDOfNode(const NodeID id) const override final
|
OSMNodeID GetOSMNodeIDOfNode(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return m_osmnodeid_list[id];
|
return m_osmnodeid_list[node_based_node_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeForwardRange GetUncompressedForwardGeometry(const EdgeID id) const override final
|
NodeForwardRange GetUncompressedForwardGeometry(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardGeometry(id);
|
return segment_data.GetForwardGeometry(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeReverseRange GetUncompressedReverseGeometry(const EdgeID id) const override final
|
NodeReverseRange GetUncompressedReverseGeometry(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseGeometry(id);
|
return segment_data.GetReverseGeometry(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
DurationForwardRange GetUncompressedForwardDurations(const EdgeID id) const override final
|
DurationForwardRange
|
||||||
|
GetUncompressedForwardDurations(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardDurations(id);
|
return segment_data.GetForwardDurations(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
DurationReverseRange GetUncompressedReverseDurations(const EdgeID id) const override final
|
DurationReverseRange
|
||||||
|
GetUncompressedReverseDurations(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseDurations(id);
|
return segment_data.GetReverseDurations(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
WeightForwardRange GetUncompressedForwardWeights(const EdgeID id) const override final
|
WeightForwardRange GetUncompressedForwardWeights(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardWeights(id);
|
return segment_data.GetForwardWeights(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
WeightReverseRange GetUncompressedReverseWeights(const EdgeID id) const override final
|
WeightReverseRange GetUncompressedReverseWeights(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseWeights(id);
|
return segment_data.GetReverseWeights(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the data source ids that were used to supply the edge
|
// Returns the data source ids that were used to supply the edge
|
||||||
// weights.
|
// weights.
|
||||||
DatasourceForwardRange GetUncompressedForwardDatasources(const EdgeID id) const override final
|
DatasourceForwardRange
|
||||||
|
GetUncompressedForwardDatasources(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetForwardDatasources(id);
|
return segment_data.GetForwardDatasources(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the data source ids that were used to supply the edge
|
// Returns the data source ids that were used to supply the edge
|
||||||
// weights.
|
// weights.
|
||||||
DatasourceReverseRange GetUncompressedReverseDatasources(const EdgeID id) const override final
|
DatasourceReverseRange
|
||||||
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const override final
|
||||||
{
|
{
|
||||||
return segment_data.GetReverseDatasources(id);
|
return segment_data.GetReverseDatasources(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID id) const override final
|
TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(m_turn_weight_penalties.size() > id);
|
BOOST_ASSERT(m_turn_weight_penalties.size() > edge_based_edge_id);
|
||||||
return m_turn_weight_penalties[id];
|
return m_turn_weight_penalties[edge_based_edge_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID id) const override final
|
TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(m_turn_duration_penalties.size() > id);
|
BOOST_ASSERT(m_turn_duration_penalties.size() > edge_based_edge_id);
|
||||||
return m_turn_duration_penalties[id];
|
return m_turn_duration_penalties[edge_based_edge_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
osrm::guidance::TurnInstruction
|
osrm::guidance::TurnInstruction
|
||||||
GetTurnInstructionForEdgeID(const EdgeID id) const override final
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetTurnInstruction(id);
|
return turn_data.GetTurnInstruction(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
||||||
@ -314,127 +323,41 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
std::vector<PhantomNodeWithDistance>
|
||||||
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
||||||
const float max_distance,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodesInRange(
|
|
||||||
input_coordinate, max_distance, approach, use_all_edges);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
|
||||||
const float max_distance,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodesInRange(
|
|
||||||
input_coordinate, max_distance, bearing, bearing_range, approach, use_all_edges);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const Approach approach) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodes(input_coordinate, max_results, approach);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const double max_distance,
|
const double max_distance,
|
||||||
|
const boost::optional<Bearing> bearing,
|
||||||
|
const Approach approach,
|
||||||
|
const bool use_all_edges) const override final
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(m_geospatial_query.get());
|
||||||
|
|
||||||
|
return m_geospatial_query->NearestPhantomNodes(
|
||||||
|
input_coordinate, approach, boost::none, max_distance, bearing, use_all_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<PhantomNodeWithDistance>
|
||||||
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
||||||
|
const size_t max_results,
|
||||||
|
const boost::optional<double> max_distance,
|
||||||
|
const boost::optional<Bearing> bearing,
|
||||||
const Approach approach) const override final
|
const Approach approach) const override final
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
BOOST_ASSERT(m_geospatial_query.get());
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodes(
|
return m_geospatial_query->NearestPhantomNodes(
|
||||||
input_coordinate, max_results, max_distance, approach);
|
input_coordinate, approach, max_results, max_distance, bearing, boost::none);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
PhantomCandidateAlternatives
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
NearestCandidatesWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
||||||
const unsigned max_results,
|
const boost::optional<double> max_distance,
|
||||||
const int bearing,
|
const boost::optional<Bearing> bearing,
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodes(
|
|
||||||
input_coordinate, max_results, bearing, bearing_range, approach);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const double max_distance,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodes(
|
|
||||||
input_coordinate, max_results, max_distance, bearing, bearing_range, approach);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const Approach approach,
|
const Approach approach,
|
||||||
const bool use_all_edges) const override final
|
const bool use_all_edges) const override final
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
BOOST_ASSERT(m_geospatial_query.get());
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
return m_geospatial_query->NearestCandidatesWithAlternativeFromBigComponent(
|
||||||
input_coordinate, approach, use_all_edges);
|
input_coordinate, approach, max_distance, bearing, use_all_edges);
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const double max_distance,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
||||||
input_coordinate, max_distance, approach, use_all_edges);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const double max_distance,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
||||||
input_coordinate, max_distance, bearing, bearing_range, approach, use_all_edges);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const override final
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(m_geospatial_query.get());
|
|
||||||
|
|
||||||
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
||||||
input_coordinate, bearing, bearing_range, approach, use_all_edges);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t GetCheckSum() const override final { return m_check_sum; }
|
std::uint32_t GetCheckSum() const override final { return m_check_sum; }
|
||||||
@ -444,29 +367,29 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return std::string(m_data_timestamp.begin(), m_data_timestamp.end());
|
return std::string(m_data_timestamp.begin(), m_data_timestamp.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometryID GetGeometryIndex(const NodeID id) const override final
|
GeometryID GetGeometryIndex(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetGeometryID(id);
|
return edge_based_node_data.GetGeometryID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComponentID GetComponentID(const NodeID id) const override final
|
ComponentID GetComponentID(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetComponentID(id);
|
return edge_based_node_data.GetComponentID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::TravelMode GetTravelMode(const NodeID id) const override final
|
extractor::TravelMode GetTravelMode(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetTravelMode(id);
|
return edge_based_node_data.GetTravelMode(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::ClassData GetClassData(const NodeID id) const override final
|
extractor::ClassData GetClassData(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetClassData(id);
|
return edge_based_node_data.GetClassData(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExcludeNode(const NodeID id) const override final
|
bool ExcludeNode(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return (edge_based_node_data.GetClassData(id) & exclude_mask) > 0;
|
return (edge_based_node_data.GetClassData(edge_based_node_id) & exclude_mask) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
|
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
|
||||||
@ -480,9 +403,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
NameID GetNameIndex(const NodeID id) const override final
|
NameID GetNameIndex(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.GetNameID(id);
|
return edge_based_node_data.GetNameID(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView GetNameForID(const NameID id) const override final
|
StringView GetNameForID(const NameID id) const override final
|
||||||
@ -537,32 +460,37 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
return m_profile_properties->GetWeightMultiplier();
|
return m_profile_properties->GetWeightMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
util::guidance::BearingClass GetBearingClass(const NodeID node) const override final
|
util::guidance::BearingClass
|
||||||
|
GetBearingClass(const NodeID node_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return intersection_bearings_view.GetBearingClass(node);
|
return intersection_bearings_view.GetBearingClass(node_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final
|
guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetPreTurnBearing(eid);
|
return turn_data.GetPreTurnBearing(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
guidance::TurnBearing PostTurnBearing(const EdgeID eid) const override final
|
guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return turn_data.GetPostTurnBearing(eid);
|
return turn_data.GetPostTurnBearing(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const override final
|
util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
auto entry_class_id = turn_data.GetEntryClassID(turn_id);
|
auto entry_class_id = turn_data.GetEntryClassID(edge_based_edge_id);
|
||||||
return m_entry_class_table.at(entry_class_id);
|
return m_entry_class_table.at(entry_class_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasLaneData(const EdgeID id) const override final { return turn_data.HasLaneData(id); }
|
bool HasLaneData(const EdgeID edge_based_edge_id) const override final
|
||||||
|
|
||||||
util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const override final
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(HasLaneData(id));
|
return turn_data.HasLaneData(edge_based_edge_id);
|
||||||
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(id));
|
}
|
||||||
|
|
||||||
|
util::guidance::LaneTupleIdPair
|
||||||
|
GetLaneData(const EdgeID edge_based_edge_id) const override final
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(HasLaneData(edge_based_edge_id));
|
||||||
|
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(edge_based_edge_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
extractor::TurnLaneDescription
|
extractor::TurnLaneDescription
|
||||||
@ -577,15 +505,15 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
m_lane_description_offsets[lane_description_id + 1]);
|
m_lane_description_offsets[lane_description_id + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsLeftHandDriving(const NodeID id) const override final
|
bool IsLeftHandDriving(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
// TODO: can be moved to a data block indexed by GeometryID
|
// TODO: can be moved to a data block indexed by GeometryID
|
||||||
return edge_based_node_data.IsLeftHandDriving(id);
|
return edge_based_node_data.IsLeftHandDriving(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSegregated(const NodeID id) const override final
|
bool IsSegregated(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return edge_based_node_data.IsSegregated(id);
|
return edge_based_node_data.IsSegregated(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<extractor::ManeuverOverride>
|
std::vector<extractor::ManeuverOverride>
|
||||||
@ -630,7 +558,7 @@ class ContiguousInternalMemoryDataFacade<CH>
|
|||||||
public ContiguousInternalMemoryAlgorithmDataFacade<CH>
|
public ContiguousInternalMemoryAlgorithmDataFacade<CH>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator,
|
ContiguousInternalMemoryDataFacade(const std::shared_ptr<ContiguousBlockAllocator> &allocator,
|
||||||
const std::string &metric_name,
|
const std::string &metric_name,
|
||||||
const std::size_t exclude_index)
|
const std::size_t exclude_index)
|
||||||
: ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index),
|
: ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index),
|
||||||
@ -691,57 +619,62 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
|
|||||||
|
|
||||||
unsigned GetNumberOfEdges() const override final { return query_graph.GetNumberOfEdges(); }
|
unsigned GetNumberOfEdges() const override final { return query_graph.GetNumberOfEdges(); }
|
||||||
|
|
||||||
unsigned GetOutDegree(const NodeID n) const override final
|
unsigned GetOutDegree(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetOutDegree(n);
|
return query_graph.GetOutDegree(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final
|
EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetAdjacentEdgeRange(node);
|
return query_graph.GetAdjacentEdgeRange(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeWeight GetNodeWeight(const NodeID node) const override final
|
EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetNodeWeight(node);
|
return query_graph.GetNodeWeight(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeDuration GetNodeDuration(const NodeID node) const override final
|
EdgeDuration GetNodeDuration(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetNodeDuration(node);
|
return query_graph.GetNodeDuration(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeDistance GetNodeDistance(const NodeID node) const override final
|
EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetNodeDistance(node);
|
return query_graph.GetNodeDistance(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsForwardEdge(const NodeID node) const override final
|
bool IsForwardEdge(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.IsForwardEdge(node);
|
return query_graph.IsForwardEdge(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBackwardEdge(const NodeID node) const override final
|
bool IsBackwardEdge(const NodeID edge_based_node_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.IsBackwardEdge(node);
|
return query_graph.IsBackwardEdge(edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID GetTarget(const EdgeID e) const override final { return query_graph.GetTarget(e); }
|
NodeID GetTarget(const EdgeID edge_based_edge_id) const override final
|
||||||
|
|
||||||
const EdgeData &GetEdgeData(const EdgeID e) const override final
|
|
||||||
{
|
{
|
||||||
return query_graph.GetEdgeData(e);
|
return query_graph.GetTarget(edge_based_edge_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeRange GetBorderEdgeRange(const LevelID level, const NodeID node) const override final
|
const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const override final
|
||||||
{
|
{
|
||||||
return query_graph.GetBorderEdgeRange(level, node);
|
return query_graph.GetEdgeData(edge_based_edge_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
EdgeRange GetBorderEdgeRange(const LevelID level,
|
||||||
|
const NodeID edge_based_node_id) const override final
|
||||||
|
{
|
||||||
|
return query_graph.GetBorderEdgeRange(level, edge_based_node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// searches for a specific edge
|
// searches for a specific edge
|
||||||
EdgeID FindEdge(const NodeID from, const NodeID to) const override final
|
EdgeID FindEdge(const NodeID edge_based_node_from,
|
||||||
|
const NodeID edge_based_node_to) const override final
|
||||||
{
|
{
|
||||||
return query_graph.FindEdge(from, to);
|
return query_graph.FindEdge(edge_based_node_from, edge_based_node_to);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -752,7 +685,7 @@ class ContiguousInternalMemoryDataFacade<MLD> final
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator,
|
ContiguousInternalMemoryDataFacade(const std::shared_ptr<ContiguousBlockAllocator> &allocator,
|
||||||
const std::string &metric_name,
|
const std::string &metric_name,
|
||||||
const std::size_t exclude_index)
|
const std::size_t exclude_index)
|
||||||
: ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index),
|
: ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index),
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
#include <boost/range/any_range.hpp>
|
#include <boost/range/any_range.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include <engine/bearing.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -77,46 +78,51 @@ class BaseDataFacade
|
|||||||
virtual std::string GetTimestamp() const = 0;
|
virtual std::string GetTimestamp() const = 0;
|
||||||
|
|
||||||
// node and edge information access
|
// node and edge information access
|
||||||
virtual util::Coordinate GetCoordinateOfNode(const NodeID id) const = 0;
|
virtual util::Coordinate GetCoordinateOfNode(const NodeID node_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual OSMNodeID GetOSMNodeIDOfNode(const NodeID id) const = 0;
|
virtual OSMNodeID GetOSMNodeIDOfNode(const NodeID node_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual GeometryID GetGeometryIndex(const NodeID id) const = 0;
|
virtual GeometryID GetGeometryIndex(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual ComponentID GetComponentID(const NodeID id) const = 0;
|
virtual ComponentID GetComponentID(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual NodeForwardRange GetUncompressedForwardGeometry(const EdgeID id) const = 0;
|
virtual NodeForwardRange GetUncompressedForwardGeometry(const PackedGeometryID id) const = 0;
|
||||||
virtual NodeReverseRange GetUncompressedReverseGeometry(const EdgeID id) const = 0;
|
virtual NodeReverseRange GetUncompressedReverseGeometry(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
virtual TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID id) const = 0;
|
virtual TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID id) const = 0;
|
virtual TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
// Gets the weight values for each segment in an uncompressed geometry.
|
// Gets the weight values for each segment in an uncompressed geometry.
|
||||||
// Should always be 1 shorter than GetUncompressedGeometry
|
// Should always be 1 shorter than GetUncompressedGeometry
|
||||||
virtual WeightForwardRange GetUncompressedForwardWeights(const EdgeID id) const = 0;
|
virtual WeightForwardRange GetUncompressedForwardWeights(const PackedGeometryID id) const = 0;
|
||||||
virtual WeightReverseRange GetUncompressedReverseWeights(const EdgeID id) const = 0;
|
virtual WeightReverseRange GetUncompressedReverseWeights(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Gets the duration values for each segment in an uncompressed geometry.
|
// Gets the duration values for each segment in an uncompressed geometry.
|
||||||
// Should always be 1 shorter than GetUncompressedGeometry
|
// Should always be 1 shorter than GetUncompressedGeometry
|
||||||
virtual DurationForwardRange GetUncompressedForwardDurations(const EdgeID id) const = 0;
|
virtual DurationForwardRange
|
||||||
virtual DurationReverseRange GetUncompressedReverseDurations(const EdgeID id) const = 0;
|
GetUncompressedForwardDurations(const PackedGeometryID id) const = 0;
|
||||||
|
virtual DurationReverseRange
|
||||||
|
GetUncompressedReverseDurations(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Returns the data source ids that were used to supply the edge
|
// Returns the data source ids that were used to supply the edge
|
||||||
// weights. Will return an empty array when only the base profile is used.
|
// weights. Will return an empty array when only the base profile is used.
|
||||||
virtual DatasourceForwardRange GetUncompressedForwardDatasources(const EdgeID id) const = 0;
|
virtual DatasourceForwardRange
|
||||||
virtual DatasourceReverseRange GetUncompressedReverseDatasources(const EdgeID id) const = 0;
|
GetUncompressedForwardDatasources(const PackedGeometryID id) const = 0;
|
||||||
|
virtual DatasourceReverseRange
|
||||||
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const = 0;
|
||||||
|
|
||||||
// Gets the name of a datasource
|
// Gets the name of a datasource
|
||||||
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
||||||
|
|
||||||
virtual osrm::guidance::TurnInstruction GetTurnInstructionForEdgeID(const EdgeID id) const = 0;
|
virtual osrm::guidance::TurnInstruction
|
||||||
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual extractor::TravelMode GetTravelMode(const NodeID id) const = 0;
|
virtual extractor::TravelMode GetTravelMode(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual extractor::ClassData GetClassData(const NodeID id) const = 0;
|
virtual extractor::ClassData GetClassData(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual bool ExcludeNode(const NodeID id) const = 0;
|
virtual bool ExcludeNode(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;
|
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;
|
||||||
|
|
||||||
@ -125,69 +131,31 @@ class BaseDataFacade
|
|||||||
|
|
||||||
virtual std::vector<PhantomNodeWithDistance>
|
virtual std::vector<PhantomNodeWithDistance>
|
||||||
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
||||||
const float max_distance,
|
const double max_distance,
|
||||||
const int bearing,
|
const boost::optional<Bearing> bearing,
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const = 0;
|
|
||||||
virtual std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
|
||||||
const float max_distance,
|
|
||||||
const Approach approach,
|
const Approach approach,
|
||||||
const bool use_all_edges) const = 0;
|
const bool use_all_edges) const = 0;
|
||||||
|
|
||||||
virtual std::vector<PhantomNodeWithDistance>
|
virtual std::vector<PhantomNodeWithDistance>
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
||||||
const unsigned max_results,
|
const size_t max_results,
|
||||||
const double max_distance,
|
const boost::optional<double> max_distance,
|
||||||
const int bearing,
|
const boost::optional<Bearing> bearing,
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach) const = 0;
|
|
||||||
virtual std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach) const = 0;
|
|
||||||
virtual std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const Approach approach) const = 0;
|
|
||||||
virtual std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const double max_distance,
|
|
||||||
const Approach approach) const = 0;
|
const Approach approach) const = 0;
|
||||||
|
|
||||||
virtual std::pair<PhantomNode, PhantomNode>
|
virtual PhantomCandidateAlternatives
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
NearestCandidatesWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
||||||
|
const boost::optional<double> max_distance,
|
||||||
|
const boost::optional<Bearing> bearing,
|
||||||
const Approach approach,
|
const Approach approach,
|
||||||
const bool use_all_edges) const = 0;
|
const bool use_all_edges) const = 0;
|
||||||
virtual std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const double max_distance,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const = 0;
|
|
||||||
virtual std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const double max_distance,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const = 0;
|
|
||||||
virtual std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges = false) const = 0;
|
|
||||||
|
|
||||||
virtual bool HasLaneData(const EdgeID id) const = 0;
|
virtual bool HasLaneData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;
|
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID edge_based_edge_id) const = 0;
|
||||||
virtual extractor::TurnLaneDescription
|
virtual extractor::TurnLaneDescription
|
||||||
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const = 0;
|
||||||
|
|
||||||
virtual NameID GetNameIndex(const NodeID id) const = 0;
|
virtual NameID GetNameIndex(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual StringView GetNameForID(const NameID id) const = 0;
|
virtual StringView GetNameForID(const NameID id) const = 0;
|
||||||
|
|
||||||
@ -209,16 +177,16 @@ class BaseDataFacade
|
|||||||
|
|
||||||
virtual double GetWeightMultiplier() const = 0;
|
virtual double GetWeightMultiplier() const = 0;
|
||||||
|
|
||||||
virtual osrm::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0;
|
virtual osrm::guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const = 0;
|
||||||
virtual osrm::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const = 0;
|
virtual osrm::guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual util::guidance::BearingClass GetBearingClass(const NodeID node) const = 0;
|
virtual util::guidance::BearingClass GetBearingClass(const NodeID node_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual util::guidance::EntryClass GetEntryClass(const EdgeID turn_id) const = 0;
|
virtual util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsLeftHandDriving(const NodeID id) const = 0;
|
virtual bool IsLeftHandDriving(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual bool IsSegregated(const NodeID) const = 0;
|
virtual bool IsSegregated(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|
||||||
virtual std::vector<extractor::ManeuverOverride>
|
virtual std::vector<extractor::ManeuverOverride>
|
||||||
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ namespace datafacade
|
|||||||
/**
|
/**
|
||||||
* This allocator uses file backed mmap memory block as the data location.
|
* This allocator uses file backed mmap memory block as the data location.
|
||||||
*/
|
*/
|
||||||
class MMapMemoryAllocator : public ContiguousBlockAllocator
|
class MMapMemoryAllocator final : public ContiguousBlockAllocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MMapMemoryAllocator(const storage::StorageConfig &config);
|
explicit MMapMemoryAllocator(const storage::StorageConfig &config);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace datafacade
|
|||||||
* This class holds a unique_ptr to the memory block, so it
|
* This class holds a unique_ptr to the memory block, so it
|
||||||
* is auto-freed upon destruction.
|
* is auto-freed upon destruction.
|
||||||
*/
|
*/
|
||||||
class ProcessMemoryAllocator : public ContiguousBlockAllocator
|
class ProcessMemoryAllocator final : public ContiguousBlockAllocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ProcessMemoryAllocator(const storage::StorageConfig &config);
|
explicit ProcessMemoryAllocator(const storage::StorageConfig &config);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace datafacade
|
|||||||
* Many SharedMemoryDataFacade objects can be created that point to the same shared
|
* Many SharedMemoryDataFacade objects can be created that point to the same shared
|
||||||
* memory block.
|
* memory block.
|
||||||
*/
|
*/
|
||||||
class SharedMemoryAllocator : public ContiguousBlockAllocator
|
class SharedMemoryAllocator final : public ContiguousBlockAllocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SharedMemoryAllocator(
|
explicit SharedMemoryAllocator(
|
||||||
|
|||||||
@ -65,7 +65,7 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
|
|||||||
|
|
||||||
for (const auto &exclude_prefix : exclude_prefixes)
|
for (const auto &exclude_prefix : exclude_prefixes)
|
||||||
{
|
{
|
||||||
auto index_begin = exclude_prefix.find_last_of("/");
|
auto index_begin = exclude_prefix.find_last_of('/');
|
||||||
BOOST_ASSERT_MSG(index_begin != std::string::npos,
|
BOOST_ASSERT_MSG(index_begin != std::string::npos,
|
||||||
"The exclude prefix needs to be a valid data path.");
|
"The exclude prefix needs to be a valid data path.");
|
||||||
std::size_t index =
|
std::size_t index =
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define GEOSPATIAL_QUERY_HPP
|
#define GEOSPATIAL_QUERY_HPP
|
||||||
|
|
||||||
#include "engine/approach.hpp"
|
#include "engine/approach.hpp"
|
||||||
|
#include "engine/bearing.hpp"
|
||||||
#include "engine/phantom_node.hpp"
|
#include "engine/phantom_node.hpp"
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
@ -22,10 +23,10 @@ namespace osrm
|
|||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
inline std::pair<bool, bool> boolPairAnd(const std::pair<bool, bool> &A,
|
inline std::pair<bool, bool> operator&&(const std::pair<bool, bool> &a,
|
||||||
const std::pair<bool, bool> &B)
|
const std::pair<bool, bool> &b)
|
||||||
{
|
{
|
||||||
return std::make_pair(A.first && B.first, A.second && B.second);
|
return {a.first && b.first, a.second && b.second};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements complex queries on top of an RTree and builds PhantomNodes from it.
|
// Implements complex queries on top of an RTree and builds PhantomNodes from it.
|
||||||
@ -48,390 +49,241 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
return rtree.SearchInBox(bbox);
|
return rtree.SearchInBox(bbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns nearest PhantomNodes in the given bearing range within max_distance.
|
// Returns max_results nearest PhantomNodes that are valid within the provided parameters.
|
||||||
// Does not filter by small/big component!
|
// Does not filter by small/big component!
|
||||||
std::vector<PhantomNodeWithDistance>
|
std::vector<PhantomNodeWithDistance>
|
||||||
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
||||||
const double max_distance,
|
|
||||||
const Approach approach,
|
const Approach approach,
|
||||||
const bool use_all_edges) const
|
const boost::optional<size_t> max_results,
|
||||||
|
const boost::optional<double> max_distance,
|
||||||
|
const boost::optional<Bearing> bearing_with_range,
|
||||||
|
const boost::optional<bool> use_all_edges) const
|
||||||
{
|
{
|
||||||
auto results = rtree.Nearest(
|
auto results = rtree.Nearest(
|
||||||
input_coordinate,
|
input_coordinate,
|
||||||
[this, approach, &input_coordinate, use_all_edges](const CandidateSegment &segment) {
|
[this, approach, &input_coordinate, &bearing_with_range, &use_all_edges](
|
||||||
return boolPairAnd(
|
|
||||||
boolPairAnd(HasValidEdge(segment, use_all_edges), CheckSegmentExclude(segment)),
|
|
||||||
CheckApproach(input_coordinate, segment, approach));
|
|
||||||
},
|
|
||||||
[this, max_distance, input_coordinate](const std::size_t,
|
|
||||||
const CandidateSegment &segment) {
|
const CandidateSegment &segment) {
|
||||||
return CheckSegmentDistance(input_coordinate, segment, max_distance);
|
auto valid = CheckSegmentExclude(segment) &&
|
||||||
|
CheckApproach(input_coordinate, segment, approach) &&
|
||||||
|
(use_all_edges ? HasValidEdge(segment, *use_all_edges)
|
||||||
|
: HasValidEdge(segment)) &&
|
||||||
|
(bearing_with_range ? CheckSegmentBearing(segment, *bearing_with_range)
|
||||||
|
: std::make_pair(true, true));
|
||||||
|
return valid;
|
||||||
|
},
|
||||||
|
[this, &max_distance, &max_results, input_coordinate](const std::size_t num_results,
|
||||||
|
const CandidateSegment &segment) {
|
||||||
|
return (max_results && num_results >= *max_results) ||
|
||||||
|
(max_distance &&
|
||||||
|
CheckSegmentDistance(input_coordinate, segment, *max_distance));
|
||||||
});
|
});
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
return MakePhantomNodes(input_coordinate, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns nearest PhantomNodes in the given bearing range within max_distance.
|
// Returns a list of phantom node candidates from the nearest location that are valid
|
||||||
// Does not filter by small/big component!
|
// within the provided parameters. If there is tie between equidistant locations,
|
||||||
std::vector<PhantomNodeWithDistance>
|
// we only pick candidates from one location.
|
||||||
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
// If candidates do not include a node from a big component, an alternative list of candidates
|
||||||
const double max_distance,
|
// from the nearest location which has nodes from a big component is returned.
|
||||||
const int bearing,
|
PhantomCandidateAlternatives NearestCandidatesWithAlternativeFromBigComponent(
|
||||||
const int bearing_range,
|
const util::Coordinate input_coordinate,
|
||||||
const Approach approach,
|
const Approach approach,
|
||||||
const bool use_all_edges) const
|
const boost::optional<double> max_distance,
|
||||||
|
const boost::optional<Bearing> bearing_with_range,
|
||||||
|
const boost::optional<bool> use_all_edges) const
|
||||||
{
|
{
|
||||||
auto results = rtree.Nearest(
|
bool has_nearest = false;
|
||||||
input_coordinate,
|
|
||||||
[this, approach, &input_coordinate, bearing, bearing_range, use_all_edges](
|
|
||||||
const CandidateSegment &segment) {
|
|
||||||
auto use_direction =
|
|
||||||
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
|
||||||
boolPairAnd(HasValidEdge(segment, use_all_edges),
|
|
||||||
CheckSegmentExclude(segment)));
|
|
||||||
use_direction =
|
|
||||||
boolPairAnd(use_direction, CheckApproach(input_coordinate, segment, approach));
|
|
||||||
return use_direction;
|
|
||||||
},
|
|
||||||
[this, max_distance, input_coordinate](const std::size_t,
|
|
||||||
const CandidateSegment &segment) {
|
|
||||||
return CheckSegmentDistance(input_coordinate, segment, max_distance);
|
|
||||||
});
|
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns max_results nearest PhantomNodes in the given bearing range.
|
|
||||||
// Does not filter by small/big component!
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach) const
|
|
||||||
{
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this, approach, &input_coordinate, bearing, bearing_range](
|
|
||||||
const CandidateSegment &segment) {
|
|
||||||
auto use_direction =
|
|
||||||
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
|
||||||
boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)));
|
|
||||||
return boolPairAnd(use_direction,
|
|
||||||
CheckApproach(input_coordinate, segment, approach));
|
|
||||||
},
|
|
||||||
[max_results](const std::size_t num_results, const CandidateSegment &) {
|
|
||||||
return num_results >= max_results;
|
|
||||||
});
|
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns max_results nearest PhantomNodes in the given bearing range within the maximum
|
|
||||||
// distance.
|
|
||||||
// Does not filter by small/big component!
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const double max_distance,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach) const
|
|
||||||
{
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this, approach, &input_coordinate, bearing, bearing_range](
|
|
||||||
const CandidateSegment &segment) {
|
|
||||||
auto use_direction =
|
|
||||||
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
|
||||||
boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)));
|
|
||||||
return boolPairAnd(use_direction,
|
|
||||||
CheckApproach(input_coordinate, segment, approach));
|
|
||||||
},
|
|
||||||
[this, max_distance, max_results, input_coordinate](const std::size_t num_results,
|
|
||||||
const CandidateSegment &segment) {
|
|
||||||
return num_results >= max_results ||
|
|
||||||
CheckSegmentDistance(input_coordinate, segment, max_distance);
|
|
||||||
});
|
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns max_results nearest PhantomNodes.
|
|
||||||
// Does not filter by small/big component!
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const Approach approach) const
|
|
||||||
{
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this, approach, &input_coordinate](const CandidateSegment &segment) {
|
|
||||||
return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)),
|
|
||||||
CheckApproach(input_coordinate, segment, approach));
|
|
||||||
},
|
|
||||||
[max_results](const std::size_t num_results, const CandidateSegment &) {
|
|
||||||
return num_results >= max_results;
|
|
||||||
});
|
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns max_results nearest PhantomNodes in the given max distance.
|
|
||||||
// Does not filter by small/big component!
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
|
||||||
const unsigned max_results,
|
|
||||||
const double max_distance,
|
|
||||||
const Approach approach) const
|
|
||||||
{
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this, approach, &input_coordinate](const CandidateSegment &segment) {
|
|
||||||
return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)),
|
|
||||||
CheckApproach(input_coordinate, segment, approach));
|
|
||||||
},
|
|
||||||
[this, max_distance, max_results, input_coordinate](const std::size_t num_results,
|
|
||||||
const CandidateSegment &segment) {
|
|
||||||
return num_results >= max_results ||
|
|
||||||
CheckSegmentDistance(input_coordinate, segment, max_distance);
|
|
||||||
});
|
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the nearest phantom node. If this phantom node is not from a big component
|
|
||||||
// a second phantom node is return that is the nearest coordinate in a big component.
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const double max_distance,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const
|
|
||||||
{
|
|
||||||
bool has_small_component = false;
|
|
||||||
bool has_big_component = false;
|
bool has_big_component = false;
|
||||||
|
Coordinate big_component_coord;
|
||||||
|
double big_component_distance = std::numeric_limits<double>::max();
|
||||||
|
Coordinate nearest_coord;
|
||||||
auto results = rtree.Nearest(
|
auto results = rtree.Nearest(
|
||||||
input_coordinate,
|
input_coordinate,
|
||||||
[this,
|
[this,
|
||||||
approach,
|
approach,
|
||||||
&input_coordinate,
|
&input_coordinate,
|
||||||
|
&has_nearest,
|
||||||
&has_big_component,
|
&has_big_component,
|
||||||
&has_small_component,
|
&nearest_coord,
|
||||||
&use_all_edges](const CandidateSegment &segment) {
|
&big_component_coord,
|
||||||
auto use_segment =
|
&big_component_distance,
|
||||||
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
|
&use_all_edges,
|
||||||
auto use_directions = std::make_pair(use_segment, use_segment);
|
&bearing_with_range](const CandidateSegment &segment) {
|
||||||
const auto valid_edges = HasValidEdge(segment, use_all_edges);
|
auto is_big_component = !IsTinyComponent(segment);
|
||||||
const auto admissible_segments = CheckSegmentExclude(segment);
|
auto not_nearest =
|
||||||
use_directions = boolPairAnd(use_directions, admissible_segments);
|
has_nearest && segment.fixed_projected_coordinate != nearest_coord;
|
||||||
use_directions = boolPairAnd(use_directions, valid_edges);
|
auto not_big =
|
||||||
use_directions =
|
has_big_component && segment.fixed_projected_coordinate != big_component_coord;
|
||||||
boolPairAnd(use_directions, CheckApproach(input_coordinate, segment, approach));
|
|
||||||
|
|
||||||
if (use_directions.first || use_directions.second)
|
/**
|
||||||
|
*
|
||||||
|
* Two reasons why we don't want this candidate:
|
||||||
|
* 1. A non-big component candidate that is not at the nearest location
|
||||||
|
* 2. A big component candidate that is not at the big location.
|
||||||
|
*
|
||||||
|
* It's possible that 1. could end up having the same location as the nearest big
|
||||||
|
* component node if we have yet to see one. However, we don't know this and it
|
||||||
|
* could lead to buffering large numbers of candidates before finding the big
|
||||||
|
* component location.
|
||||||
|
* By filtering out 1. nodes, this does mean that the alternative list of
|
||||||
|
* candidates will not have non-big component candidates. Given the alternative
|
||||||
|
* list of big component candidates is meant as a backup choice, this seems
|
||||||
|
* reasonable.
|
||||||
|
*/
|
||||||
|
if ((!is_big_component && not_nearest) || (is_big_component && not_big))
|
||||||
{
|
{
|
||||||
has_big_component = has_big_component || !IsTinyComponent(segment);
|
return std::make_pair(false, false);
|
||||||
has_small_component = has_small_component || IsTinyComponent(segment);
|
}
|
||||||
|
auto use_candidate =
|
||||||
|
CheckSegmentExclude(segment) &&
|
||||||
|
CheckApproach(input_coordinate, segment, approach) &&
|
||||||
|
(use_all_edges ? HasValidEdge(segment, *use_all_edges)
|
||||||
|
: HasValidEdge(segment)) &&
|
||||||
|
(bearing_with_range ? CheckSegmentBearing(segment, *bearing_with_range)
|
||||||
|
: std::make_pair(true, true));
|
||||||
|
|
||||||
|
if (use_candidate.first || use_candidate.second)
|
||||||
|
{
|
||||||
|
if (!has_nearest)
|
||||||
|
{
|
||||||
|
has_nearest = true;
|
||||||
|
nearest_coord = segment.fixed_projected_coordinate;
|
||||||
|
}
|
||||||
|
if (is_big_component && !has_big_component)
|
||||||
|
{
|
||||||
|
has_big_component = true;
|
||||||
|
big_component_coord = segment.fixed_projected_coordinate;
|
||||||
|
big_component_distance = GetSegmentDistance(input_coordinate, segment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return use_directions;
|
return use_candidate;
|
||||||
},
|
},
|
||||||
[this, &has_big_component, max_distance, input_coordinate](
|
[this, &has_big_component, &max_distance, input_coordinate, &big_component_distance](
|
||||||
const std::size_t num_results, const CandidateSegment &segment) {
|
const std::size_t /*num_results*/, const CandidateSegment &segment) {
|
||||||
return (num_results > 0 && has_big_component) ||
|
auto distance = GetSegmentDistance(input_coordinate, segment);
|
||||||
CheckSegmentDistance(input_coordinate, segment, max_distance);
|
auto further_than_big_component = distance > big_component_distance;
|
||||||
|
auto no_more_candidates = has_big_component && further_than_big_component;
|
||||||
|
auto too_far_away = max_distance && distance > *max_distance;
|
||||||
|
|
||||||
|
// Time to terminate the search when:
|
||||||
|
// 1. We've found a node from a big component and the next candidate is further away
|
||||||
|
// than that node.
|
||||||
|
// 2. We're further away from the input then our max allowed distance.
|
||||||
|
return no_more_candidates || too_far_away;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (results.size() == 0)
|
return MakeAlternativeBigCandidates(input_coordinate, nearest_coord, results);
|
||||||
{
|
|
||||||
return std::make_pair(PhantomNode{}, PhantomNode{});
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_ASSERT(results.size() == 1 || results.size() == 2);
|
|
||||||
return std::make_pair(MakePhantomNode(input_coordinate, results.front()).phantom_node,
|
|
||||||
MakePhantomNode(input_coordinate, results.back()).phantom_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the nearest phantom node. If this phantom node is not from a big component
|
|
||||||
// a second phantom node is return that is the nearest coordinate in a big component.
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const
|
|
||||||
{
|
|
||||||
bool has_small_component = false;
|
|
||||||
bool has_big_component = false;
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this,
|
|
||||||
approach,
|
|
||||||
&input_coordinate,
|
|
||||||
&has_big_component,
|
|
||||||
&has_small_component,
|
|
||||||
&use_all_edges](const CandidateSegment &segment) {
|
|
||||||
auto use_segment =
|
|
||||||
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
|
|
||||||
auto use_directions = std::make_pair(use_segment, use_segment);
|
|
||||||
|
|
||||||
const auto valid_edges = HasValidEdge(segment, use_all_edges);
|
|
||||||
const auto admissible_segments = CheckSegmentExclude(segment);
|
|
||||||
use_directions = boolPairAnd(use_directions, admissible_segments);
|
|
||||||
use_directions = boolPairAnd(use_directions, valid_edges);
|
|
||||||
use_directions =
|
|
||||||
boolPairAnd(use_directions, CheckApproach(input_coordinate, segment, approach));
|
|
||||||
|
|
||||||
if (use_directions.first || use_directions.second)
|
|
||||||
{
|
|
||||||
has_big_component = has_big_component || !IsTinyComponent(segment);
|
|
||||||
has_small_component = has_small_component || IsTinyComponent(segment);
|
|
||||||
}
|
|
||||||
|
|
||||||
return use_directions;
|
|
||||||
},
|
|
||||||
[&has_big_component](const std::size_t num_results, const CandidateSegment &) {
|
|
||||||
return num_results > 0 && has_big_component;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (results.size() == 0)
|
|
||||||
{
|
|
||||||
return std::make_pair(PhantomNode{}, PhantomNode{});
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_ASSERT(results.size() == 1 || results.size() == 2);
|
|
||||||
return std::make_pair(MakePhantomNode(input_coordinate, results.front()).phantom_node,
|
|
||||||
MakePhantomNode(input_coordinate, results.back()).phantom_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the nearest phantom node. If this phantom node is not from a big component
|
|
||||||
// a second phantom node is return that is the nearest coordinate in a big component.
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const
|
|
||||||
{
|
|
||||||
bool has_small_component = false;
|
|
||||||
bool has_big_component = false;
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this,
|
|
||||||
approach,
|
|
||||||
&input_coordinate,
|
|
||||||
bearing,
|
|
||||||
bearing_range,
|
|
||||||
&has_big_component,
|
|
||||||
&has_small_component,
|
|
||||||
&use_all_edges](const CandidateSegment &segment) {
|
|
||||||
auto use_segment =
|
|
||||||
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
|
|
||||||
auto use_directions = std::make_pair(use_segment, use_segment);
|
|
||||||
const auto admissible_segments = CheckSegmentExclude(segment);
|
|
||||||
|
|
||||||
if (use_segment)
|
|
||||||
{
|
|
||||||
use_directions =
|
|
||||||
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
|
||||||
HasValidEdge(segment, use_all_edges));
|
|
||||||
use_directions = boolPairAnd(use_directions, admissible_segments);
|
|
||||||
use_directions = boolPairAnd(
|
|
||||||
use_directions, CheckApproach(input_coordinate, segment, approach));
|
|
||||||
|
|
||||||
if (use_directions.first || use_directions.second)
|
|
||||||
{
|
|
||||||
has_big_component = has_big_component || !IsTinyComponent(segment);
|
|
||||||
has_small_component = has_small_component || IsTinyComponent(segment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return use_directions;
|
|
||||||
},
|
|
||||||
[&has_big_component](const std::size_t num_results, const CandidateSegment &) {
|
|
||||||
return num_results > 0 && has_big_component;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (results.size() == 0)
|
|
||||||
{
|
|
||||||
return std::make_pair(PhantomNode{}, PhantomNode{});
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_ASSERT(results.size() > 0);
|
|
||||||
return std::make_pair(MakePhantomNode(input_coordinate, results.front()).phantom_node,
|
|
||||||
MakePhantomNode(input_coordinate, results.back()).phantom_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the nearest phantom node. If this phantom node is not from a big component
|
|
||||||
// a second phantom node is return that is the nearest coordinate in a big component.
|
|
||||||
std::pair<PhantomNode, PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
||||||
const double max_distance,
|
|
||||||
const int bearing,
|
|
||||||
const int bearing_range,
|
|
||||||
const Approach approach,
|
|
||||||
const bool use_all_edges) const
|
|
||||||
{
|
|
||||||
bool has_small_component = false;
|
|
||||||
bool has_big_component = false;
|
|
||||||
auto results = rtree.Nearest(
|
|
||||||
input_coordinate,
|
|
||||||
[this,
|
|
||||||
approach,
|
|
||||||
&input_coordinate,
|
|
||||||
bearing,
|
|
||||||
bearing_range,
|
|
||||||
&has_big_component,
|
|
||||||
&has_small_component,
|
|
||||||
&use_all_edges](const CandidateSegment &segment) {
|
|
||||||
auto use_segment =
|
|
||||||
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
|
|
||||||
auto use_directions = std::make_pair(use_segment, use_segment);
|
|
||||||
const auto admissible_segments = CheckSegmentExclude(segment);
|
|
||||||
|
|
||||||
if (use_segment)
|
|
||||||
{
|
|
||||||
use_directions =
|
|
||||||
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
|
||||||
HasValidEdge(segment, use_all_edges));
|
|
||||||
use_directions = boolPairAnd(use_directions, admissible_segments);
|
|
||||||
use_directions = boolPairAnd(
|
|
||||||
use_directions, CheckApproach(input_coordinate, segment, approach));
|
|
||||||
|
|
||||||
if (use_directions.first || use_directions.second)
|
|
||||||
{
|
|
||||||
has_big_component = has_big_component || !IsTinyComponent(segment);
|
|
||||||
has_small_component = has_small_component || IsTinyComponent(segment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return use_directions;
|
|
||||||
},
|
|
||||||
[this, &has_big_component, max_distance, input_coordinate](
|
|
||||||
const std::size_t num_results, const CandidateSegment &segment) {
|
|
||||||
return (num_results > 0 && has_big_component) ||
|
|
||||||
CheckSegmentDistance(input_coordinate, segment, max_distance);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (results.size() == 0)
|
|
||||||
{
|
|
||||||
return std::make_pair(PhantomNode{}, PhantomNode{});
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_ASSERT(results.size() > 0);
|
|
||||||
return std::make_pair(MakePhantomNode(input_coordinate, results.front()).phantom_node,
|
|
||||||
MakePhantomNode(input_coordinate, results.back()).phantom_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
PhantomCandidateAlternatives
|
||||||
|
MakeAlternativeBigCandidates(const util::Coordinate input_coordinate,
|
||||||
|
const Coordinate nearest_coord,
|
||||||
|
const std::vector<CandidateSegment> &results) const
|
||||||
|
{
|
||||||
|
if (results.size() == 0)
|
||||||
|
{
|
||||||
|
return std::make_pair(PhantomNodeCandidates{}, PhantomNodeCandidates{});
|
||||||
|
}
|
||||||
|
|
||||||
|
PhantomNodeCandidates nearest_phantoms;
|
||||||
|
PhantomNodeCandidates big_component_phantoms;
|
||||||
|
|
||||||
|
const auto add_to_candidates = [this, &input_coordinate](PhantomNodeCandidates &candidates,
|
||||||
|
const EdgeData data) {
|
||||||
|
auto candidate_it =
|
||||||
|
std::find_if(candidates.begin(), candidates.end(), [&](const PhantomNode &node) {
|
||||||
|
return data.forward_segment_id.id == node.forward_segment_id.id &&
|
||||||
|
data.reverse_segment_id.id == node.reverse_segment_id.id;
|
||||||
|
});
|
||||||
|
if (candidate_it == candidates.end())
|
||||||
|
{
|
||||||
|
// First candidate from this segment
|
||||||
|
candidates.push_back(MakePhantomNode(input_coordinate, data).phantom_node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Second candidate from this segment (there can be at most two).
|
||||||
|
* We're snapping at the connection between two edges e1,e2 of the segment.
|
||||||
|
*
|
||||||
|
* | e1 | e2 |
|
||||||
|
* | --- f1 --> | --- f2 --> |
|
||||||
|
* | <-- r1 --- | <-- r2 --- |
|
||||||
|
*
|
||||||
|
* Most of the routing algorithms only support one candidate from each segment.
|
||||||
|
* Therefore, we have to choose between e1 and e2.
|
||||||
|
*
|
||||||
|
* It makes sense to pick one edge over another if that edge offers more
|
||||||
|
* opportunities to act as a source or target for a route.
|
||||||
|
*
|
||||||
|
* For consistency, we use the following logic:
|
||||||
|
* "Pick e1 unless it makes sense to choose e2"
|
||||||
|
*
|
||||||
|
* Representing edge enabled as a truth table:
|
||||||
|
* f1 | r1 | f2 | r2 | selected
|
||||||
|
* ____________________________
|
||||||
|
* t | t | t | t | e1
|
||||||
|
* t | t | t | f | e1
|
||||||
|
* t | t | f | t | e1
|
||||||
|
* t | f | t | t | e2
|
||||||
|
* t | f | t | f | e1
|
||||||
|
* t | f | f | t | e1
|
||||||
|
* f | t | t | t | e2
|
||||||
|
* f | t | t | f | e1
|
||||||
|
* f | t | f | t | e1
|
||||||
|
*
|
||||||
|
* The other rows in truth table don't appear as we discard an edge if both
|
||||||
|
* forward and reverse are disabled.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
if (candidate_it->fwd_segment_position < data.fwd_segment_position)
|
||||||
|
{
|
||||||
|
if (data.forward_segment_id.enabled && data.reverse_segment_id.enabled &&
|
||||||
|
!(candidate_it->forward_segment_id.enabled &&
|
||||||
|
candidate_it->reverse_segment_id.enabled))
|
||||||
|
{
|
||||||
|
*candidate_it = MakePhantomNode(input_coordinate, data).phantom_node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!candidate_it->forward_segment_id.enabled ||
|
||||||
|
!candidate_it->reverse_segment_id.enabled ||
|
||||||
|
(data.forward_segment_id.enabled && data.reverse_segment_id.enabled))
|
||||||
|
{
|
||||||
|
*candidate_it = MakePhantomNode(input_coordinate, data).phantom_node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::for_each(results.begin(), results.end(), [&](const CandidateSegment &segment) {
|
||||||
|
if (segment.fixed_projected_coordinate == nearest_coord)
|
||||||
|
{
|
||||||
|
add_to_candidates(nearest_phantoms, segment.data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Can only be from a big component for the alternative candidates
|
||||||
|
add_to_candidates(big_component_phantoms, segment.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return std::make_pair(std::move(nearest_phantoms), std::move(big_component_phantoms));
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<PhantomNodeWithDistance>
|
std::vector<PhantomNodeWithDistance>
|
||||||
MakePhantomNodes(const util::Coordinate input_coordinate,
|
MakePhantomNodes(const util::Coordinate input_coordinate,
|
||||||
const std::vector<EdgeData> &results) const
|
const std::vector<CandidateSegment> &results) const
|
||||||
{
|
{
|
||||||
std::vector<PhantomNodeWithDistance> distance_and_phantoms(results.size());
|
std::vector<PhantomNodeWithDistance> distance_and_phantoms(results.size());
|
||||||
std::transform(results.begin(),
|
std::transform(results.begin(),
|
||||||
results.end(),
|
results.end(),
|
||||||
distance_and_phantoms.begin(),
|
distance_and_phantoms.begin(),
|
||||||
[this, &input_coordinate](const EdgeData &data) {
|
[this, &input_coordinate](const CandidateSegment &segment) {
|
||||||
return MakePhantomNode(input_coordinate, data);
|
return MakePhantomNode(input_coordinate, segment.data);
|
||||||
});
|
});
|
||||||
return distance_and_phantoms;
|
return distance_and_phantoms;
|
||||||
}
|
}
|
||||||
@ -467,11 +319,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
const auto forward_geometry = datafacade.GetUncompressedForwardGeometry(geometry_id);
|
const auto forward_geometry = datafacade.GetUncompressedForwardGeometry(geometry_id);
|
||||||
|
|
||||||
const auto forward_weight_offset =
|
const auto forward_weight_offset =
|
||||||
|
// NOLINTNEXTLINE(bugprone-fold-init-type)
|
||||||
std::accumulate(forward_weights.begin(),
|
std::accumulate(forward_weights.begin(),
|
||||||
forward_weights.begin() + data.fwd_segment_position,
|
forward_weights.begin() + data.fwd_segment_position,
|
||||||
EdgeWeight{0});
|
EdgeWeight{0});
|
||||||
|
|
||||||
const auto forward_duration_offset =
|
const auto forward_duration_offset =
|
||||||
|
// NOLINTNEXTLINE(bugprone-fold-init-type)
|
||||||
std::accumulate(forward_durations.begin(),
|
std::accumulate(forward_durations.begin(),
|
||||||
forward_durations.begin() + data.fwd_segment_position,
|
forward_durations.begin() + data.fwd_segment_position,
|
||||||
EdgeDuration{0});
|
EdgeDuration{0});
|
||||||
@ -482,7 +336,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
current < forward_geometry.begin() + data.fwd_segment_position;
|
current < forward_geometry.begin() + data.fwd_segment_position;
|
||||||
++current)
|
++current)
|
||||||
{
|
{
|
||||||
forward_distance_offset += util::coordinate_calculation::fccApproximateDistance(
|
forward_distance_offset += util::coordinate_calculation::greatCircleDistance(
|
||||||
datafacade.GetCoordinateOfNode(*current),
|
datafacade.GetCoordinateOfNode(*current),
|
||||||
datafacade.GetCoordinateOfNode(*std::next(current)));
|
datafacade.GetCoordinateOfNode(*std::next(current)));
|
||||||
}
|
}
|
||||||
@ -492,7 +346,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
|
|
||||||
EdgeWeight forward_weight = forward_weights[data.fwd_segment_position];
|
EdgeWeight forward_weight = forward_weights[data.fwd_segment_position];
|
||||||
EdgeDuration forward_duration = forward_durations[data.fwd_segment_position];
|
EdgeDuration forward_duration = forward_durations[data.fwd_segment_position];
|
||||||
EdgeDistance forward_distance = util::coordinate_calculation::fccApproximateDistance(
|
EdgeDistance forward_distance = util::coordinate_calculation::greatCircleDistance(
|
||||||
datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position)),
|
datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position)),
|
||||||
point_on_segment);
|
point_on_segment);
|
||||||
|
|
||||||
@ -512,7 +366,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
current != std::prev(forward_geometry.end());
|
current != std::prev(forward_geometry.end());
|
||||||
++current)
|
++current)
|
||||||
{
|
{
|
||||||
reverse_distance_offset += util::coordinate_calculation::fccApproximateDistance(
|
reverse_distance_offset += util::coordinate_calculation::greatCircleDistance(
|
||||||
datafacade.GetCoordinateOfNode(*current),
|
datafacade.GetCoordinateOfNode(*current),
|
||||||
datafacade.GetCoordinateOfNode(*std::next(current)));
|
datafacade.GetCoordinateOfNode(*std::next(current)));
|
||||||
}
|
}
|
||||||
@ -521,7 +375,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
reverse_weights[reverse_weights.size() - data.fwd_segment_position - 1];
|
reverse_weights[reverse_weights.size() - data.fwd_segment_position - 1];
|
||||||
EdgeDuration reverse_duration =
|
EdgeDuration reverse_duration =
|
||||||
reverse_durations[reverse_durations.size() - data.fwd_segment_position - 1];
|
reverse_durations[reverse_durations.size() - data.fwd_segment_position - 1];
|
||||||
EdgeDistance reverse_distance = util::coordinate_calculation::fccApproximateDistance(
|
EdgeDistance reverse_distance = util::coordinate_calculation::greatCircleDistance(
|
||||||
point_on_segment,
|
point_on_segment,
|
||||||
datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position + 1)));
|
datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position + 1)));
|
||||||
|
|
||||||
@ -578,9 +432,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
return transformed;
|
return transformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckSegmentDistance(const Coordinate input_coordinate,
|
double GetSegmentDistance(const Coordinate input_coordinate,
|
||||||
const CandidateSegment &segment,
|
const CandidateSegment &segment) const
|
||||||
const double max_distance) const
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(segment.data.forward_segment_id.id != SPECIAL_SEGMENTID ||
|
BOOST_ASSERT(segment.data.forward_segment_id.id != SPECIAL_SEGMENTID ||
|
||||||
!segment.data.forward_segment_id.enabled);
|
!segment.data.forward_segment_id.enabled);
|
||||||
@ -590,8 +443,15 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
Coordinate wsg84_coordinate =
|
Coordinate wsg84_coordinate =
|
||||||
util::web_mercator::toWGS84(segment.fixed_projected_coordinate);
|
util::web_mercator::toWGS84(segment.fixed_projected_coordinate);
|
||||||
|
|
||||||
return util::coordinate_calculation::haversineDistance(input_coordinate, wsg84_coordinate) >
|
return util::coordinate_calculation::greatCircleDistance(input_coordinate,
|
||||||
max_distance;
|
wsg84_coordinate);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckSegmentDistance(const Coordinate input_coordinate,
|
||||||
|
const CandidateSegment &segment,
|
||||||
|
const double max_distance) const
|
||||||
|
{
|
||||||
|
return GetSegmentDistance(input_coordinate, segment) > max_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<bool, bool> CheckSegmentExclude(const CandidateSegment &segment) const
|
std::pair<bool, bool> CheckSegmentExclude(const CandidateSegment &segment) const
|
||||||
@ -614,8 +474,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::pair<bool, bool> CheckSegmentBearing(const CandidateSegment &segment,
|
std::pair<bool, bool> CheckSegmentBearing(const CandidateSegment &segment,
|
||||||
const int filter_bearing,
|
const Bearing filter_bearing) const
|
||||||
const int filter_bearing_range) const
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(segment.data.forward_segment_id.id != SPECIAL_SEGMENTID ||
|
BOOST_ASSERT(segment.data.forward_segment_id.id != SPECIAL_SEGMENTID ||
|
||||||
!segment.data.forward_segment_id.enabled);
|
!segment.data.forward_segment_id.enabled);
|
||||||
@ -631,11 +490,11 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
|
|
||||||
const bool forward_bearing_valid =
|
const bool forward_bearing_valid =
|
||||||
util::bearing::CheckInBounds(
|
util::bearing::CheckInBounds(
|
||||||
std::round(forward_edge_bearing), filter_bearing, filter_bearing_range) &&
|
std::round(forward_edge_bearing), filter_bearing.bearing, filter_bearing.range) &&
|
||||||
segment.data.forward_segment_id.enabled;
|
segment.data.forward_segment_id.enabled;
|
||||||
const bool backward_bearing_valid =
|
const bool backward_bearing_valid =
|
||||||
util::bearing::CheckInBounds(
|
util::bearing::CheckInBounds(
|
||||||
std::round(backward_edge_bearing), filter_bearing, filter_bearing_range) &&
|
std::round(backward_edge_bearing), filter_bearing.bearing, filter_bearing.range) &&
|
||||||
segment.data.reverse_segment_id.enabled;
|
segment.data.reverse_segment_id.enabled;
|
||||||
return std::make_pair(forward_bearing_valid, backward_bearing_valid);
|
return std::make_pair(forward_bearing_valid, backward_bearing_valid);
|
||||||
}
|
}
|
||||||
@ -643,7 +502,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
/**
|
/**
|
||||||
* Checks to see if the edge weights are valid. We might have an edge,
|
* Checks to see if the edge weights are valid. We might have an edge,
|
||||||
* but a traffic update might set the speed to 0 (weight == INVALID_SEGMENT_WEIGHT).
|
* but a traffic update might set the speed to 0 (weight == INVALID_SEGMENT_WEIGHT).
|
||||||
* which means that this edge is not currently traversible. If this is the case,
|
* which means that this edge is not currently traversable. If this is the case,
|
||||||
* then we shouldn't snap to this edge.
|
* then we shouldn't snap to this edge.
|
||||||
*/
|
*/
|
||||||
std::pair<bool, bool> HasValidEdge(const CandidateSegment &segment,
|
std::pair<bool, bool> HasValidEdge(const CandidateSegment &segment,
|
||||||
@ -680,7 +539,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
bool IsTinyComponent(const CandidateSegment &segment) const
|
bool IsTinyComponent(const CandidateSegment &segment) const
|
||||||
{
|
{
|
||||||
const auto &data = segment.data;
|
const auto &data = segment.data;
|
||||||
BOOST_ASSERT(data.forward_segment_id.enabled);
|
BOOST_ASSERT(data.forward_segment_id.enabled || data.reverse_segment_id.enabled);
|
||||||
BOOST_ASSERT(data.forward_segment_id.id != SPECIAL_NODEID);
|
BOOST_ASSERT(data.forward_segment_id.id != SPECIAL_NODEID);
|
||||||
return datafacade.GetComponentID(data.forward_segment_id.id).is_tiny;
|
return datafacade.GetComponentID(data.forward_segment_id.id).is_tiny;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,8 +57,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||||
const auto source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id);
|
const auto source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id);
|
||||||
|
|
||||||
geometry.osm_node_ids.push_back(
|
geometry.node_ids.push_back(source_geometry(source_segment_start_coordinate));
|
||||||
facade.GetOSMNodeIDOfNode(source_geometry(source_segment_start_coordinate)));
|
|
||||||
|
|
||||||
auto cumulative_distance = 0.;
|
auto cumulative_distance = 0.;
|
||||||
auto current_distance = 0.;
|
auto current_distance = 0.;
|
||||||
@ -67,11 +66,14 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
{
|
{
|
||||||
auto coordinate = facade.GetCoordinateOfNode(path_point.turn_via_node);
|
auto coordinate = facade.GetCoordinateOfNode(path_point.turn_via_node);
|
||||||
current_distance =
|
current_distance =
|
||||||
util::coordinate_calculation::haversineDistance(prev_coordinate, coordinate);
|
util::coordinate_calculation::greatCircleDistance(prev_coordinate, coordinate);
|
||||||
cumulative_distance += current_distance;
|
cumulative_distance += current_distance;
|
||||||
|
|
||||||
// all changes to this check have to be matched with assemble_steps
|
// all changes to this check have to be matched with assemble_steps
|
||||||
if (path_point.turn_instruction.type != osrm::guidance::TurnType::NoTurn)
|
auto turn_instruction = path_point.turn_edge
|
||||||
|
? facade.GetTurnInstructionForEdgeID(*path_point.turn_edge)
|
||||||
|
: osrm::guidance::TurnInstruction::NO_TURN();
|
||||||
|
if (turn_instruction.type != osrm::guidance::TurnType::NoTurn)
|
||||||
{
|
{
|
||||||
geometry.segment_distances.push_back(cumulative_distance);
|
geometry.segment_distances.push_back(cumulative_distance);
|
||||||
geometry.segment_offsets.push_back(geometry.locations.size());
|
geometry.segment_offsets.push_back(geometry.locations.size());
|
||||||
@ -79,11 +81,10 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prev_coordinate = coordinate;
|
prev_coordinate = coordinate;
|
||||||
|
const auto node_id = path_point.turn_via_node;
|
||||||
|
|
||||||
const auto osm_node_id = facade.GetOSMNodeIDOfNode(path_point.turn_via_node);
|
if (node_id != geometry.node_ids.back() ||
|
||||||
|
turn_instruction.type != osrm::guidance::TurnType::NoTurn)
|
||||||
if (osm_node_id != geometry.osm_node_ids.back() ||
|
|
||||||
path_point.turn_instruction.type != osrm::guidance::TurnType::NoTurn)
|
|
||||||
{
|
{
|
||||||
geometry.annotations.emplace_back(LegGeometry::Annotation{
|
geometry.annotations.emplace_back(LegGeometry::Annotation{
|
||||||
current_distance,
|
current_distance,
|
||||||
@ -98,12 +99,12 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
(path_point.weight_until_turn - path_point.weight_of_turn) /
|
(path_point.weight_until_turn - path_point.weight_of_turn) /
|
||||||
facade.GetWeightMultiplier(),
|
facade.GetWeightMultiplier(),
|
||||||
path_point.datasource_id});
|
path_point.datasource_id});
|
||||||
geometry.locations.push_back(std::move(coordinate));
|
geometry.locations.push_back(coordinate);
|
||||||
geometry.osm_node_ids.push_back(osm_node_id);
|
geometry.node_ids.push_back(node_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current_distance =
|
current_distance =
|
||||||
util::coordinate_calculation::haversineDistance(prev_coordinate, target_node.location);
|
util::coordinate_calculation::greatCircleDistance(prev_coordinate, target_node.location);
|
||||||
cumulative_distance += current_distance;
|
cumulative_distance += current_distance;
|
||||||
// segment leading to the target node
|
// segment leading to the target node
|
||||||
geometry.segment_distances.push_back(cumulative_distance);
|
geometry.segment_distances.push_back(cumulative_distance);
|
||||||
@ -158,8 +159,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
const auto target_segment_end_coordinate =
|
const auto target_segment_end_coordinate =
|
||||||
target_node.fwd_segment_position + (reversed_target ? 0 : 1);
|
target_node.fwd_segment_position + (reversed_target ? 0 : 1);
|
||||||
const auto target_geometry = facade.GetUncompressedForwardGeometry(target_geometry_id);
|
const auto target_geometry = facade.GetUncompressedForwardGeometry(target_geometry_id);
|
||||||
geometry.osm_node_ids.push_back(
|
geometry.node_ids.push_back(target_geometry(target_segment_end_coordinate));
|
||||||
facade.GetOSMNodeIDOfNode(target_geometry(target_segment_end_coordinate)));
|
|
||||||
|
|
||||||
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
|
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
|
||||||
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());
|
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user