Compare commits

..

10 Commits

Author SHA1 Message Date
allierowan 9234b2ae76 remove line from changelog about commit that isn't actually in here 2018-12-05 15:29:06 -05:00
allierowan 8b5ade3861 5.20.0 2018-12-05 14:43:21 -05:00
Kajari Ghosh baa8214270 bump rc version 2018-12-05 00:44:44 -05:00
Kajari Ghosh d41b03b778 Fix fallback_speed vector access (#5291)
* add failing cuke test

* correctly access durations vector

* changelog

* one more cuke test
2018-12-05 00:43:16 -05:00
Kajari Ghosh 31d8ff7a74 bump version to rc5 2018-12-04 14:19:23 -05:00
Daniel Paz-Soldan cb2532d0da Add node 10 builds to travis (#5246)
* Add node 10 builds to travis

* Add changelog
2018-12-04 14:18:31 -05:00
Kajari Ghosh e222fcfb17 remove destination/sources length <= coordinates length check (#5289) 2018-12-04 14:17:13 -05:00
Daniel Patterson 7a5b6dbede Bump version. 2018-11-02 01:43:15 -07:00
Daniel Patterson c08953c0e6 Merge branch 'master' into 5.20 2018-11-02 01:42:30 -07:00
Daniel Patterson e5a6c73fdf Prepare RC.1 2018-10-30 16:17:14 -07:00
78 changed files with 10960 additions and 5056 deletions
-4
View File
@@ -68,10 +68,6 @@ Thumbs.db
/*.local.bat
/CMakeSettings.json
# Jetbrains related files #
###########################
.idea/
# stxxl related files #
#######################
.stxxl
+71 -142
View File
@@ -13,11 +13,12 @@ notifications:
branches:
only:
- master
- "5.20"
# enable building tags
- /^v\d+\.\d+(\.\d+)?(\+[^-]+)?(-\S*)?$/
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
cache:
npm: true
yarn: true
ccache: true
apt: true
directories:
@@ -34,11 +35,7 @@ env:
- CMAKE_VERSION=3.7.2
- MASON="$(pwd)/scripts/mason.sh"
- ENABLE_NODE_BINDINGS=On
- NODE="10"
stages:
- core
- optional
- NODE="4"
matrix:
fast_finish: true
@@ -47,19 +44,18 @@ matrix:
include:
# Debug Builds
- stage: core
os: linux
- os: linux
compiler: "format-taginfo-docs"
env: NODE=10
env: NODE=6
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
- npm install --ignore-scripts
- npm link --ignore-scripts
script:
- ./scripts/check_taginfo.py taginfo.json profiles/car.lua
- ${MASON} install clang-format 3.8.1
@@ -175,6 +171,14 @@ matrix:
after_success:
- ./scripts/travis/publish.sh
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-4"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="4"
after_success:
- ./scripts/travis/publish.sh
# Shared Library
- os: linux
compiler: "gcc-7-release-shared"
@@ -185,6 +189,54 @@ matrix:
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-4-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4"
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-4-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4"
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-8-mason-linux-release"
@@ -281,135 +333,7 @@ matrix:
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
@@ -427,10 +351,15 @@ before_install:
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
sudo mdutil -i off /
fi
- |
if [[ ! -f $(which yarn) ]]; then
npm install -g yarn@1.11.1
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
- yarn install --ignore-scripts
- yarn check --ignore-scripts --integrity
# 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}"
@@ -509,4 +438,4 @@ script:
fi
- |
- popd
- npm test
- yarn test
-29
View File
@@ -1,30 +1,3 @@
# Unreleased
- Changes from 5.21.0
- Build:
- ADDED: optionally build Node `lts` and `latest` bindings [#5347](https://github.com/Project-OSRM/osrm-backend/pull/5347)
- Features:
- ADDED: new waypoints parameter to the `route` plugin, enabling silent waypoints [#5345](https://github.com/Project-OSRM/osrm-backend/pull/5345)
- ADDED: data timestamp information in the response (saved in new file `.osrm.timestamp`). [#5115](https://github.com/Project-OSRM/osrm-backend/issues/5115)
# 5.21.0
- Changes from 5.20.0
- Features:
- ADDED: all waypoints in responses now contain a distance property between the original coordinate and the snapped location. [#5255](https://github.com/Project-OSRM/osrm-backend/pull/5255)
- ADDED: if `fallback_speed` is used, a new structure `fallback_speed_cells` will describe which cells contain estimated values [#5259](https://github.com/Project-OSRM/osrm-backend/pull/5259)
- REMOVED: we no longer publish Node 4 or 6 binary modules (they are still buildable from source) [#5314](https://github.com/Project-OSRM/osrm-backend/pull/5314)
- Table:
- ADDED: new parameter `scale_factor` which will scale the cell `duration` values by this factor. [#5298](https://github.com/Project-OSRM/osrm-backend/pull/5298)
- FIXED: only trigger `scale_factor` code to scan matrix when necessary. [#5303](https://github.com/Project-OSRM/osrm-backend/pull/5303)
- FIXED: fix bug in reverse offset calculation that sometimes lead to negative (and other incorrect) values in distance table results [#5315](https://github.com/Project-OSRM/osrm-backend/pull/5315)
- Docker:
- FIXED: use consistent boost version between build and runtime [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311)
- FIXED: don't override default permissions on /opt [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311)
- Matching:
- CHANGED: matching will now consider edges marked with is_startpoint=false, allowing matching over ferries and other previously non-matchable edge types. [#5297](https://github.com/Project-OSRM/osrm-backend/pull/5297)
- Profile:
- ADDED: Parse `source:maxspeed` and `maxspeed:type` tags to apply maxspeeds and add belgian flanders rural speed limit. [#5217](https://github.com/Project-OSRM/osrm-backend/pull/5217)
- CHANGED: Refactor maxspeed parsing to use common library. [#5144](https://github.com/Project-OSRM/osrm-backend/pull/5144)
# 5.20.0
- Changes from 5.19.0:
- Table:
@@ -38,8 +11,6 @@
- ADDED: Now publishing Node 10.x LTS binary modules [#5246](https://github.com/Project-OSRM/osrm-backend/pull/5246)
- Windows:
- FIXED: Windows builds again. [#5249](https://github.com/Project-OSRM/osrm-backend/pull/5249)
- Docker:
- CHANGED: switch from Alpine Linux to Debian Buster base images [#5281](https://github.com/Project-OSRM/osrm-backend/pull/5281)
# 5.19.0
- Changes from 5.18.0:
+1 -1
View File
@@ -50,7 +50,7 @@ If you want to use the CH pipeline instead replace `osrm-partition` and `osrm-cu
### Using Docker
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Debian and make sure they are as lightweight as possible.
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
Download OpenStreetMap extracts for example from [Geofabrik](http://download.geofabrik.de/)
+1 -1
View File
@@ -11,7 +11,7 @@ SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "FALSE")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Source Routing Machine (OSRM) is a high-performance routing engine. It combines sophisticated routing algorithms with the open and free data of the OpenStreetMap.")
SET(CPACK_PACKAGE_CONTACT "Project OSRM <info@project-osrm.org>")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.TXT")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENCE.TXT")
SET(CPACK_STRIP_FILES "TRUE")
file(GLOB_RECURSE ProfileGlob ${CMAKE_SOURCE_DIR}/profiles/*)
+15 -19
View File
@@ -1,14 +1,16 @@
FROM debian:stretch-slim as builder
FROM alpine:3.6 as buildstage
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src && mkdir -p /opt
COPY . /src
WORKDIR /src
RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} && \
apt-get update && \
apt-get -y --no-install-recommends install cmake make git gcc g++ libbz2-dev libxml2-dev \
libzip-dev libboost1.62-all-dev lua5.2 liblua5.2-dev libtbb-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 && \
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.2-dev libtbb@testing libtbb-dev@testing && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
@@ -24,26 +26,20 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null ||
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
\
strip /usr/local/bin/* && \
rm -rf /src /usr/local/lib/libosrm*
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM debian:stretch-slim as runstage
FROM alpine:3.6 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 /opt /opt
RUN /usr/local/bin/osrm-extract --help && \
/usr/local/bin/osrm-routed --help && \
/usr/local/bin/osrm-contract --help && \
/usr/local/bin/osrm-partition --help && \
/usr/local/bin/osrm-customize --help
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.2 expat libtbb@testing
COPY --from=buildstage /usr/local /usr/local
COPY --from=buildstage /opt /opt
WORKDIR /opt
EXPOSE 5000
+1 -1
View File
@@ -6,4 +6,4 @@
# ensure that "COPY . /src" is referring to the repo root, not the directory
# that contains the Dockerfile.
# This script gets executed with a pwd of wherever the Dockerfile is.
docker build --build-arg BUILD_CONCURRENCY=${CONCURRENCY:-1} --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..
docker build --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..
+4 -19
View File
@@ -70,8 +70,6 @@ curl 'http://router.project-osrm.org/route/v1/driving/polyline(ofp_Ik_vpAilAyu@t
### Responses
#### Code
Every response object has a `code` property containing one of the strings below or a service dependent code:
| Type | Description |
@@ -89,17 +87,12 @@ Every response object has a `code` property containing one of the strings below
- `message` is a **optional** human-readable error message. All other status types are service dependent.
- In case of an error the HTTP status code will be `400`. Otherwise the HTTP status code will be `200` and `code` will be `Ok`.
#### Data version
Every response object has a `data_version` propetry containing timestamp from the original OpenStreetMap file. This field is optional. It can be ommited if data_version parametr was not set on osrm-extract stage or OSM file has not `osmosis_replication_timestamp` section.
#### Example response
```json
{
"code": "Ok",
"message": "Everything worked",
"data_version": "2017-11-17T21:43:02Z"
"message": "Everything worked"
}
```
@@ -126,6 +119,7 @@ In addition to the [general options](#general-options) the following options are
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `waypoints` array of `Waypoint` objects sorted by distance to the input coordinate. Each object has at least the following additional properties:
- `distance`: Distance in meters to the supplied input coordinate.
- `nodes`: Array of OpenStreetMap node ids.
#### Example Requests
@@ -202,7 +196,6 @@ In addition to the [general options](#general-options) the following options are
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
|waypoints | `{index};{index};{index}...` |Treats input coordinates indicated by given indices as waypoints in returned Match object. Default is to treat all input coordinates as waypoints. |
\* Please note that even if alternative routes are requested, a result cannot be guaranteed.
@@ -243,10 +236,9 @@ In addition to the [general options](#general-options) the following options are
|------------|--------------------------------------------------|---------------------------------------------|
|sources |`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as source. |
|destinations|`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as destination.|
|annotations |`duration` (default), `distance`, or `duration,distance`|Return the requested table or tables in response. |
|fallback_speed|`double > 0`| If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration.|
|annotations |`duration` (default), `distance`, or `duration,distance`|Return the requested table or tables in response. Note that computing the `distances` table is currently only implemented for CH. If `annotations=distance` or `annotations=duration,distance` is requested when running a MLD router, a `NotImplemented` error will be returned. |
|fallback_speed|`double > 0`|If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration.|
|fallback_coordinate|`input` (default), or `snapped`| When using a `fallback_speed`, use the user-supplied coordinate (`input`), or the snapped location (`snapped`) for calculating distances.|
|scale_factor|`double > 0`| Use in conjunction with `annotations=durations`. Scales the table `duration` values by this number.|
Unlike other array encoded options, the length of `sources` and `destinations` can be **smaller or equal**
to number of input locations;
@@ -292,7 +284,6 @@ curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397
the i-th waypoint to the j-th waypoint. Values are given in meters. Can be `null` if no route between `i` and `j` can be found. Note that computing the `distances` table is currently only implemented for CH. If `annotations=distance` or `annotations=duration,distance` is requested when running a MLD router, a `NotImplemented` error will be returned.
- `sources` array of `Waypoint` objects describing all sources in order
- `destinations` array of `Waypoint` objects describing all destinations in order
- `fallback_speed_cells` (optional) array of arrays containing `i,j` pairs indicating which cells contain estimated values based on `fallback_speed`. Will be absent if `fallback_speed` is not used.
In case of error the following `code`s are supported in addition to the general ones:
@@ -393,10 +384,6 @@ All other properties might be undefined.
2361.73,
0
]
],
"fallback_speed_cells": [
[ 0, 1 ],
[ 1, 0 ]
]
}
```
@@ -565,7 +552,6 @@ Vector tiles contain two layers:
| `weight ` | `integer` | how long this segment takes to traverse, in units (may differ from `duration` when artificial biasing is applied in the Lua profiles). ACTUAL ROUTING USES THIS VALUE. |
| `name` | `string` | the name of the road this segment belongs to |
| `rate` | `float` | the value of `length/weight` - analagous to `speed`, but using the `weight` value rather than `duration`, rounded to the nearest integer |
| `is_startpoint` | `boolean` | whether this segment can be used as a start/endpoint for routes |
`turns` layer:
@@ -920,7 +906,6 @@ Object used to describe waypoint on a route.
- `name` Name of the street the coordinate snapped to
- `location` Array that contains the `[longitude, latitude]` pair of the snapped coordinate
- `distance` The distance, in metres, from the input coordinate to the snapped coordinate
- `hint` Unique internal identifier of the segment (ephemeral, not constant over data updates)
This can be used on subsequent request to significantly speed up the query and to connect multiple services.
E.g. you can use the `hint` value obtained by the `nearest` query as `hint` values for `route` inputs.
-4
View File
@@ -57,7 +57,6 @@ Returns the fastest route between two or more coordinates while visiting the way
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `options.waypoints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
`null`/`true`/`false`
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
@@ -132,7 +131,6 @@ tables. Optionally returns distance table.
- `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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies diestance between two points.
- `options.scale_factor` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
@@ -158,7 +156,6 @@ Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer
Values are given in seconds.
**`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order.
**`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order.
**`fallback_speed_cells`**: (optional) if `fallback_speed` is used, will be an array of arrays of `row,column` values, indicating which cells contain estimated values.
### tile
@@ -211,7 +208,6 @@ if they can not be matched successfully.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`.
- `options.gaps` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore` (optional, default `split`).
- `options.tidy` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Allows the input track modification to obtain better matching quality for noisy tracks (optional, default `false`).
- `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.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
-9
View File
@@ -109,12 +109,3 @@ Feature: Car - Handle ferry routes
When I route I should get
| from | to | route | modes | time |
| c | d | bcde,bcde | ferry,ferry | 600s |
Given the query options
| geometries | geojson |
| overview | full |
# Note that matching *should* work across unsnappable ferries
When I match I should get
| trace | geometry | duration |
| abcdef| 1,1,1.000899,1,1.000899,1,1.002697,1,1.002697,1,1.003596,1,1.003596,1,1.005394,1,1.005394,1,1.006293,1 | 610.9 |
-25
View File
@@ -137,28 +137,3 @@ OSRM will use 4/5 of the projected free-flow speed.
| primary | | | 30 | -1 | | 23 km/h | | 6.7 |
| primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 |
| primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 |
Scenario: Car - Respect source:maxspeed
Given the node map
"""
a b c d e f g
"""
And the ways
| nodes | highway | source:maxspeed | maxspeed |
| ab | trunk | | |
| bc | trunk | | 60 |
| cd | trunk | FR:urban | |
| de | trunk | CH:rural | |
| ef | trunk | CH:trunk | |
| fg | trunk | CH:motorway | |
When I route I should get
| from | to | route | speed |
| a | b | ab,ab | 85 km/h |
| b | c | bc,bc | 48 km/h |
| c | d | cd,cd | 40 km/h |
| d | e | de,de | 64 km/h |
| e | f | ef,ef | 80 km/h |
| f | g | fg,fg | 96 km/h |
-20
View File
@@ -35,23 +35,3 @@ Feature: Car - Allowed start/end modes
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
Scenario: Car - URL override of non-startpoints
Given the node map
"""
a 1 b c 2 d
"""
Given the query options
| snapping | any |
And the ways
| nodes | highway | access |
| ab | service | private |
| bc | primary | |
| cd | service | private |
When I route I should get
| from | to | route |
| 1 | 2 | ab,bc,cd |
| 2 | 1 | cd,bc,ab |
+1 -1
View File
@@ -295,7 +295,7 @@ module.exports = function () {
this.reprocess(callback);
});
this.Given(/^osrm-routed is stopped$/, (callback) => {
this.Given(/^osrm\-routed is stopped$/, (callback) => {
this.OSRMLoader.shutdown(callback);
});
+7 -25
View File
@@ -3,25 +3,22 @@ var util = require('util');
module.exports = function () {
const durationsRegex = new RegExp(/^I request a travel time matrix I should get$/);
const distancesRegex = new RegExp(/^I request a travel distance matrix I should get$/);
const estimatesRegex = new RegExp(/^I request a travel time matrix I should get estimates for$/);
const DURATIONS_NO_ROUTE = 2147483647; // MAX_INT
const DISTANCES_NO_ROUTE = 3.40282e+38; // MAX_FLOAT
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', callback);}.bind(this));
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', callback);}.bind(this));
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', callback);}.bind(this));
};
const durationsParse = function(v) { return isNaN(parseInt(v)); };
const distancesParse = function(v) { return isNaN(parseFloat(v)); };
const estimatesParse = function(v) { return isNaN(parseFloat(v)); };
function tableParse(table, noRoute, annotation, callback) {
const parse = annotation == 'distances' ? distancesParse : (annotation == 'durations' ? durationsParse : estimatesParse);
const parse = annotation == 'distances' ? distancesParse : durationsParse;
const params = this.queryParams;
params.annotations = ['durations','fallback_speed_cells'].indexOf(annotation) !== -1 ? 'duration' : 'distance';
params.annotations = annotation == 'distances' ? 'distance' : 'duration';
var tableRows = table.raw();
@@ -64,26 +61,11 @@ function tableParse(table, noRoute, annotation, callback) {
var json = JSON.parse(response.body);
var result = {};
if (annotation === 'fallback_speed_cells') {
result = table.raw().map(row => row.map(() => ''));
json[annotation].forEach(pair => {
result[pair[0]+1][pair[1]+1] = 'Y';
});
result = result.slice(1).map(row => {
var hashes = {};
row.slice(1).forEach((v,i) => {
hashes[tableRows[0][i+1]] = v;
});
return hashes;
});
} else {
result = json[annotation].map(row => {
var hashes = {};
row.forEach((v, i) => { hashes[tableRows[0][i+1]] = parse(v) ? '' : v; });
return hashes;
});
}
var result = json[annotation].map(row => {
var hashes = {};
row.forEach((v, i) => { hashes[tableRows[0][i+1]] = parse(v) ? '' : v; });
return hashes;
});
var testRow = (row, ri, cb) => {
for (var k in result[ri]) {
+6 -6
View File
@@ -21,11 +21,11 @@ module.exports = function () {
});
};
this.When(/^I run "osrm-routed\s?(.*?)"$/, { timeout: this.TIMEOUT }, (options, callback) => {
this.When(/^I run "osrm\-routed\s?(.*?)"$/, { timeout: this.TIMEOUT }, (options, callback) => {
this.runAndSafeOutput('osrm-routed', options, callback);
});
this.When(/^I run "osrm-(extract|contract|partition|customize)\s?(.*?)"$/, (binary, options, callback) => {
this.When(/^I run "osrm\-(extract|contract|partition|customize)\s?(.*?)"$/, (binary, options, callback) => {
const stamp = this.processedCacheFile + '.stamp_' + binary;
this.runAndSafeOutput('osrm-' + binary, options, (err) => {
if (err) return callback(err);
@@ -33,11 +33,11 @@ module.exports = function () {
});
});
this.When(/^I try to run "(osrm-[a-z]+)\s?(.*?)"$/, (binary, options, callback) => {
this.When(/^I try to run "(osrm\-[a-z]+)\s?(.*?)"$/, (binary, options, callback) => {
this.runAndSafeOutput(binary, options, () => { callback(); });
});
this.When(/^I run "osrm-datastore\s?(.*?)"(?: with input "([^"]*)")?$/, (options, input, callback) => {
this.When(/^I run "osrm\-datastore\s?(.*?)"(?: with input "([^"]*)")?$/, (options, input, callback) => {
let child = this.runAndSafeOutput('osrm-datastore', options, callback);
if (input !== undefined)
child.stdin.write(input);
@@ -55,13 +55,13 @@ module.exports = function () {
this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => {
const contains = this.stdout.indexOf(str) > -1;
assert.ok(typeof not === 'undefined' ? contains : !contains,
'stdout ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
'stdout ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
});
this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => {
const contains = this.stderr.indexOf(str) > -1;
assert.ok(typeof not === 'undefined' ? contains : !contains,
'stderr ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
'stderr ' + (typeof not === 'undefined' ? 'does not contain' : 'contains') + ' "' + str + '"');
});
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
+1 -1
View File
@@ -69,7 +69,7 @@ module.exports = function () {
outputRow[direction] = result[direction].status ?
'x' : '';
break;
case /^[\d.]+ s/.test(want):
case /^[\d\.]+ s/.test(want):
// the result here can come back as a non-number value like
// `diff`, but we only want to apply the unit when it comes
// back as a number, for tableDiff's literal comparison
+7 -7
View File
@@ -29,7 +29,7 @@ module.exports = function() {
// setup cache for feature data
// if OSRM_PROFILE is set to force a specific profile, then
// include the profile name in the hash of the profile file
// include the profile name in the hash of the profile file
hash.hashOfFile(uri, this.OSRM_PROFILE, (err, hash) => {
if (err) return callback(err);
@@ -45,10 +45,10 @@ module.exports = function() {
this.featureProcessedCacheDirectories[uri] = featureProcessedCacheDirectory;
d3.queue(1)
.defer(mkdirp, featureProcessedCacheDirectory)
.defer(this.cleanupFeatureCache.bind(this), featureCacheDirectory, hash)
.defer(this.cleanupProcessedFeatureCache.bind(this), featureProcessedCacheDirectory, this.osrmHash)
.awaitAll(callback);
.defer(mkdirp, featureProcessedCacheDirectory)
.defer(this.cleanupFeatureCache.bind(this), featureCacheDirectory, hash)
.defer(this.cleanupProcessedFeatureCache.bind(this), featureProcessedCacheDirectory, this.osrmHash)
.awaitAll(callback);
});
}
@@ -87,7 +87,7 @@ module.exports = function() {
fs.readdir(parentPath, (err, files) => {
let q = d3.queue();
files.filter(name => { return name !== featureHash;})
.map((f) => { q.defer(rimraf, path.join(parentPath, f)); });
.map((f) => { q.defer(rimraf, path.join(parentPath, f)); });
q.awaitAll(callback);
});
};
@@ -145,7 +145,7 @@ module.exports = function() {
// converts the scenario titles in file prefixes
this.getScenarioID = (scenario) => {
let name = scenario.getName().toLowerCase().replace(/[/\-'=,():*#]/g, '')
let name = scenario.getName().toLowerCase().replace(/[\/\-'=,\(\):\*#]/g, '')
.replace(/\s/g, '_').replace(/__/g, '_').replace(/\.\./g, '.')
.substring(0, 64);
return util.format('%d_%s', scenario.getLine(), name);
+10 -10
View File
@@ -17,12 +17,12 @@ module.exports = {
return true;
var matchPercent = want.match(/(.*)\s+~(.+)%$/),
matchAbs = want.match(/(.*)\s+\+-(.+)$/),
matchAbs = want.match(/(.*)\s+\+\-(.+)$/),
matchRe = want.match(/^\/(.*)\/$/),
// we use this for matching before/after bearing
matchBearingListAbs = want.match(/^((\d+)->(\d+))(,(\d+)->(\d+))*\s+\+-(.+)$/),
matchIntersectionListAbs = want.match(/^(((((true|false):\d+)\s{0,1})+,{0,1})+;{0,1})+\s+\+-(.+)$/),
matchRangeNumbers = want.match(/\d+\+-\d+/);
matchBearingListAbs = want.match(/^((\d+)->(\d+))(,(\d+)->(\d+))*\s+\+\-(.+)$/),
matchIntersectionListAbs = want.match(/^(((((true|false):\d+)\s{0,1})+,{0,1})+;{0,1})+\s+\+\-(.+)$/),
matchRangeNumbers = want.match(/\d+\+\-\d+/);
function inRange(margin, got, want) {
var fromR = parseFloat(want) - margin,
@@ -31,12 +31,12 @@ module.exports = {
}
function parseIntersectionString(str) {
return str.split(';')
.map((turn_intersections) => turn_intersections
.split(',')
.map((intersection) => intersection
.split(' ')
.map((entry_bearing_pair) => entry_bearing_pair
.split(':'))));
.map((turn_intersections) => turn_intersections
.split(',')
.map((intersection) => intersection
.split(' ')
.map((entry_bearing_pair) => entry_bearing_pair
.split(':'))));
}
if (got === want) {
+2 -6
View File
@@ -75,10 +75,6 @@ module.exports = function () {
got.message = json.message || '';
}
if (headers.has('data_version')) {
got.data_version = json.data_version || '';
}
if (headers.has('#')) {
// comment column
got['#'] = row['#'];
@@ -119,7 +115,7 @@ module.exports = function () {
if (headers.has('weight')) {
if (row.weight.length) {
if (!row.weight.match(/[\d.]+/))
if (!row.weight.match(/[\d\.]+/))
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
got.weight = instructions ? util.format('%d', weight) : '';
} else {
@@ -155,7 +151,7 @@ module.exports = function () {
if (headers.has('locations')){
got.locations = (locations || '').trim();
}
/*
/*
if (headers.has('approaches')){
got.approaches = (approaches || '').trim();
}*/
+3 -20
View File
@@ -17,26 +17,9 @@ Feature: Basic Routing
| ab |
When I route I should get
| from | to | route | data_version |
| a | b | ab,ab | |
| b | a | ab,ab | |
Scenario: Data_version test
Given the node map
"""
a b
"""
And the extract extra arguments "--data_version cucumber_data_version"
And the ways
| nodes |
| ab |
When I route I should get
| from | to | route | data_version |
| a | b | ab,ab | cucumber_data_version |
| b | a | ab,ab | cucumber_data_version |
| from | to | route |
| a | b | ab,ab |
| b | a | ab,ab |
Scenario: Routing in between two nodes of way
Given the node map
+33 -44
View File
@@ -596,6 +596,7 @@ Feature: Basic Distance Matrix
| e | 198.8 | 298.9 | 499 | 710.3 | 0 | 1592.8 |
| f | 596.4 | 696.5 | 896.6 | 1107.9 | 397.6 | 0 |
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
@@ -616,21 +617,10 @@ Feature: Basic Distance Matrix
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1501.1 |
| b | 300.2 | 0 | 600.5 | 1200.9 |
| f | 900.7 | 600.5 | 0 | 300.2 |
| f | 900.7 | 600.5 | 0 | 302.2 |
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
When I request a travel distance matrix I should get
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1501.1 |
When I request a travel distance matrix I should get
| | a |
| a | 0 |
| b | 300.2 |
| f | 900.7 |
| 1 | 1501.1 |
Scenario: Testbot - Fise input coordinate
Scenario: Testbot - Filling in noroutes with estimates - use input coordinate
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the query options
@@ -651,21 +641,9 @@ Feature: Basic Distance Matrix
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1501.1 |
| b | 300.2 | 0 | 600.5 | 1200.9 |
| f | 900.7 | 600.5 | 0 | 300.2 |
| f | 900.7 | 600.5 | 0 | 302.2 |
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
When I request a travel distance matrix I should get
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1501.1 |
When I request a travel distance matrix I should get
| | a |
| a | 0 |
| b | 300.2 |
| f | 900.7 |
| 1 | 1501.1 |
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
@@ -687,12 +665,25 @@ Feature: Basic Distance Matrix
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1200.9 |
| b | 300.2 | 0 | 600.5 | 900.7 |
| f | 900.7 | 600.5 | 0 | 300.2 |
| f | 900.7 | 600.5 | 0 | 302.2 |
| 1 | 1200.9 | 900.7 | 300.2 | 0 |
When I request a travel distance matrix I should get
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1200.9 |
Scenario: Testbot - Asymetric fallback_speed - more sources than destinations
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the query options
| fallback_speed | 5 |
| fallback_coordinate | snapped |
Given the node map
"""
a b f h 1
d e g i
"""
And the ways
| nodes |
| abeda |
| fhigf |
When I request a travel distance matrix I should get
| | a |
@@ -701,25 +692,23 @@ Feature: Basic Distance Matrix
| f | 900.7 |
| 1 | 1200.9 |
Scenario: Ensure consistency with route, and make sure offsets work in both directions
Given a grid size of 100 meters
Scenario: Testbot - Asymetric fallback_speed - more destinations than sources
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the query options
| fallback_speed | 5 |
| fallback_coordinate | snapped |
Given the node map
"""
a b c d e f g h i j
1 2
a b f h 1
d e g i
"""
And the ways
| nodes |
| abcdef |
| fghij |
| abeda |
| fhigf |
When I route I should get
| from | to | route | distance |
| 1 | 2 | abcdef,fghij,fghij | 999.9m |
# TODO: this is "correct", but inconsistent with viaroute
When I request a travel distance matrix I should get
| | 1 | 2 |
| 1 | 0 | 1000.7 |
| 2 | 1000.7 | 0 |
| | a | b | f | 1 |
| a | 0 | 300.2 | 900.7 | 1200.9 |
+1 -195
View File
@@ -534,35 +534,6 @@ Feature: Basic Duration Matrix
| f | 18 | 12 | 0 | 30 |
| 1 | 30 | 24 | 30 | 0 |
When I request a travel time matrix I should get
| | a | b | f | 1 |
| a | 0 | 30 | 18 | 30 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 30 |
| f | 18 |
| 1 | 30 |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
| b | | | Y | Y |
| f | Y | Y | | |
| 1 | Y | Y | | |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
When I request a travel time matrix I should get estimates for
| | a |
| a | |
| b | |
| f | Y |
| 1 | Y |
Scenario: Testbot - Filling in noroutes with estimates - use input coordinate
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
@@ -587,36 +558,6 @@ Feature: Basic Duration Matrix
| f | 18 | 12 | 0 | 30 |
| 1 | 30 | 24 | 30 | 0 |
When I request a travel time matrix I should get
| | a | b | f | 1 |
| a | 0 | 30 | 18 | 30 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 30 |
| f | 18 |
| 1 | 30 |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
| b | | | Y | Y |
| f | Y | Y | | |
| 1 | Y | Y | | |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
When I request a travel time matrix I should get estimates for
| | a |
| a | |
| b | |
| f | Y |
| 1 | Y |
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
@@ -639,139 +580,4 @@ Feature: Basic Duration Matrix
| a | 0 | 30 | 18 | 24 |
| b | 30 | 0 | 12 | 18 |
| f | 18 | 12 | 0 | 30 |
| 1 | 24 | 18 | 30 | 0 |
When I request a travel time matrix I should get
| | a | b | f | 1 |
| a | 0 | 30 | 18 | 24 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 30 |
| f | 18 |
| 1 | 24 |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
| b | | | Y | Y |
| f | Y | Y | | |
| 1 | Y | Y | | |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
When I request a travel time matrix I should get estimates for
| | a |
| a | |
| b | |
| f | Y |
| 1 | Y |
Scenario: Testbot - Travel time matrix of minimal network with scale factor
Given the query options
| scale_factor | 2 |
Given the node map
"""
a b
"""
And the ways
| nodes |
| ab |
When I request a travel time matrix I should get
| | a | b |
| a | 0 | 20 |
| b | 20 | 0 |
Scenario: Testbot - Test fallback speeds and scale factor
Given a grid size of 300 meters
Given the extract extra arguments "--small-component-size 4"
Given the query options
| scale_factor | 2 |
| fallback_speed | 5 |
| fallback_coordinate | snapped |
Given the node map
"""
a b f h 1
d e g i
"""
And the ways
| nodes |
| abeda |
| fhigf |
When I request a travel time matrix I should get
| | a | b | f | 1 |
| a | 0 | 60 | 36 | 48 |
| b | 60 | 0 | 24 | 36 |
| f | 36 | 24 | 0 | 60 |
| 1 | 48 | 36 | 60 | 0 |
When I request a travel time matrix I should get
| | a | b | f | 1 |
| a | 0 | 60 | 36 | 48 |
When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 60 |
| f | 36 |
| 1 | 48 |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
| b | | | Y | Y |
| f | Y | Y | | |
| 1 | Y | Y | | |
When I request a travel time matrix I should get estimates for
| | a | b | f | 1 |
| a | | | Y | Y |
When I request a travel time matrix I should get estimates for
| | a |
| a | |
| b | |
| f | Y |
| 1 | Y |
Scenario: Testbot - Travel time matrix of minimal network with overflow scale factor
Given the query options
| scale_factor | 2147483647 |
Given the node map
"""
a b
"""
And the ways
| nodes |
| ab |
When I request a travel time matrix I should get
| | a | b |
| a | 0 | 214748364.6 |
| b | 214748364.6 | 0 |
Scenario: Testbot - Travel time matrix of minimal network with fraction scale factor
Given the query options
| scale_factor | 0.5 |
Given the node map
"""
a b
"""
And the ways
| nodes |
| ab |
When I request a travel time matrix I should get
| | a | b |
| a | 0 | 5 |
| b | 5 | 0 |
| 1 | 24 | 18 | 30 | 0 |
+10 -10
View File
@@ -111,9 +111,9 @@ Feature: Multi level routing
When I request a travel distance matrix I should get
| | a | f | l | o |
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
| f | 2383.7 | 0 | 1293.3 | 1617.3 |
| l | 1566.9 | 1293.3 | 0 | 800.5 |
| o | 1366.8 | 1617.3 | 800.5 | 0 |
| f | 2339.9 | 0 | 1198.1 | 1522.1 |
| l | 1618.3 | 1293.3 | 0 | 800.5 |
| o | 1418.2 | 1617.3 | 800.5 | 0 |
When I request a travel distance matrix I should get
| | a | f | l | o |
@@ -122,21 +122,21 @@ Feature: Multi level routing
When I request a travel distance matrix I should get
| | a |
| a | 0 |
| f | 2383.7 |
| l | 1566.9 |
| o | 1366.8 |
| f | 2339.9 |
| l | 1618.3 |
| o | 1418.2 |
When I request a travel distance matrix I should get
| | a | f | l | o |
| a | 0 | 2383.7 | 1566.9 | 1366.8 |
| f | 2383.7 | 0 | 1293.3 | 1617.3 |
| f | 2339.9 | 0 | 1198.1 | 1522.1 |
When I request a travel distance matrix I should get
| | a | o |
| a | 0 | 1366.8 |
| f | 2383.7 | 1617.3 |
| l | 1566.9 | 800.5 |
| o | 1366.8 | 0 |
| f | 2339.9 | 1522.1 |
| l | 1618.3 | 800.5 |
| o | 1418.2 | 0 |
Scenario: Testbot - Multi level routing: horizontal road
Given the node map
+1 -1
View File
@@ -182,4 +182,4 @@ Feature: Snap start/end point to the nearest way
| x | m | xe,xe |
| x | n | xf,xf |
| x | o | xg,xg |
| x | p | xh,xh |
| x | p | xh,xh |
-47
View File
@@ -18,53 +18,6 @@ Feature: Via points
| waypoints | route |
| a,b,c | abc,abc,abc,abc |
Scenario: Simple via point with waypoints collapsing
Given the node map
"""
a
b 1c d
2
e
"""
And the ways
| nodes |
| ace |
| bcd |
Given the query options
| waypoints | 0;2 |
When I route I should get
| waypoints | route | turns |
| b,1,e | bcd,ace,ace | depart,turn right,arrive |
| b,2,e | bcd,ace,ace | depart,turn right,arrive |
Scenario: Simple via point with waypoints collapsing
Given the node map
"""
a 2 b
c d
1 3
"""
And the ways
| nodes |
| ab |
| bd |
| cd |
| ac |
Given the query options
| waypoints | 0;2 |
When I route I should get
| waypoints | route | turns |
| 1,2,3 | cd,ac,ab,bd,cd | depart,new name right,new name right,new name right,arrive |
Scenario: Simple via point with core factor
Given the contract extra arguments "--core 0.8"
Given the node map
-5
View File
@@ -6,7 +6,6 @@
#include "engine/api/json_factory.hpp"
#include "engine/hint.hpp"
#include "util/coordinate_calculation.hpp"
#include <boost/assert.hpp>
#include <boost/range/algorithm/transform.hpp>
@@ -54,8 +53,6 @@ class BaseAPI
// TODO: check forward/reverse
return json::makeWaypoint(
phantom.location,
util::coordinate_calculation::fccApproximateDistance(phantom.location,
phantom.input_location),
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string(),
Hint{phantom, facade.GetCheckSum()});
}
@@ -64,8 +61,6 @@ class BaseAPI
// TODO: check forward/reverse
return json::makeWaypoint(
phantom.location,
util::coordinate_calculation::fccApproximateDistance(phantom.location,
phantom.input_location),
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
.to_string());
}
+4 -7
View File
@@ -33,7 +33,7 @@ namespace json
namespace detail
{
util::json::Array coordinateToLonLat(const util::Coordinate &coordinate);
util::json::Array coordinateToLonLat(const util::Coordinate coordinate);
/**
* Ensures that a bearing value is a whole number, and clamped to the range 0-359
@@ -86,14 +86,11 @@ util::json::Object makeRoute(const guidance::Route &route,
const char *weight_name);
// Creates a Waypoint without Hint, see the Hint overload below
util::json::Object
makeWaypoint(const util::Coordinate &location, const double &distance, std::string name);
util::json::Object makeWaypoint(const util::Coordinate location, std::string name);
// Creates a Waypoint with Hint, see the overload above when Hint is not needed
util::json::Object makeWaypoint(const util::Coordinate &location,
const double &distance,
std::string name,
const Hint &hint);
util::json::Object
makeWaypoint(const util::Coordinate location, std::string name, const Hint &hint);
util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps);
+9 -4
View File
@@ -63,7 +63,7 @@ struct MatchParameters : public RouteParameters
RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified,
{}),
gaps(GapsType::Split), tidy(false)
gaps(GapsType::Split), tidy(false), waypoints()
{
}
@@ -79,19 +79,24 @@ struct MatchParameters : public RouteParameters
bool tidy_,
std::vector<std::size_t> waypoints_,
Args... args_)
: RouteParameters{std::forward<Args>(args_)..., waypoints_},
timestamps{std::move(timestamps_)}, gaps(gaps_), tidy(tidy_)
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)},
gaps(gaps_), tidy(tidy_), waypoints{std::move(waypoints_)}
{
}
std::vector<unsigned> timestamps;
GapsType gaps;
bool tidy;
std::vector<std::size_t> waypoints;
bool IsValid() const
{
const auto valid_waypoints =
std::all_of(waypoints.begin(), waypoints.end(), [this](const auto &w) {
return w < coordinates.size();
});
return RouteParameters::IsValid() &&
(timestamps.empty() || timestamps.size() == coordinates.size());
(timestamps.empty() || timestamps.size() == coordinates.size()) && valid_waypoints;
}
};
}
+1
View File
@@ -41,6 +41,7 @@ class NearestAPI final : public BaseAPI
[this](const PhantomNodeWithDistance &phantom_with_distance) {
auto &phantom_node = phantom_with_distance.phantom_node;
auto waypoint = MakeWaypoint(phantom_node);
waypoint.values["distance"] = phantom_with_distance.distance;
util::json::Array nodes;
+4 -11
View File
@@ -44,11 +44,8 @@ class RouteAPI : public BaseAPI
{
}
void
MakeResponse(const InternalManyRoutesResult &raw_routes,
const std::vector<PhantomNodes>
&all_start_end_points, // all used coordinates, ignoring waypoints= parameter
util::json::Object &response) const
void MakeResponse(const InternalManyRoutesResult &raw_routes,
util::json::Object &response) const
{
BOOST_ASSERT(!raw_routes.routes.empty());
@@ -65,14 +62,10 @@ class RouteAPI : public BaseAPI
route.target_traversed_in_reverse));
}
response.values["waypoints"] = BaseAPI::MakeWaypoints(all_start_end_points);
response.values["waypoints"] =
BaseAPI::MakeWaypoints(raw_routes.routes[0].segment_end_coordinates);
response.values["routes"] = std::move(jsRoutes);
response.values["code"] = "Ok";
auto data_timestamp = facade.GetTimestamp();
if (!data_timestamp.empty())
{
response.values["data_version"] = data_timestamp;
}
}
protected:
+7 -59
View File
@@ -78,11 +78,6 @@ struct RouteParameters : public BaseParameters
Speed = 0x20,
All = Duration | Nodes | Distance | Weight | Datasources | Speed
};
enum class SnappingType
{
Default,
Any
};
RouteParameters() = default;
@@ -103,8 +98,7 @@ struct RouteParameters : public BaseParameters
annotations_type{AnnotationsType::None},
geometries{geometries_},
overview{overview_},
continue_straight{continue_straight_},
waypoints()
continue_straight{continue_straight_}
{
}
@@ -120,9 +114,7 @@ struct RouteParameters : public BaseParameters
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
waypoints()
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}
{
}
@@ -139,45 +131,7 @@ struct RouteParameters : public BaseParameters
number_of_alternatives{alternatives_ ? 1u : 0u},
annotations{annotations_ == AnnotationsType::None ? false : true},
annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}, waypoints()
{
}
// RouteParameters constructor adding the `waypoints` parameter
template <typename... Args>
RouteParameters(const bool steps_,
const bool alternatives_,
const bool annotations_,
const GeometriesType geometries_,
const OverviewType overview_,
const boost::optional<bool> continue_straight_,
std::vector<std::size_t> waypoints_,
const SnappingType snapping_,
const Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_},
waypoints{waypoints_}, snapping{snapping_}
{
}
// RouteParameters constructor adding the `waypoints` parameter
template <typename... Args>
RouteParameters(const bool steps_,
const bool alternatives_,
const AnnotationsType annotations_,
const GeometriesType geometries_,
const OverviewType overview_,
const boost::optional<bool> continue_straight_,
std::vector<std::size_t> waypoints_,
const SnappingType snapping_,
Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u},
annotations{annotations_ == AnnotationsType::None ? false : true},
annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}, waypoints{waypoints_}, snapping{snapping_}
continue_straight{continue_straight_}
{
}
@@ -190,18 +144,12 @@ struct RouteParameters : public BaseParameters
GeometriesType geometries = GeometriesType::Polyline;
OverviewType overview = OverviewType::Simplified;
boost::optional<bool> continue_straight;
std::vector<std::size_t> waypoints;
SnappingType snapping = SnappingType::Default;
bool IsValid() const
{
const auto coordinates_ok = coordinates.size() >= 2;
const auto base_params_ok = BaseParameters::IsValid();
const auto valid_waypoints =
std::all_of(waypoints.begin(), waypoints.end(), [this](const auto &w) {
return w < coordinates.size();
});
return coordinates_ok && base_params_ok && valid_waypoints;
return coordinates_ok && base_params_ok;
}
};
@@ -225,8 +173,8 @@ inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsT
{
return lhs = lhs | rhs;
}
} // ns api
} // ns engine
} // ns osrm
}
}
}
#endif
-29
View File
@@ -31,15 +31,6 @@ namespace api
class TableAPI final : public BaseAPI
{
public:
struct TableCellRef
{
TableCellRef(const std::size_t &row, const std::size_t &column) : row{row}, column{column}
{
}
std::size_t row;
std::size_t column;
};
TableAPI(const datafacade::BaseDataFacade &facade_, const TableParameters &parameters_)
: BaseAPI(facade_, parameters_), parameters(parameters_)
{
@@ -48,7 +39,6 @@ class TableAPI final : public BaseAPI
virtual void
MakeResponse(const std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>> &tables,
const std::vector<PhantomNode> &phantoms,
const std::vector<TableCellRef> &fallback_speed_cells,
util::json::Object &response) const
{
auto number_of_sources = parameters.sources.size();
@@ -87,11 +77,6 @@ class TableAPI final : public BaseAPI
MakeDistanceTable(tables.second, number_of_sources, number_of_destinations);
}
if (parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0)
{
response.values["fallback_speed_cells"] = MakeEstimatesTable(fallback_speed_cells);
}
response.values["code"] = "Ok";
}
@@ -178,20 +163,6 @@ class TableAPI final : public BaseAPI
return json_table;
}
virtual util::json::Array
MakeEstimatesTable(const std::vector<TableCellRef> &fallback_speed_cells) const
{
util::json::Array json_table;
std::for_each(
fallback_speed_cells.begin(), fallback_speed_cells.end(), [&](const auto &cell) {
util::json::Array row;
row.values.push_back(util::json::Number(cell.row));
row.values.push_back(util::json::Number(cell.column));
json_table.values.push_back(std::move(row));
});
return json_table;
}
const TableParameters &parameters;
};
+3 -11
View File
@@ -59,7 +59,7 @@ struct TableParameters : public BaseParameters
{
std::vector<std::size_t> sources;
std::vector<std::size_t> destinations;
double fallback_speed = INVALID_FALLBACK_SPEED;
double fallback_speed = 0;
enum class FallbackCoordinateType
{
@@ -79,8 +79,6 @@ struct TableParameters : public BaseParameters
AnnotationsType annotations = AnnotationsType::Duration;
double scale_factor = 1;
TableParameters() = default;
template <typename... Args>
TableParameters(std::vector<std::size_t> sources_,
@@ -107,13 +105,10 @@ struct TableParameters : public BaseParameters
const AnnotationsType annotations_,
double fallback_speed_,
FallbackCoordinateType fallback_coordinate_type_,
double scale_factor_,
Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
destinations{std::move(destinations_)}, fallback_speed{fallback_speed_},
fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_},
scale_factor{scale_factor_}
fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_}
{
}
@@ -137,10 +132,7 @@ struct TableParameters : public BaseParameters
if (std::any_of(begin(destinations), end(destinations), not_in_range))
return false;
if (fallback_speed <= 0)
return false;
if (scale_factor <= 0)
if (fallback_speed < 0)
return false;
return true;
@@ -137,7 +137,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
extractor::Datasources *m_datasources;
std::uint32_t m_check_sum;
StringView m_data_timestamp;
util::vector_view<util::Coordinate> m_coordinate_list;
extractor::PackedOSMIDsView m_osmnodeid_list;
util::vector_view<std::uint32_t> m_lane_description_offsets;
@@ -184,8 +183,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
m_check_sum = *index.GetBlockPtr<std::uint32_t>("/common/connectivity_checksum");
m_data_timestamp = make_timestamp_view(index, "/common/timestamp");
std::tie(m_coordinate_list, m_osmnodeid_list) =
make_nbn_data_view(index, "/common/nbn_data");
@@ -315,13 +312,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
const float max_distance,
const Approach approach,
const bool use_all_edges) const override final
const Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodesInRange(
input_coordinate, max_distance, approach, use_all_edges);
input_coordinate, max_distance, approach);
}
std::vector<PhantomNodeWithDistance>
@@ -329,13 +325,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
const float max_distance,
const int bearing,
const int bearing_range,
const Approach approach,
const bool use_all_edges) const override final
const Approach approach) 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);
input_coordinate, max_distance, bearing, bearing_range, approach);
}
std::vector<PhantomNodeWithDistance>
@@ -389,25 +384,23 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const Approach approach,
const bool use_all_edges) const override final
const Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, approach, use_all_edges);
input_coordinate, approach);
}
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
const Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, max_distance, approach, use_all_edges);
input_coordinate, max_distance, approach);
}
std::pair<PhantomNode, PhantomNode>
@@ -415,35 +408,28 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
const double max_distance,
const int bearing,
const int bearing_range,
const Approach approach,
const bool use_all_edges) const override final
const Approach approach) 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);
input_coordinate, max_distance, bearing, bearing_range, approach);
}
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
const Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, bearing, bearing_range, approach, use_all_edges);
input_coordinate, bearing, bearing_range, approach);
}
std::uint32_t GetCheckSum() const override final { return m_check_sum; }
std::string GetTimestamp() const override final
{
return std::string(m_data_timestamp.begin(), m_data_timestamp.end());
}
GeometryID GetGeometryIndex(const NodeID id) const override final
{
return edge_based_node_data.GetGeometryID(id);
+6 -14
View File
@@ -74,8 +74,6 @@ class BaseDataFacade
virtual std::uint32_t GetCheckSum() const = 0;
virtual std::string GetTimestamp() const = 0;
// node and edge information access
virtual util::Coordinate GetCoordinateOfNode(const NodeID id) const = 0;
@@ -128,13 +126,11 @@ class BaseDataFacade
const float max_distance,
const int bearing,
const int bearing_range,
const Approach approach,
const bool use_all_edges) const = 0;
const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
const float max_distance,
const Approach approach,
const bool use_all_edges) const = 0;
const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate,
@@ -161,26 +157,22 @@ class BaseDataFacade
virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const Approach approach,
const bool use_all_edges) const = 0;
const Approach approach) 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;
const Approach approach) 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;
const Approach approach) 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;
const Approach approach) const = 0;
virtual bool HasLaneData(const EdgeID id) const = 0;
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;
+24 -48
View File
@@ -53,15 +53,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
const double max_distance,
const Approach approach,
const bool use_all_edges) const
const Approach approach) const
{
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, use_all_edges](const CandidateSegment &segment) {
return boolPairAnd(
boolPairAnd(HasValidEdge(segment, use_all_edges), CheckSegmentExclude(segment)),
CheckApproach(input_coordinate, segment, approach));
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)),
CheckApproach(input_coordinate, segment, approach));
},
[this, max_distance, input_coordinate](const std::size_t,
const CandidateSegment &segment) {
@@ -78,17 +76,15 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance,
const int bearing,
const int bearing_range,
const Approach approach,
const bool use_all_edges) const
const Approach approach) const
{
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, bearing, bearing_range, use_all_edges](
[this, approach, &input_coordinate, bearing, bearing_range](
const CandidateSegment &segment) {
auto use_direction =
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
boolPairAnd(HasValidEdge(segment, use_all_edges),
CheckSegmentExclude(segment)));
boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)));
use_direction =
boolPairAnd(use_direction, CheckApproach(input_coordinate, segment, approach));
return use_direction;
@@ -205,23 +201,18 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance,
const Approach approach,
const bool use_all_edges) const
const Approach approach) 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) {
[this, approach, &input_coordinate, &has_big_component, &has_small_component](
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 valid_edges = HasValidEdge(segment);
const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, admissible_segments);
use_directions = boolPairAnd(use_directions, valid_edges);
@@ -256,24 +247,19 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
// 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
const Approach approach) 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) {
[this, approach, &input_coordinate, &has_big_component, &has_small_component](
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 valid_edges = HasValidEdge(segment);
const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, admissible_segments);
use_directions = boolPairAnd(use_directions, valid_edges);
@@ -308,8 +294,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing,
const int bearing_range,
const Approach approach,
const bool use_all_edges) const
const Approach approach) const
{
bool has_small_component = false;
bool has_big_component = false;
@@ -321,13 +306,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bearing,
bearing_range,
&has_big_component,
&has_small_component,
&use_all_edges](const CandidateSegment &segment) {
&has_small_component](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);
use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges));
use_directions = boolPairAnd(use_directions, HasValidEdge(segment));
if (use_segment)
{
@@ -368,8 +352,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance,
const int bearing,
const int bearing_range,
const Approach approach,
const bool use_all_edges) const
const Approach approach) const
{
bool has_small_component = false;
bool has_big_component = false;
@@ -381,13 +364,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bearing,
bearing_range,
&has_big_component,
&has_small_component,
&use_all_edges](const CandidateSegment &segment) {
&has_small_component](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);
use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges));
use_directions = boolPairAnd(use_directions, HasValidEdge(segment));
if (use_segment)
{
@@ -479,7 +461,6 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
EdgeDuration{0});
EdgeDistance forward_distance_offset = 0;
// Sum up the distance from the start to the fwd_segment_position
for (auto current = forward_geometry.begin();
current < forward_geometry.begin() + data.fwd_segment_position;
++current)
@@ -509,9 +490,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
EdgeDuration{0});
EdgeDistance reverse_distance_offset = 0;
// Sum up the distance from just after the fwd_segment_position to the end
for (auto current = forward_geometry.begin() + data.fwd_segment_position + 1;
current != std::prev(forward_geometry.end());
for (auto current = forward_geometry.begin();
current < forward_geometry.end() - data.fwd_segment_position - 2;
++current)
{
reverse_distance_offset += util::coordinate_calculation::fccApproximateDistance(
@@ -648,8 +628,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
* which means that this edge is not currently traversible. If this is the case,
* then we shouldn't snap to this edge.
*/
std::pair<bool, bool> HasValidEdge(const CandidateSegment &segment,
const bool use_all_edges = false) const
std::pair<bool, bool> HasValidEdge(const CandidateSegment &segment) const
{
bool forward_edge_valid = false;
@@ -673,9 +652,6 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
reverse_edge_valid = data.reverse_segment_id.enabled;
}
forward_edge_valid = forward_edge_valid && (data.is_startpoint || use_all_edges);
reverse_edge_valid = reverse_edge_valid && (data.is_startpoint || use_all_edges);
return std::make_pair(forward_edge_valid, reverse_edge_valid);
}
+8 -16
View File
@@ -138,8 +138,7 @@ class BasePlugin
std::vector<std::vector<PhantomNodeWithDistance>>
GetPhantomNodesInRange(const datafacade::BaseDataFacade &facade,
const api::BaseParameters &parameters,
const std::vector<double> radiuses,
bool use_all_edges = false) const
const std::vector<double> radiuses) const
{
std::vector<std::vector<PhantomNodeWithDistance>> phantom_nodes(
parameters.coordinates.size());
@@ -172,13 +171,12 @@ class BasePlugin
radiuses[i],
parameters.bearings[i]->bearing,
parameters.bearings[i]->range,
approach,
use_all_edges);
approach);
}
else
{
phantom_nodes[i] = facade.NearestPhantomNodesInRange(
parameters.coordinates[i], radiuses[i], approach, use_all_edges);
parameters.coordinates[i], radiuses[i], approach);
}
}
@@ -262,8 +260,7 @@ class BasePlugin
}
std::vector<PhantomNodePair> GetPhantomNodes(const datafacade::BaseDataFacade &facade,
const api::BaseParameters &parameters,
const bool use_all_edges = false) const
const api::BaseParameters &parameters) const
{
std::vector<PhantomNodePair> phantom_node_pairs(parameters.coordinates.size());
@@ -297,8 +294,7 @@ class BasePlugin
*parameters.radiuses[i],
parameters.bearings[i]->bearing,
parameters.bearings[i]->range,
approach,
use_all_edges);
approach);
}
else
{
@@ -307,8 +303,7 @@ class BasePlugin
parameters.coordinates[i],
parameters.bearings[i]->bearing,
parameters.bearings[i]->range,
approach,
use_all_edges);
approach);
}
}
else
@@ -317,16 +312,13 @@ class BasePlugin
{
phantom_node_pairs[i] =
facade.NearestPhantomNodeWithAlternativeFromBigComponent(
parameters.coordinates[i],
*parameters.radiuses[i],
approach,
use_all_edges);
parameters.coordinates[i], *parameters.radiuses[i], approach);
}
else
{
phantom_node_pairs[i] =
facade.NearestPhantomNodeWithAlternativeFromBigComponent(
parameters.coordinates[i], approach, use_all_edges);
parameters.coordinates[i], approach);
}
}
@@ -89,6 +89,7 @@ class EdgeBasedGraphFactory
// The following get access functions destroy the content in the factory
void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges);
void GetEdgeBasedNodeSegments(std::vector<EdgeBasedNodeSegment> &nodes);
void GetStartPointMarkers(std::vector<bool> &node_is_startpoint);
void GetEdgeBasedNodeWeights(std::vector<EdgeWeight> &output_node_weights);
void GetEdgeBasedNodeDurations(std::vector<EdgeWeight> &output_node_durations);
void GetEdgeBasedNodeDistances(std::vector<EdgeDistance> &output_node_distances);
@@ -111,6 +112,10 @@ class EdgeBasedGraphFactory
std::vector<ConditionalTurnPenalty>
IndexConditionals(std::vector<Conditional> &&conditionals) const;
//! maps index from m_edge_based_node_list to ture/false if the node is an entry point to the
//! graph
std::vector<bool> m_edge_based_node_is_startpoint;
//! node weights that indicate the length of the segment (node based) represented by the
//! edge-based node
std::vector<EdgeWeight> m_edge_based_node_weights;
@@ -22,9 +22,7 @@ struct EdgeBasedNodeSegment
EdgeBasedNodeSegment()
: forward_segment_id{SPECIAL_SEGMENTID, false},
reverse_segment_id{SPECIAL_SEGMENTID, false}, u(SPECIAL_NODEID), v(SPECIAL_NODEID),
fwd_segment_position(std::numeric_limits<unsigned short>::max() >>
1), // >> 1 because we've only got 15 bits
is_startpoint(false)
fwd_segment_position(std::numeric_limits<unsigned short>::max())
{
}
@@ -32,10 +30,9 @@ struct EdgeBasedNodeSegment
const SegmentID reverse_segment_id_,
NodeID u,
NodeID v,
unsigned short fwd_segment_position,
bool is_startpoint_)
unsigned short fwd_segment_position)
: forward_segment_id(forward_segment_id_), reverse_segment_id(reverse_segment_id_), u(u),
v(v), fwd_segment_position(fwd_segment_position), is_startpoint(is_startpoint_)
v(v), fwd_segment_position(fwd_segment_position)
{
BOOST_ASSERT(forward_segment_id.enabled || reverse_segment_id.enabled);
}
@@ -44,8 +41,7 @@ struct EdgeBasedNodeSegment
SegmentID reverse_segment_id; // edge-based graph node ID in reverse direction (v->u if exists)
NodeID u; // node-based graph node ID of the start node
NodeID v; // node-based graph node ID of the target node
unsigned short fwd_segment_position : 15; // segment id in a compressed geometry
bool is_startpoint : 1;
unsigned short fwd_segment_position; // segment id in a compressed geometry
};
}
}
+2
View File
@@ -85,6 +85,7 @@ class Extractor
// output data
EdgeBasedNodeDataContainer &edge_based_nodes_container,
std::vector<EdgeBasedNodeSegment> &edge_based_node_segments,
std::vector<bool> &node_is_startpoint,
std::vector<EdgeWeight> &edge_based_node_weights,
std::vector<EdgeDuration> &edge_based_node_durations,
std::vector<EdgeDistance> &edge_based_node_distances,
@@ -96,6 +97,7 @@ class Extractor
const std::vector<EdgeBasedNodeSegment> &input_node_segments,
EdgeBasedNodeDataContainer &nodes_container) const;
void BuildRTree(std::vector<EdgeBasedNodeSegment> edge_based_node_segments,
std::vector<bool> node_is_startpoint,
const std::vector<util::Coordinate> &coordinates);
std::shared_ptr<RestrictionMap> LoadRestrictionMap();
-2
View File
@@ -55,7 +55,6 @@ struct ExtractorConfig final : storage::IOConfig
".osrm.geometry",
".osrm.nbg_nodes",
".osrm.ebg_nodes",
".osrm.timestamp",
".osrm.edges",
".osrm.ebg",
".osrm.ramIndex",
@@ -83,7 +82,6 @@ struct ExtractorConfig final : storage::IOConfig
boost::filesystem::path input_path;
boost::filesystem::path profile_path;
std::vector<boost::filesystem::path> location_dependent_data_paths;
std::string data_version;
unsigned requested_num_threads;
unsigned small_component_size;
-20
View File
@@ -308,26 +308,6 @@ inline void writeTurnLaneData(const boost::filesystem::path &path,
storage::serialization::write(writer, "/common/turn_lanes/data", turn_lane_data);
}
// reads .osrm.timestamp
template <typename TimestampDataT>
inline void readTimestamp(const boost::filesystem::path &path, TimestampDataT &timestamp)
{
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
storage::serialization::read(reader, "/common/timestamp", timestamp);
}
// writes .osrm.timestamp
template <typename TimestampDataT>
inline void writeTimestamp(const boost::filesystem::path &path, const TimestampDataT &timestamp)
{
const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
storage::tar::FileWriter writer{path, fingerprint};
storage::serialization::write(writer, "/common/timestamp", timestamp);
}
// reads .osrm.maneuver_overrides
template <typename StorageManeuverOverrideT, typename NodeSequencesT>
inline void readManeuverOverrides(const boost::filesystem::path &path,
+1 -114
View File
@@ -944,101 +944,6 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
}
}
if (obj->Has(Nan::New("waypoints").ToLocalChecked()))
{
v8::Local<v8::Value> waypoints = obj->Get(Nan::New("waypoints").ToLocalChecked());
if (waypoints.IsEmpty())
return route_parameters_ptr();
// must be array
if (!waypoints->IsArray())
{
Nan::ThrowError(
"Waypoints must be an array of integers corresponding to the input coordinates.");
return route_parameters_ptr();
}
auto waypoints_array = v8::Local<v8::Array>::Cast(waypoints);
// must have at least two elements
if (waypoints_array->Length() < 2)
{
Nan::ThrowError("At least two waypoints must be provided");
return route_parameters_ptr();
}
auto coords_size = params->coordinates.size();
auto waypoints_array_size = waypoints_array->Length();
const auto first_index = Nan::To<std::uint32_t>(waypoints_array->Get(0)).FromJust();
const auto last_index =
Nan::To<std::uint32_t>(waypoints_array->Get(waypoints_array_size - 1)).FromJust();
if (first_index != 0 || last_index != coords_size - 1)
{
Nan::ThrowError("First and last waypoints values must correspond to first and last "
"coordinate indices");
return route_parameters_ptr();
}
for (uint32_t i = 0; i < waypoints_array_size; ++i)
{
v8::Local<v8::Value> waypoint_value = waypoints_array->Get(i);
// all elements must be numbers
if (!waypoint_value->IsNumber())
{
Nan::ThrowError("Waypoint values must be an array of integers");
return route_parameters_ptr();
}
// check that the waypoint index corresponds with an inpute coordinate
const auto index = Nan::To<std::uint32_t>(waypoint_value).FromJust();
if (index >= coords_size)
{
Nan::ThrowError("Waypoints must correspond with the index of an input coordinate");
return route_parameters_ptr();
}
params->waypoints.emplace_back(static_cast<unsigned>(waypoint_value->NumberValue()));
}
if (!params->waypoints.empty())
{
for (std::size_t i = 0; i < params->waypoints.size() - 1; i++)
{
if (params->waypoints[i] >= params->waypoints[i + 1])
{
Nan::ThrowError("Waypoints must be supplied in increasing order");
return route_parameters_ptr();
}
}
}
}
if (obj->Has(Nan::New("snapping").ToLocalChecked()))
{
v8::Local<v8::Value> snapping = obj->Get(Nan::New("snapping").ToLocalChecked());
if (snapping.IsEmpty())
return route_parameters_ptr();
if (!snapping->IsString())
{
Nan::ThrowError("Snapping must be a string: [default, any]");
return route_parameters_ptr();
}
const Nan::Utf8String snapping_utf8str(snapping);
std::string snapping_str{*snapping_utf8str, *snapping_utf8str + snapping_utf8str.length()};
if (snapping_str == "default")
{
params->snapping = osrm::RouteParameters::SnappingType::Default;
}
else if (snapping_str == "any")
{
params->snapping = osrm::RouteParameters::SnappingType::Any;
}
else
{
Nan::ThrowError("'snapping' param must be one of [default, any]");
return route_parameters_ptr();
}
}
bool parsedSuccessfully = parseCommonParameters(obj, params);
if (!parsedSuccessfully)
{
@@ -1287,7 +1192,7 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
Nan::ThrowError("fallback_speed must be a number");
return table_parameters_ptr();
}
else if (fallback_speed->NumberValue() <= 0)
else if (fallback_speed->NumberValue() < 0)
{
Nan::ThrowError("fallback_speed must be > 0");
return table_parameters_ptr();
@@ -1324,24 +1229,6 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
}
}
if (obj->Has(Nan::New("scale_factor").ToLocalChecked()))
{
auto scale_factor = obj->Get(Nan::New("scale_factor").ToLocalChecked());
if (!scale_factor->IsNumber())
{
Nan::ThrowError("scale_factor must be a number");
return table_parameters_ptr();
}
else if (scale_factor->NumberValue() <= 0)
{
Nan::ThrowError("scale_factor must be > 0");
return table_parameters_ptr();
}
params->scale_factor = static_cast<double>(scale_factor->NumberValue());
}
return params;
}
@@ -42,12 +42,17 @@ struct MatchParametersGrammar final : public RouteParametersGrammar<Iterator, Si
(qi::uint_ %
';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
waypoints_rule =
qi::lit("waypoints=") >
(size_t_ % ';')[ph::bind(&engine::api::MatchParameters::waypoints, qi::_r1) = qi::_1];
gaps_type.add("split", engine::api::MatchParameters::GapsType::Split)(
"ignore", engine::api::MatchParameters::GapsType::Ignore);
root_rule =
BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
-('?' > (timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) |
waypoints_rule(qi::_r1) |
(qi::lit("gaps=") >
gaps_type[ph::bind(&engine::api::MatchParameters::gaps, qi::_r1) = qi::_1]) |
(qi::lit("tidy=") >
@@ -58,6 +63,7 @@ struct MatchParametersGrammar final : public RouteParametersGrammar<Iterator, Si
private:
qi::rule<Iterator, Signature> root_rule;
qi::rule<Iterator, Signature> timestamps_rule;
qi::rule<Iterator, Signature> waypoints_rule;
qi::rule<Iterator, std::size_t()> size_t_;
qi::symbols<char, engine::api::MatchParameters::GapsType> gaps_type;
@@ -48,14 +48,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
RouteParametersGrammar(qi::rule<Iterator, Signature> &root_rule_) : BaseGrammar(root_rule_)
{
#ifdef BOOST_HAS_LONG_LONG
if (std::is_same<std::size_t, unsigned long long>::value)
size_t_ = qi::ulong_long;
else
size_t_ = qi::ulong_;
#else
size_t_ = qi::ulong_;
#endif
using AnnotationsType = engine::api::RouteParameters::AnnotationsType;
const auto add_annotation = [](engine::api::RouteParameters &route_parameters,
@@ -78,15 +70,8 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
"distance", AnnotationsType::Distance)("weight", AnnotationsType::Weight)(
"datasources", AnnotationsType::Datasources)("speed", AnnotationsType::Speed);
waypoints_rule =
qi::lit("waypoints=") >
(size_t_ % ';')[ph::bind(&engine::api::RouteParameters::waypoints, qi::_r1) = qi::_1];
snapping_type.add("default", engine::api::RouteParameters::SnappingType::Default)(
"any", engine::api::RouteParameters::SnappingType::Any);
base_rule =
BaseGrammar::base_rule(qi::_r1) | waypoints_rule(qi::_r1) |
BaseGrammar::base_rule(qi::_r1) |
(qi::lit("steps=") >
qi::bool_[ph::bind(&engine::api::RouteParameters::steps, qi::_r1) = qi::_1]) |
(qi::lit("geometries=") >
@@ -94,8 +79,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
qi::_1]) |
(qi::lit("overview=") >
overview_type[ph::bind(&engine::api::RouteParameters::overview, qi::_r1) = qi::_1]) |
(qi::lit("snapping=") >
snapping_type[ph::bind(&engine::api::RouteParameters::snapping, qi::_r1) = qi::_1]) |
(qi::lit("annotations=") >
(qi::lit("true")[ph::bind(add_annotation, qi::_r1, AnnotationsType::All)] |
qi::lit("false")[ph::bind(add_annotation, qi::_r1, AnnotationsType::None)] |
@@ -111,13 +94,10 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
private:
qi::rule<Iterator, Signature> root_rule;
qi::rule<Iterator, Signature> route_rule;
qi::rule<Iterator, Signature> waypoints_rule;
qi::rule<Iterator, std::size_t()> size_t_;
qi::symbols<char, engine::api::RouteParameters::GeometriesType> geometries_type;
qi::symbols<char, engine::api::RouteParameters::OverviewType> overview_type;
qi::symbols<char, engine::api::RouteParameters::AnnotationsType> annotations_type;
qi::symbols<char, engine::api::RouteParameters::SnappingType> snapping_type;
};
}
}
+8 -13
View File
@@ -56,20 +56,16 @@ struct TableParametersGrammar : public BaseParametersGrammar<Iterator, Signature
engine::api::TableParameters::FallbackCoordinateType::Input)(
"snapped", engine::api::TableParameters::FallbackCoordinateType::Snapped);
scale_factor_rule =
qi::lit("scale_factor=") >
(double_)[ph::bind(&engine::api::TableParameters::scale_factor, qi::_r1) = qi::_1];
table_rule = destinations_rule(qi::_r1) | sources_rule(qi::_r1);
root_rule = BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
-('?' > (table_rule(qi::_r1) | base_rule(qi::_r1) | scale_factor_rule(qi::_r1) |
fallback_speed_rule(qi::_r1) |
(qi::lit("fallback_coordinate=") >
fallback_coordinate_type
[ph::bind(&engine::api::TableParameters::fallback_coordinate_type,
qi::_r1) = qi::_1])) %
'&');
root_rule =
BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
-('?' > (table_rule(qi::_r1) | base_rule(qi::_r1) | fallback_speed_rule(qi::_r1) |
(qi::lit("fallback_coordinate=") >
fallback_coordinate_type
[ph::bind(&engine::api::TableParameters::fallback_coordinate_type,
qi::_r1) = qi::_1])) %
'&');
}
TableParametersGrammar(qi::rule<Iterator, Signature> &root_rule_) : BaseGrammar(root_rule_)
@@ -98,7 +94,6 @@ struct TableParametersGrammar : public BaseParametersGrammar<Iterator, Signature
qi::rule<Iterator, Signature> sources_rule;
qi::rule<Iterator, Signature> destinations_rule;
qi::rule<Iterator, Signature> fallback_speed_rule;
qi::rule<Iterator, Signature> scale_factor_rule;
qi::rule<Iterator, std::size_t()> size_t_;
qi::symbols<char, engine::api::TableParameters::AnnotationsType> annotations;
qi::rule<Iterator, engine::api::TableParameters::AnnotationsType()> annotations_list;
-1
View File
@@ -58,7 +58,6 @@ struct StorageConfig final : IOConfig
".osrm.turn_duration_penalties",
".osrm.datasource_names",
".osrm.names",
".osrm.timestamp",
".osrm.properties",
".osrm.icd",
".osrm.maneuver_overrides"},
-5
View File
@@ -272,11 +272,6 @@ inline auto make_partition_view(const SharedDataIndex &index, const std::string
level_data_ptr, std::move(partition), std::move(cell_to_children)};
}
inline auto make_timestamp_view(const SharedDataIndex &index, const std::string &name)
{
return util::StringView(index.GetBlockPtr<char>(name), index.GetBlockEntries(name));
}
inline auto make_cell_storage_view(const SharedDataIndex &index, const std::string &name)
{
auto source_boundary = make_vector_view<NodeID>(index, name + "/source_boundary");
-2
View File
@@ -79,7 +79,6 @@ using EdgeDistance = float;
using SegmentWeight = std::uint32_t;
using SegmentDuration = std::uint32_t;
using TurnPenalty = std::int16_t; // turn penalty in 100ms units
using DataTimestamp = std::string;
static const std::size_t INVALID_INDEX = std::numeric_limits<std::size_t>::max();
@@ -117,7 +116,6 @@ static const EdgeDuration MAXIMAL_EDGE_DURATION = std::numeric_limits<EdgeDurati
static const EdgeDistance MAXIMAL_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits<TurnPenalty>::max();
static const EdgeDistance INVALID_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits<double>::max();
// FIXME the bitfields we use require a reduced maximal duration, this should be kept consistent
// within the code base. For now we have to ensure that we don't case 30 bit to -1 and break any
+3530 -3518
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,13 +1,13 @@
{
"name": "osrm",
"version": "5.22.0+customsnapping.3",
"version": "5.20.0",
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {
"mkdirp": "^0.5.1",
"nan": "^2.11.1",
"node-cmake": "^2.3.2",
"node-pre-gyp": "^0.12.0",
"node-pre-gyp": "^0.6.36",
"rimraf": "^2.5.4"
},
"browserify": {
@@ -47,14 +47,14 @@
"csv-stringify": "^3.0.0",
"cucumber": "^1.2.1",
"d3-queue": "^2.0.3",
"docbox": "^1.0.11",
"docbox": "^1.0.6",
"documentation": "^4.0.0-rc.1",
"eslint": "^5.10.0",
"eslint": "^2.4.0",
"faucet": "^0.0.1",
"jsonpath": "^1.0.0",
"node-timeout": "0.0.4",
"polyline": "^0.2.0",
"request": "^2.88.0",
"request": "^2.69.0",
"tape": "^4.7.0",
"turf": "^3.0.14",
"xmlbuilder": "^4.2.1"
+17 -4
View File
@@ -7,7 +7,6 @@ Sequence = require('lib/sequence')
Handlers = require("lib/way_handlers")
find_access_tag = require("lib/access").find_access_tag
limit = require("lib/maxspeed").limit
Measure = require("lib/measure")
function setup()
local default_speed = 15
@@ -207,6 +206,20 @@ function setup()
}
end
local function parse_maxspeed(source)
if not source then
return 0
end
local n = tonumber(source:match("%d*"))
if not n then
n = 0
end
if string.match(source, "mph") or string.match(source, "mp/h") then
n = (n*1609)/1000
end
return n
end
function process_node(profile, node, result)
-- parse access and barrier tags
local highway = node:get_value_by_key("highway")
@@ -263,9 +276,9 @@ function handle_bicycle_tags(profile,way,result,data)
-- other tags
data.junction = way:get_value_by_key("junction")
data.maxspeed = Measure.get_max_speed(way:get_value_by_key ("maxspeed")) or 0
data.maxspeed_forward = Measure.get_max_speed(way:get_value_by_key("maxspeed:forward")) or 0
data.maxspeed_backward = Measure.get_max_speed(way:get_value_by_key("maxspeed:backward")) or 0
data.maxspeed = parse_maxspeed(way:get_value_by_key ( "maxspeed") )
data.maxspeed_forward = parse_maxspeed(way:get_value_by_key( "maxspeed:forward"))
data.maxspeed_backward = parse_maxspeed(way:get_value_by_key( "maxspeed:backward"))
data.barrier = way:get_value_by_key("barrier")
data.oneway = way:get_value_by_key("oneway")
data.oneway_bicycle = way:get_value_by_key("oneway:bicycle")
-1
View File
@@ -269,7 +269,6 @@ function setup()
["at:rural"] = 100,
["at:trunk"] = 100,
["be:motorway"] = 120,
["be-vlg:rural"] = 70,
["by:urban"] = 60,
["by:motorway"] = 110,
["ch:rural"] = 80,
-19
View File
@@ -6,18 +6,6 @@ Measure = {}
local inch_to_meters = 0.0254
local feet_to_inches = 12
local pound_to_kilograms = 0.45359237
local miles_to_kilometers = 1.609
-- Parse speed value as kilometers by hours.
function Measure.parse_value_speed(source)
local n = tonumber(source:match("%d*"))
if n then
if string.match(source, "mph") or string.match(source, "mp/h") then
n = n * miles_to_kilometers
end
return n
end
end
--- Parse string as a height in meters.
--- according to http://wiki.openstreetmap.org/wiki/Key:maxheight
@@ -54,13 +42,6 @@ function Measure.parse_value_kilograms(value)
end
end
--- Get maxspeed of specified way in kilometers by hours.
function Measure.get_max_speed(raw_value)
if raw_value then
return Measure.parse_value_speed(raw_value)
end
end
-- default maxheight value defined in https://wiki.openstreetmap.org/wiki/Key:maxheight#Non-numerical_values
local default_maxheight = 4.5
-- Available Non numerical values equal to 4.5; below_default and no_indications are not considered
+7 -4
View File
@@ -432,7 +432,7 @@ end
-- maxspeed and advisory maxspeed
function WayHandlers.maxspeed(profile,way,result,data)
local keys = Sequence { 'maxspeed:advisory', 'maxspeed', 'source:maxspeed', 'maxspeed:type' }
local keys = Sequence { 'maxspeed:advisory', 'maxspeed' }
local forward, backward = Tags.get_forward_backward_by_set(way,data,keys)
forward = WayHandlers.parse_maxspeed(forward,profile)
backward = WayHandlers.parse_maxspeed(backward,profile)
@@ -450,9 +450,12 @@ function WayHandlers.parse_maxspeed(source,profile)
if not source then
return 0
end
local n = Measure.get_max_speed(source)
if not n then
local n = tonumber(source:match("%d*"))
if n then
if string.match(source, "mph") or string.match(source, "mp/h") then
n = (n*1609)/1000
end
else
-- parse maxspeed like FR:urban
source = string.lower(source)
n = profile.maxspeed_table[source]
+4 -9
View File
@@ -94,7 +94,7 @@ std::string waypointTypeToString(const guidance::WaypointType waypoint_type)
return waypoint_type_names[static_cast<std::size_t>(waypoint_type)];
}
util::json::Array coordinateToLonLat(const util::Coordinate &coordinate)
util::json::Array coordinateToLonLat(const util::Coordinate coordinate)
{
util::json::Array array;
array.values.push_back(static_cast<double>(util::toFloating(coordinate.lon)));
@@ -240,22 +240,17 @@ util::json::Object makeRoute(const guidance::Route &route,
return json_route;
}
util::json::Object
makeWaypoint(const util::Coordinate &location, const double &distance, std::string name)
util::json::Object makeWaypoint(const util::Coordinate location, std::string name)
{
util::json::Object waypoint;
waypoint.values["location"] = detail::coordinateToLonLat(location);
waypoint.values["name"] = std::move(name);
waypoint.values["distance"] = distance;
return waypoint;
}
util::json::Object makeWaypoint(const util::Coordinate &location,
const double &distance,
std::string name,
const Hint &hint)
util::json::Object makeWaypoint(const util::Coordinate location, std::string name, const Hint &hint)
{
auto waypoint = makeWaypoint(location, distance, name);
auto waypoint = makeWaypoint(location, name);
waypoint.values["hint"] = hint.ToBase64();
return waypoint;
}
+1 -2
View File
@@ -213,8 +213,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
});
}
auto candidates_lists =
GetPhantomNodesInRange(facade, tidied.parameters, search_radiuses, true);
auto candidates_lists = GetPhantomNodesInRange(facade, tidied.parameters, search_radiuses);
filterCandidates(tidied.parameters.coordinates, candidates_lists);
if (std::all_of(candidates_lists.begin(),
+3 -25
View File
@@ -95,10 +95,8 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
return Error("NoTable", "No table found", result);
}
std::vector<api::TableAPI::TableCellRef> estimated_pairs;
// Scan table for null results - if any exist, replace with distance estimates
if (params.fallback_speed != INVALID_FALLBACK_SPEED || params.scale_factor != 1)
if (params.fallback_speed > 0)
{
for (std::size_t row = 0; row < num_sources; row++)
{
@@ -106,8 +104,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
{
const auto &table_index = row * num_destinations + column;
BOOST_ASSERT(table_index < result_tables_pair.first.size());
if (params.fallback_speed != INVALID_FALLBACK_SPEED && params.fallback_speed > 0 &&
result_tables_pair.first[table_index] == MAXIMAL_EDGE_DURATION)
if (result_tables_pair.first[table_index] == MAXIMAL_EDGE_DURATION)
{
const auto &source =
snapped_phantoms[params.sources.empty() ? row : params.sources[row]];
@@ -129,32 +126,13 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
{
result_tables_pair.second[table_index] = distance_estimate;
}
estimated_pairs.emplace_back(row, column);
}
if (params.scale_factor > 0 && params.scale_factor != 1 &&
result_tables_pair.first[table_index] != MAXIMAL_EDGE_DURATION &&
result_tables_pair.first[table_index] != 0)
{
EdgeDuration diff =
MAXIMAL_EDGE_DURATION / result_tables_pair.first[table_index];
if (params.scale_factor >= diff)
{
result_tables_pair.first[table_index] = MAXIMAL_EDGE_DURATION - 1;
}
else
{
result_tables_pair.first[table_index] = std::lround(
result_tables_pair.first[table_index] * params.scale_factor);
}
}
}
}
}
api::TableAPI table_api{facade, params};
table_api.MakeResponse(result_tables_pair, snapped_phantoms, estimated_pairs, result);
table_api.MakeResponse(result_tables_pair, snapped_phantoms, result);
return Status::Ok;
}
+1 -12
View File
@@ -294,7 +294,6 @@ struct SpeedLayer : public vtzero::layer_builder
vtzero::index_value key_duration;
vtzero::index_value key_name;
vtzero::index_value key_rate;
vtzero::index_value key_is_startpoint;
SpeedLayer(vtzero::tile_builder &tile)
: layer_builder(tile, "speeds"), uint_index(*this), double_index(*this),
@@ -303,8 +302,7 @@ struct SpeedLayer : public vtzero::layer_builder
key_datasource(add_key_without_dup_check("datasource")),
key_weight(add_key_without_dup_check("weight")),
key_duration(add_key_without_dup_check("duration")),
key_name(add_key_without_dup_check("name")), key_rate(add_key_without_dup_check("rate")),
key_is_startpoint(add_key_without_dup_check("is_startpoint"))
key_name(add_key_without_dup_check("name")), key_rate(add_key_without_dup_check("rate"))
{
}
@@ -351,11 +349,6 @@ class SpeedLayerFeatureBuilder : public vtzero::linestring_feature_builder
void set_rate(double value) { add_property(m_layer.key_rate, m_layer.double_index(value)); }
void set_is_startpoint(bool value)
{
add_property(m_layer.key_is_startpoint, m_layer.bool_index(value));
}
}; // class SpeedLayerFeatureBuilder
struct TurnsLayer : public vtzero::layer_builder
@@ -492,8 +485,6 @@ void encodeVectorTile(const DataFacadeBase &facade,
const auto reverse_datasource_idx = reverse_datasource_range(
reverse_datasource_range.size() - edge.fwd_segment_position - 1);
const auto is_startpoint = edge.is_startpoint;
const auto component_id = facade.GetComponentID(edge.forward_segment_id.id);
const auto name_id = facade.GetNameIndex(edge.forward_segment_id.id);
auto name = facade.GetNameForID(name_id);
@@ -525,7 +516,6 @@ void encodeVectorTile(const DataFacadeBase &facade,
fbuilder.set_duration(forward_duration / 10.0);
fbuilder.set_name(name);
fbuilder.set_rate(forward_rate / 10.0);
fbuilder.set_is_startpoint(is_startpoint);
fbuilder.commit();
}
@@ -559,7 +549,6 @@ void encodeVectorTile(const DataFacadeBase &facade,
fbuilder.set_duration(reverse_duration / 10.0);
fbuilder.set_name(name);
fbuilder.set_rate(reverse_rate / 10.0);
fbuilder.set_is_startpoint(is_startpoint);
fbuilder.commit();
}
+2 -35
View File
@@ -73,24 +73,11 @@ Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithm
return Error("InvalidValue", "Invalid coordinate value.", json_result);
}
// Error: first and last points should be waypoints
if (!route_parameters.waypoints.empty() &&
(route_parameters.waypoints[0] != 0 ||
route_parameters.waypoints.back() != (route_parameters.coordinates.size() - 1)))
{
return Error("InvalidValue",
"First and last coordinates must be specified as waypoints.",
json_result);
}
if (!CheckAlgorithms(route_parameters, algorithms, json_result))
return Status::Error;
const auto &facade = algorithms.GetFacade();
auto phantom_node_pairs =
GetPhantomNodes(facade,
route_parameters,
(route_parameters.snapping == api::RouteParameters::SnappingType::Any));
auto phantom_node_pairs = GetPhantomNodes(facade, route_parameters);
if (phantom_node_pairs.size() != route_parameters.coordinates.size())
{
return Error("NoSegment",
@@ -145,27 +132,7 @@ Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithm
if (routes.routes[0].is_valid())
{
auto collapse_legs = !route_parameters.waypoints.empty();
if (collapse_legs)
{
std::vector<bool> waypoint_legs(route_parameters.coordinates.size(), false);
std::for_each(route_parameters.waypoints.begin(),
route_parameters.waypoints.end(),
[&](const std::size_t waypoint_index) {
BOOST_ASSERT(waypoint_index < waypoint_legs.size());
waypoint_legs[waypoint_index] = true;
});
// First and last coordinates should always be waypoints
// This gets validated earlier, but double-checking here, jic
BOOST_ASSERT(waypoint_legs.front());
BOOST_ASSERT(waypoint_legs.back());
for (std::size_t i = 0; i < routes.routes.size(); i++)
{
routes.routes[i] = CollapseInternalRouteResult(routes.routes[i], waypoint_legs);
}
}
route_api.MakeResponse(routes, start_end_nodes, json_result);
route_api.MakeResponse(routes, json_result);
}
else
{
+10 -2
View File
@@ -95,6 +95,12 @@ void EdgeBasedGraphFactory::GetEdgeBasedNodeSegments(std::vector<EdgeBasedNodeSe
swap(nodes, m_edge_based_node_segments);
}
void EdgeBasedGraphFactory::GetStartPointMarkers(std::vector<bool> &node_is_startpoint)
{
using std::swap; // Koenig swap
swap(m_edge_based_node_is_startpoint, node_is_startpoint);
}
void EdgeBasedGraphFactory::GetEdgeBasedNodeWeights(std::vector<EdgeWeight> &output_node_weights)
{
using std::swap; // Koenig swap
@@ -223,9 +229,10 @@ NBGToEBG EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u, const N
edge_id_to_segment_id(nbe_to_ebn_mapping[edge_id_2]),
current_edge_source_coordinate_id,
current_edge_target_coordinate_id,
i,
forward_data.flags.startpoint || reverse_data.flags.startpoint);
i);
m_edge_based_node_is_startpoint.push_back(forward_data.flags.startpoint ||
reverse_data.flags.startpoint);
current_edge_source_coordinate_id = current_edge_target_coordinate_id;
}
@@ -420,6 +427,7 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const WayRestrictionMap &way_re
}
}
BOOST_ASSERT(m_edge_based_node_segments.size() == m_edge_based_node_is_startpoint.size());
BOOST_ASSERT(m_number_of_edge_based_nodes == m_edge_based_node_weights.size());
BOOST_ASSERT(m_number_of_edge_based_nodes == m_edge_based_node_durations.size());
BOOST_ASSERT(m_number_of_edge_based_nodes == m_edge_based_node_distances.size());
+23 -17
View File
@@ -51,7 +51,6 @@
#include <osmium/handler/node_locations_for_ways.hpp>
#include <osmium/index/map/flex_mem.hpp>
#include <osmium/io/any_input.hpp>
#include <osmium/osm/timestamp.hpp>
#include <osmium/thread/pool.hpp>
#include <osmium/visitor.hpp>
@@ -240,6 +239,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
EdgeBasedNodeDataContainer edge_based_nodes_container;
std::vector<EdgeBasedNodeSegment> edge_based_node_segments;
util::DeallocatingVector<EdgeBasedEdge> edge_based_edge_list;
std::vector<bool> node_is_startpoint;
std::vector<EdgeWeight> edge_based_node_weights;
std::vector<EdgeDuration> edge_based_node_durations;
std::vector<EdgeDistance> edge_based_node_distances;
@@ -320,6 +320,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
scripting_environment,
edge_based_nodes_container,
edge_based_node_segments,
node_is_startpoint,
edge_based_node_weights,
edge_based_node_durations,
edge_based_node_distances,
@@ -361,7 +362,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
util::Log() << "Building r-tree ...";
TIMER_START(rtree);
BuildRTree(std::move(edge_based_node_segments), coordinates);
BuildRTree(std::move(edge_based_node_segments), std::move(node_is_startpoint), coordinates);
TIMER_STOP(rtree);
@@ -426,14 +427,6 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
// write .timestamp data file
std::string timestamp = header.get("osmosis_replication_timestamp");
if (config.data_version == "osmosis")
{
files::writeTimestamp(config.GetPath(".osrm.timestamp").string(), timestamp);
}
else
{
files::writeTimestamp(config.GetPath(".osrm.timestamp").string(), config.data_version);
}
if (timestamp.empty())
{
timestamp = "n/a";
@@ -744,6 +737,7 @@ EdgeID Extractor::BuildEdgeExpandedGraph(
// output data
EdgeBasedNodeDataContainer &edge_based_nodes_container,
std::vector<EdgeBasedNodeSegment> &edge_based_node_segments,
std::vector<bool> &node_is_startpoint,
std::vector<EdgeWeight> &edge_based_node_weights,
std::vector<EdgeDuration> &edge_based_node_durations,
std::vector<EdgeDistance> &edge_based_node_distances,
@@ -794,6 +788,7 @@ EdgeID Extractor::BuildEdgeExpandedGraph(
edge_based_graph_factory.GetEdgeBasedEdges(edge_based_edge_list);
edge_based_graph_factory.GetEdgeBasedNodeSegments(edge_based_node_segments);
edge_based_graph_factory.GetStartPointMarkers(node_is_startpoint);
edge_based_graph_factory.GetEdgeBasedNodeWeights(edge_based_node_weights);
edge_based_graph_factory.GetEdgeBasedNodeDurations(edge_based_node_durations);
edge_based_graph_factory.GetEdgeBasedNodeDistances(edge_based_node_distances);
@@ -808,24 +803,35 @@ EdgeID Extractor::BuildEdgeExpandedGraph(
Saves tree into '.ramIndex' and leaves into '.fileIndex'.
*/
void Extractor::BuildRTree(std::vector<EdgeBasedNodeSegment> edge_based_node_segments,
std::vector<bool> node_is_startpoint,
const std::vector<util::Coordinate> &coordinates)
{
util::Log() << "Constructing r-tree of " << edge_based_node_segments.size()
<< " segments build on-top of " << coordinates.size() << " coordinates";
BOOST_ASSERT(node_is_startpoint.size() == edge_based_node_segments.size());
// Filter node based edges based on startpoint
auto start_point_count = std::accumulate(edge_based_node_segments.begin(),
edge_based_node_segments.end(),
0,
[](const size_t so_far, const auto &segment) {
return so_far + (segment.is_startpoint ? 1 : 0);
});
if (start_point_count == 0)
auto out_iter = edge_based_node_segments.begin();
auto in_iter = edge_based_node_segments.begin();
for (auto index : util::irange<std::size_t>(0UL, node_is_startpoint.size()))
{
BOOST_ASSERT(in_iter != edge_based_node_segments.end());
if (node_is_startpoint[index])
{
*out_iter = *in_iter;
out_iter++;
}
in_iter++;
}
auto new_size = out_iter - edge_based_node_segments.begin();
if (new_size == 0)
{
throw util::exception("There are no snappable edges left after processing. Are you "
"setting travel modes correctly in the profile? Cannot continue." +
SOURCE_REF);
}
edge_based_node_segments.resize(new_size);
TIMER_START(construction);
util::StaticRTree<EdgeBasedNodeSegment> rtree(
+1 -6
View File
@@ -56,16 +56,11 @@ std::string getWrongOptionHelp(const engine::api::TableParameters &parameters)
help = "Number of coordinates needs to be at least two.";
}
if (parameters.fallback_speed <= 0)
if (parameters.fallback_speed < 0)
{
help = "fallback_speed must be > 0";
}
if (parameters.scale_factor <= 0)
{
help = "scale_factor must be > 0";
}
return help;
}
} // anon. ns
-12
View File
@@ -302,7 +302,6 @@ std::vector<std::pair<bool, boost::filesystem::path>> Storage::GetStaticFiles()
{REQUIRED, config.GetPath(".osrm.ebg_nodes")},
{REQUIRED, config.GetPath(".osrm.tls")},
{REQUIRED, config.GetPath(".osrm.tld")},
{REQUIRED, config.GetPath(".osrm.timestamp")},
{REQUIRED, config.GetPath(".osrm.maneuver_overrides")},
{REQUIRED, config.GetPath(".osrm.edges")},
{REQUIRED, config.GetPath(".osrm.names")},
@@ -402,17 +401,6 @@ void Storage::PopulateStaticData(const SharedDataIndex &index)
extractor::files::readNames(config.GetPath(".osrm.names"), name_table);
}
// Timestamp mark
{
auto timestamp_ref = make_timestamp_view(index, "/common/timestamp");
std::string ts;
extractor::files::readTimestamp(config.GetPath(".osrm.timestamp"), ts);
if (!ts.empty())
{
memcpy(const_cast<char *>(timestamp_ref.data()), ts.data(), ts.size());
}
}
// Turn lane data
{
auto turn_lane_data = make_lane_data_view(index, "/common/turn_lanes");
-4
View File
@@ -43,10 +43,6 @@ return_code parseArguments(int argc,
boost::program_options::value<boost::filesystem::path>(&extractor_config.profile_path)
->default_value("profiles/car.lua"),
"Path to LUA routing profile")(
"data_version,d",
boost::program_options::value<std::string>(&extractor_config.data_version)
->default_value(""),
"Data version. Leave blank to avoid. osmosis - to get timestamp from file")(
"threads,t",
boost::program_options::value<unsigned int>(&extractor_config.requested_num_threads)
->default_value(tbb::task_scheduler_init::default_num_threads()),
+1 -1
View File
@@ -153,7 +153,7 @@ double perpendicularDistance(const Coordinate segment_source,
web_mercator::fromWGS84(query_location));
nearest_location = web_mercator::toWGS84(projected_nearest);
const double approximate_distance = fccApproximateDistance(query_location, nearest_location);
const double approximate_distance = greatCircleDistance(query_location, nearest_location);
BOOST_ASSERT(0.0 <= approximate_distance);
return approximate_distance;
}
-1
View File
@@ -148,7 +148,6 @@
{"key": "maxspeed", "value": "AT:rural"},
{"key": "maxspeed", "value": "AT:trunk"},
{"key": "maxspeed", "value": "BE:motorway"},
{"key": "maxspeed", "value": "BE-VLG:rural"},
{"key": "maxspeed", "value": "BY:urban"},
{"key": "maxspeed", "value": "BY:motorway"},
{"key": "maxspeed", "value": "CH:rural"},
+1 -1
View File
@@ -10,7 +10,7 @@ exports.three_test_coordinates = [[7.41337, 43.72956],
exports.two_test_coordinates = exports.three_test_coordinates.slice(0, 2)
exports.test_tile = {'at': [17059, 11948, 15], 'size': 156624};
exports.test_tile = {'at': [17059, 11948, 15], 'size': 148750};
// Test files generated by the routing engine; check test/data
if (process.env.OSRM_DATA_PATH !== undefined) {
-24
View File
@@ -319,30 +319,6 @@ test('match: throws on invalid waypoints values, waypoints must correspond with
'Waypoints must correspond with the index of an input coordinate');
});
test('match: throws on invalid waypoints values, waypoints must be an array', function (assert) {
assert.plan(1);
var osrm = new OSRM(data_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: "string"
};
assert.throws(function () { osrm.match(options, function (err, response) { console.log(err); }); },
'Waypoints must be an array of integers corresponding to the input coordinates.');
});
test('match: throws on invalid waypoints values, waypoints must be an array of integers', function (assert) {
assert.plan(1);
var osrm = new OSRM(data_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: [0,1,"string"]
};
assert.throws(function () { osrm.match(options, function (err, response) { console.log(err); }); },
'Waypoint values must be an array of integers');
});
test('match: error on split trace', function(assert) {
assert.plan(1);
var osrm = new OSRM(data_path);
-105
View File
@@ -606,108 +606,3 @@ test('route: route in Monaco without motorways', function(assert) {
});
});
test('route: throws on invalid waypoints values needs at least two', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: [0]
};
assert.throws(function () { osrm.route(options, function (err, response) { }); },
'At least two waypoints must be provided');
});
test('route: throws on invalid waypoints values, needs first and last coordinate indices', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: [1, 2]
};
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
'First and last waypoints values must correspond to first and last coordinate indices');
});
test('route: throws on invalid waypoints values, order matters', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: [2, 0]
};
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
'First and last waypoints values must correspond to first and last coordinate indices');
});
test('route: throws on invalid waypoints values, waypoints must correspond with a coordinate index', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: [0, 3, 2]
};
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
'Waypoints must correspond with the index of an input coordinate');
});
test('route: throws on invalid waypoints values, waypoints must be an array', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: "string"
};
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
'Waypoints must be an array of integers corresponding to the input coordinates.');
});
test('route: throws on invalid waypoints values, waypoints must be an array of integers', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates,
waypoints: [0,1,"string"]
};
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
'Waypoint values must be an array of integers');
});
test('route: throws on invalid waypoints values, waypoints must be an array of integers in increasing order', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates.concat(three_test_coordinates),
waypoints: [0,2,1,5]
};
assert.throws(function () { osrm.route(options, function (err, response) { console.error(`response: ${response}`); console.error(`error: ${err}`); }); },
/Waypoints must be supplied in increasing order/);
});
test('route: throws on invalid snapping values', function (assert) {
assert.plan(1);
var osrm = new OSRM(monaco_path);
var options = {
steps: true,
coordinates: three_test_coordinates.concat(three_test_coordinates),
snapping: "zing"
};
assert.throws(function () { osrm.route(options, function (err, response) { console.error(`response: ${response}`); console.error(`error: ${err}`); }); },
/'snapping' param must be one of \[default, any\]/);
});
test('route: snapping parameter passed through OK', function(assert) {
assert.plan(2);
var osrm = new OSRM(monaco_path);
osrm.route({snapping: "any", coordinates: [[7.448205209414596,43.754001097311544],[7.447122039202185,43.75306156811368]]}, function(err, route) {
assert.ifError(err);
assert.equal(Math.round(route.routes[0].distance * 10), 1314); // Round it to nearest 0.1m to eliminate floating point comparison error
});
});
+2 -45
View File
@@ -234,7 +234,7 @@ tables.forEach(function(annotation) {
});
test('table: ' + annotation + ' table in Monaco without motorways', function(assert) {
assert.plan(2);
assert.plan(1);
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
var options = {
coordinates: two_test_coordinates,
@@ -243,12 +243,11 @@ tables.forEach(function(annotation) {
};
osrm.table(options, function(err, response) {
assert.equal(response[annotation].length, 2);
assert.strictEqual(response.fallback_speed_cells, undefined);
});
});
test('table: ' + annotation + ' table in Monaco with fallback speeds', function(assert) {
assert.plan(2);
assert.plan(1);
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
var options = {
coordinates: two_test_coordinates,
@@ -258,50 +257,8 @@ tables.forEach(function(annotation) {
};
osrm.table(options, function(err, response) {
assert.equal(response[annotation].length, 2);
assert.equal(response['fallback_speed_cells'].length, 0);
});
});
test('table: ' + annotation + ' table in Monaco with invalid fallback speeds and fallback coordinates', function(assert) {
assert.plan(4);
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
var options = {
coordinates: two_test_coordinates,
annotations: [annotation.slice(0,-1)],
fallback_speed: -1
};
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_speed must be > 0/, "should throw on invalid fallback_speeds");
options.fallback_speed = '10';
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_speed must be a number/, "should throw on invalid fallback_speeds");
options.fallback_speed = 10;
options.fallback_coordinate = 'bla';
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate' param must be one of \[input, snapped\]/, "should throw on invalid fallback_coordinate");
options.fallback_coordinate = 10;
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate must be a string: \[input, snapped\]/, "should throw on invalid fallback_coordinate");
});
test('table: ' + annotation + ' table in Monaco with invalid scale factor', function(assert) {
assert.plan(3);
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
var options = {
coordinates: two_test_coordinates,
annotations: [annotation.slice(0,-1)],
scale_factor: -1
};
assert.throws(()=>osrm.table(options, (err, res) => {}), /scale_factor must be > 0/, "should throw on invalid scale_factor value");
options.scale_factor = '-1';
assert.throws(()=>osrm.table(options, (err, res) => {}), /scale_factor must be a number/, "should throw on invalid scale_factor value");
options.scale_factor = 0;
assert.throws(()=>osrm.table(options, (err, res) => {}), /scale_factor must be > 0/, "should throw on invalid scale_factor value");
});
});
+2 -5
View File
@@ -229,8 +229,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
const float /*max_distance*/,
const int /*bearing*/,
const int /*bearing_range*/,
const Approach /*approach*/,
const bool /*use_all_edges*/) const override
const Approach /*approach*/) const override
{
return {};
}
@@ -238,8 +237,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate /*input_coordinate*/,
const float /*max_distance*/,
const Approach /*approach*/,
const bool /*use_all_edges*/) const override
const Approach /*approach*/) const override
{
return {};
}
@@ -341,7 +339,6 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
StringView GetDestinationsForID(const NameID /*id*/) const override { return StringView{}; }
StringView GetExitsForID(const NameID /*id*/) const override { return StringView{}; }
bool GetContinueStraightDefault() const override { return false; }
std::string GetTimestamp() const override { return ""; }
double GetMapMatchingMaxSpeed() const override { return 0; }
const char *GetWeightName() const override { return ""; }
unsigned GetWeightPrecision() const override { return 0; }
+5 -17
View File
@@ -1,8 +1,6 @@
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <cmath>
#include "coordinates.hpp"
#include "equal_json.hpp"
#include "fixture.hpp"
@@ -34,28 +32,18 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture)
// unset snapping dependent hint
for (auto &itr : result.values["waypoints"].get<json::Array>().values)
{
// Hint values aren't stable, so blank it out
itr.get<json::Object>().values["hint"] = "";
// Round value to 6 decimal places for double comparison later
itr.get<json::Object>().values["distance"] =
round(itr.get<json::Object>().values["distance"].get<json::Number>().value * 1000000);
}
const auto location = json::Array{{{7.437070}, {43.749248}}};
json::Object reference{
{{"code", "Ok"},
{"waypoints",
json::Array{{json::Object{{{"name", "Boulevard du Larvotto"},
{"location", location},
{"distance", round(0.137249 * 1000000)},
{"hint", ""}}},
json::Object{{{"name", "Boulevard du Larvotto"},
{"location", location},
{"distance", round(0.137249 * 1000000)},
{"hint", ""}}}}}},
json::Array{
{json::Object{
{{"name", "Boulevard du Larvotto"}, {"location", location}, {"hint", ""}}},
json::Object{
{{"name", "Boulevard du Larvotto"}, {"location", location}, {"hint", ""}}}}}},
{"routes",
json::Array{{json::Object{
{{"distance", 0.},
+3 -6
View File
@@ -36,7 +36,7 @@ void validate_feature_layer(vtzero::layer layer)
BOOST_CHECK_EQUAL(layer.version(), 2);
BOOST_CHECK_EQUAL(to_string(layer.name()), "speeds");
BOOST_CHECK_EQUAL(layer.extent(), osrm::util::vector_tile::EXTENT);
BOOST_CHECK_EQUAL(layer.key_table().size(), 8);
BOOST_CHECK_EQUAL(layer.key_table().size(), 7);
BOOST_CHECK(layer.num_features() > 2500);
while (auto feature = layer.next_feature())
@@ -62,9 +62,6 @@ void validate_feature_layer(vtzero::layer layer)
BOOST_CHECK(props.find("is_small") != props.end());
BOOST_CHECK(props["is_small"].type() == typeid(bool));
BOOST_CHECK(props.find("is_startpoint") != props.end());
BOOST_CHECK(props["is_startpoint"].type() == typeid(bool));
BOOST_CHECK(props.find("datasource") != props.end());
BOOST_CHECK(props["datasource"].type() == typeid(std::string));
@@ -76,7 +73,7 @@ void validate_feature_layer(vtzero::layer layer)
std::count_if(layer.value_table().begin(), layer.value_table().end(), [](auto v) {
return v.type() == vtzero::property_value_type::uint_value;
});
BOOST_CHECK_EQUAL(number_of_uint_values, 78);
BOOST_CHECK_EQUAL(number_of_uint_values, 77);
}
void validate_turn_layer(vtzero::layer layer)
@@ -128,7 +125,7 @@ void validate_node_layer(vtzero::layer layer)
BOOST_CHECK_EQUAL(to_string(layer.name()), "osmnodes");
BOOST_CHECK_EQUAL(layer.extent(), osrm::util::vector_tile::EXTENT);
BOOST_CHECK_EQUAL(layer.key_table().size(), 0);
BOOST_CHECK_EQUAL(layer.num_features(), 1810);
BOOST_CHECK_EQUAL(layer.num_features(), 1791);
while (auto feature = layer.next_feature())
{
+3 -5
View File
@@ -10,6 +10,7 @@
#include "extractor/turn_lane_types.hpp"
#include "guidance/turn_bearing.hpp"
#include "guidance/turn_instruction.hpp"
#include "guidance/turn_instruction.hpp"
#include "engine/algorithm.hpp"
#include "engine/datafacade/algorithm_datafacade.hpp"
@@ -53,7 +54,6 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
{
return 0;
}
std::string GetTimestamp() const override { return ""; }
NodeForwardRange GetUncompressedForwardGeometry(const EdgeID /* id */) const override
{
static NodeID data[] = {0, 1, 2, 3};
@@ -113,8 +113,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
const float /*max_distance*/,
const int /*bearing*/,
const int /*bearing_range*/,
const engine::Approach /*approach*/,
const bool /*use_all_edges*/) const override
const engine::Approach /*approach*/) const override
{
return {};
}
@@ -122,8 +121,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
std::vector<engine::PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate /*input_coordinate*/,
const float /*max_distance*/,
const engine::Approach /*approach*/,
const bool /*use_all_edges*/) const override
const engine::Approach /*approach*/) const override
{
return {};
}
-55
View File
@@ -91,23 +91,6 @@ BOOST_AUTO_TEST_CASE(invalid_table_urls)
49UL);
BOOST_CHECK_EQUAL(testInvalidOptions<TableParameters>("1,2;3,4?fallback_coordinate=asdf"),
28UL);
BOOST_CHECK_EQUAL(testInvalidOptions<TableParameters>("1,2;3,4?fallback_coordinate=10"), 28UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&scale_factor=-1"), 28UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&scale_factor=0"), 28UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&fallback_speed=0"),
28UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&fallback_speed=-1"),
28UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&fallback_speed=0"),
28UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&fallback_speed=-1"),
28UL);
}
BOOST_AUTO_TEST_CASE(valid_route_hint)
@@ -582,44 +565,6 @@ BOOST_AUTO_TEST_CASE(valid_table_urls)
BOOST_CHECK_EQUAL(result_7->annotations & TableParameters::AnnotationsType::Distance, true);
CHECK_EQUAL_RANGE(reference_7.sources, result_7->sources);
CHECK_EQUAL_RANGE(reference_7.destinations, result_7->destinations);
TableParameters reference_8{};
reference_8.coordinates = coords_1;
auto result_8 =
parseParameters<TableParameters>("1,2;3,4?annotations=distance&fallback_speed=2.5");
BOOST_CHECK(result_8);
BOOST_CHECK_EQUAL(result_8->annotations & TableParameters::AnnotationsType::Distance, true);
CHECK_EQUAL_RANGE(reference_8.sources, result_8->sources);
CHECK_EQUAL_RANGE(reference_8.destinations, result_8->destinations);
TableParameters reference_9{};
reference_9.coordinates = coords_1;
auto result_9 = parseParameters<TableParameters>(
"1,2;3,4?annotations=distance&fallback_speed=2.5&fallback_coordinate=input");
BOOST_CHECK(result_9);
BOOST_CHECK_EQUAL(result_9->annotations & TableParameters::AnnotationsType::Distance, true);
CHECK_EQUAL_RANGE(reference_9.sources, result_9->sources);
CHECK_EQUAL_RANGE(reference_9.destinations, result_9->destinations);
TableParameters reference_10{};
reference_10.coordinates = coords_1;
auto result_10 = parseParameters<TableParameters>(
"1,2;3,4?annotations=distance&fallback_speed=20&fallback_coordinate=snapped");
BOOST_CHECK(result_10);
BOOST_CHECK_EQUAL(result_10->annotations & TableParameters::AnnotationsType::Distance, true);
CHECK_EQUAL_RANGE(reference_10.sources, result_10->sources);
CHECK_EQUAL_RANGE(reference_10.destinations, result_10->destinations);
auto result_11 = parseParameters<TableParameters>("1,2;3,4?sources=all&destinations=all&"
"annotations=duration&fallback_speed=1&"
"fallback_coordinate=snapped&scale_factor=2");
BOOST_CHECK(result_11);
CHECK_EQUAL_RANGE(reference_1.sources, result_11->sources);
CHECK_EQUAL_RANGE(reference_1.destinations, result_11->destinations);
CHECK_EQUAL_RANGE(reference_1.bearings, result_11->bearings);
CHECK_EQUAL_RANGE(reference_1.radiuses, result_11->radiuses);
CHECK_EQUAL_RANGE(reference_1.approaches, result_11->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_11->coordinates);
}
BOOST_AUTO_TEST_CASE(valid_match_urls)
+19 -53
View File
@@ -135,7 +135,6 @@ template <unsigned NUM_NODES, unsigned NUM_EDGES> struct RandomGraphFixture
TestData data;
data.u = edge_udist(g);
data.v = edge_udist(g);
data.is_startpoint = true;
if (used_edges.find(std::pair<unsigned, unsigned>(
std::min(data.u, data.v), std::max(data.u, data.v))) == used_edges.end())
{
@@ -152,7 +151,7 @@ template <unsigned NUM_NODES, unsigned NUM_EDGES> struct RandomGraphFixture
struct GraphFixture
{
GraphFixture(const std::vector<std::pair<FloatLongitude, FloatLatitude>> &input_coords,
const std::vector<std::tuple<unsigned, unsigned, bool>> &input_edges)
const std::vector<std::pair<unsigned, unsigned>> &input_edges)
{
for (unsigned i = 0; i < input_coords.size(); i++)
@@ -163,16 +162,15 @@ struct GraphFixture
for (const auto &pair : input_edges)
{
TestData d;
d.u = std::get<0>(pair);
d.v = std::get<1>(pair);
d.u = pair.first;
d.v = pair.second;
// We set the forward nodes to the target node-based-node IDs, just
// so we have something to test against. Because this isn't a real
// graph, the actual values aren't important, we just need something
// to examine during tests.
d.forward_segment_id = {std::get<1>(pair), true};
d.reverse_segment_id = {std::get<0>(pair), true};
d.forward_segment_id = {pair.second, true};
d.reverse_segment_id = {pair.first, true};
d.fwd_segment_position = 0;
d.is_startpoint = std::get<2>(pair);
edges.emplace_back(d);
}
}
@@ -301,7 +299,7 @@ BOOST_FIXTURE_TEST_CASE(construct_multiple_levels_test, TestRandomGraphFixture_M
BOOST_AUTO_TEST_CASE(regression_test)
{
using Coord = std::pair<FloatLongitude, FloatLatitude>;
using Edge = std::tuple<unsigned, unsigned, bool>;
using Edge = std::pair<unsigned, unsigned>;
GraphFixture fixture(
{
Coord{FloatLongitude{0.0}, FloatLatitude{40.0}}, //
@@ -315,7 +313,7 @@ BOOST_AUTO_TEST_CASE(regression_test)
Coord{FloatLongitude{105.0}, FloatLatitude{5.0}}, //
Coord{FloatLongitude{110.0}, FloatLatitude{0.0}}, //
},
{Edge(0, 1, true), Edge(2, 3, true), Edge(4, 5, true), Edge(6, 7, true), Edge(8, 9, true)});
{Edge(0, 1), Edge(2, 3), Edge(4, 5), Edge(6, 7), Edge(8, 9)});
TemporaryFile tmp;
auto rtree = make_rtree<MiniStaticRTree>(tmp.path, fixture);
@@ -337,13 +335,13 @@ BOOST_AUTO_TEST_CASE(regression_test)
BOOST_AUTO_TEST_CASE(radius_regression_test)
{
using Coord = std::pair<FloatLongitude, FloatLatitude>;
using Edge = std::tuple<unsigned, unsigned, bool>;
using Edge = std::pair<unsigned, unsigned>;
GraphFixture fixture(
{
Coord(FloatLongitude{0.0}, FloatLatitude{0.0}),
Coord(FloatLongitude{10.0}, FloatLatitude{10.0}),
},
{Edge(0, 1, true), Edge(1, 0, true)});
{Edge(0, 1), Edge(1, 0)});
TemporaryFile tmp;
auto rtree = make_rtree<MiniStaticRTree>(tmp.path, fixture);
@@ -354,54 +352,22 @@ BOOST_AUTO_TEST_CASE(radius_regression_test)
Coordinate input(FloatLongitude{5.2}, FloatLatitude{5.0});
{
auto results = query.NearestPhantomNodesInRange(
input, 0.01, osrm::engine::Approach::UNRESTRICTED, true);
auto results =
query.NearestPhantomNodesInRange(input, 0.01, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 0);
}
}
BOOST_AUTO_TEST_CASE(permissive_edge_snapping)
{
using Coord = std::pair<FloatLongitude, FloatLatitude>;
using Edge = std::tuple<unsigned, unsigned, bool>;
GraphFixture fixture(
{
Coord(FloatLongitude{0.0}, FloatLatitude{0.0}),
Coord(FloatLongitude{0.001}, FloatLatitude{0.001}),
},
{Edge(0, 1, true), Edge(1, 0, false)});
TemporaryFile tmp;
auto rtree = make_rtree<MiniStaticRTree>(tmp.path, fixture);
TestDataFacade mockfacade;
engine::GeospatialQuery<MiniStaticRTree, TestDataFacade> query(
rtree, fixture.coords, mockfacade);
Coordinate input(FloatLongitude{0.0005}, FloatLatitude{0.0005});
{
auto results = query.NearestPhantomNodesInRange(
input, 1000, osrm::engine::Approach::UNRESTRICTED, false);
BOOST_CHECK_EQUAL(results.size(), 1);
}
{
auto results = query.NearestPhantomNodesInRange(
input, 1000, osrm::engine::Approach::UNRESTRICTED, true);
BOOST_CHECK_EQUAL(results.size(), 2);
}
}
BOOST_AUTO_TEST_CASE(bearing_tests)
{
using Coord = std::pair<FloatLongitude, FloatLatitude>;
using Edge = std::tuple<unsigned, unsigned, bool>;
using Edge = std::pair<unsigned, unsigned>;
GraphFixture fixture(
{
Coord(FloatLongitude{0.0}, FloatLatitude{0.0}),
Coord(FloatLongitude{10.0}, FloatLatitude{10.0}),
},
{Edge(0, 1, true), Edge(1, 0, true)});
{Edge(0, 1), Edge(1, 0)});
TemporaryFile tmp;
auto rtree = make_rtree<MiniStaticRTree>(tmp.path, fixture);
@@ -439,20 +405,20 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
}
{
auto results = query.NearestPhantomNodesInRange(
input, 11000, osrm::engine::Approach::UNRESTRICTED, true);
auto results =
query.NearestPhantomNodesInRange(input, 11000, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 2);
}
{
auto results = query.NearestPhantomNodesInRange(
input, 11000, 270, 10, osrm::engine::Approach::UNRESTRICTED, true);
input, 11000, 270, 10, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 0);
}
{
auto results = query.NearestPhantomNodesInRange(
input, 11000, 45, 10, osrm::engine::Approach::UNRESTRICTED, true);
input, 11000, 45, 10, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 2);
BOOST_CHECK(results[0].phantom_node.forward_segment_id.enabled);
@@ -468,7 +434,7 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
BOOST_AUTO_TEST_CASE(bbox_search_tests)
{
using Coord = std::pair<FloatLongitude, FloatLatitude>;
using Edge = std::tuple<unsigned, unsigned, bool>;
using Edge = std::pair<unsigned, unsigned>;
GraphFixture fixture(
{
@@ -478,7 +444,7 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests)
Coord(FloatLongitude{3.0}, FloatLatitude{3.0}),
Coord(FloatLongitude{4.0}, FloatLatitude{4.0}),
},
{Edge(0, 1, true), Edge(1, 2, true), Edge(2, 3, true), Edge(3, 4, true)});
{Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 4)});
TemporaryFile tmp;
auto rtree = make_rtree<MiniStaticRTree>(tmp.path, fixture);
+7040
View File
File diff suppressed because it is too large Load Diff