Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4968d7f9d9 | |||
| c26f0612d1 | |||
| de41299eda | |||
| c37bbfd07a | |||
| 0fd1fb2904 | |||
| 7ebd21f39e | |||
| 8ef366e061 | |||
| 367933fc1a | |||
| c28ba66039 | |||
| d0e3e2af23 | |||
| 8526cc7d45 | |||
| 016440fc7e | |||
| 6e77d53946 | |||
| 99875b4d24 | |||
| c315a586f7 | |||
| 69c38401bc | |||
| e219eb9442 | |||
| 31e31a63d0 | |||
| b437ce5b33 | |||
| 5723eaaa6a | |||
| 0f7b86b099 | |||
| 14dcf91812 |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
name: Question
|
||||
about: Ask a question about OSRM
|
||||
labels: question
|
||||
---
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
- run: cmake --version
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 18
|
||||
- run: node --version
|
||||
- run: npm --version
|
||||
- name: Prepare environment
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 18
|
||||
- name: Enable Node.js cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@@ -147,7 +147,7 @@ jobs:
|
||||
include:
|
||||
- name: gcc-9-debug-cov
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Debug
|
||||
@@ -158,7 +158,7 @@ jobs:
|
||||
|
||||
- name: gcc-9-debug-asan-ubsan
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Debug
|
||||
@@ -172,7 +172,7 @@ jobs:
|
||||
|
||||
- name: clang-6.0-debug
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Debug
|
||||
@@ -182,7 +182,7 @@ jobs:
|
||||
|
||||
- name: clang-15.0-debug-clang-tidy
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-22.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Debug
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
|
||||
- name: conan-linux-debug-asan-ubsan
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -204,7 +204,7 @@ jobs:
|
||||
|
||||
- name: conan-linux-release
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -214,7 +214,7 @@ jobs:
|
||||
|
||||
- name: gcc-12-release
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-22.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -225,7 +225,7 @@ jobs:
|
||||
|
||||
- name: gcc-11-release
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -235,7 +235,7 @@ jobs:
|
||||
|
||||
- name: gcc-10-release
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -244,7 +244,7 @@ jobs:
|
||||
|
||||
- name: gcc-9-release
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -254,7 +254,7 @@ jobs:
|
||||
|
||||
- name: gcc-9-conan-release-i686
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -267,7 +267,7 @@ jobs:
|
||||
|
||||
- name: gcc-8-release
|
||||
continue-on-error: false
|
||||
node: 16
|
||||
node: 18
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
@@ -278,7 +278,7 @@ jobs:
|
||||
- name: conan-linux-release-node
|
||||
build_node_package: true
|
||||
continue-on-error: false
|
||||
node: 18
|
||||
node: 20
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Release
|
||||
CCOMPILER: clang-6.0
|
||||
@@ -289,7 +289,7 @@ jobs:
|
||||
- name: conan-linux-debug-node
|
||||
build_node_package: true
|
||||
continue-on-error: false
|
||||
node: 18
|
||||
node: 20
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Debug
|
||||
CCOMPILER: clang-6.0
|
||||
@@ -300,7 +300,7 @@ jobs:
|
||||
- name: conan-macos-x64-release-node
|
||||
build_node_package: true
|
||||
continue-on-error: true
|
||||
node: 18
|
||||
node: 20
|
||||
runs-on: macos-11
|
||||
BUILD_TYPE: Release
|
||||
CCOMPILER: clang
|
||||
@@ -312,7 +312,7 @@ jobs:
|
||||
- name: conan-macos-arm64-release-node
|
||||
build_node_package: true
|
||||
continue-on-error: true
|
||||
node: 18
|
||||
node: 20
|
||||
runs-on: macos-11
|
||||
BUILD_TYPE: Release
|
||||
CCOMPILER: clang
|
||||
@@ -369,9 +369,9 @@ jobs:
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.conan
|
||||
key: v6-conan-${{ matrix.name }}-${{ github.sha }}
|
||||
key: v7-conan-${{ matrix.name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
v6-conan-${{ matrix.name }}-
|
||||
v7-conan-${{ matrix.name }}-
|
||||
- name: Enable test cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@@ -462,6 +462,12 @@ jobs:
|
||||
fi
|
||||
echo "CC=${CCOMPILER}" >> $GITHUB_ENV
|
||||
echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV
|
||||
if [[ "${RUNNER_OS}" == "macOS" ]]; then
|
||||
# missing from GCC path, needed for conan builds of libiconv, for example.
|
||||
sudo xcode-select --switch /Library/Developer/CommandLineTools
|
||||
echo "LIBRARY_PATH=${LIBRARY_PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" >> $GITHUB_ENV
|
||||
echo "CPATH=${CPATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build and install OSRM
|
||||
run: |
|
||||
@@ -541,16 +547,6 @@ jobs:
|
||||
./src/benchmarks/rtree-bench ../test/data/monaco.osrm.ramIndex ../test/data/monaco.osrm.fileIndex ../test/data/monaco.osrm.nbg_nodes
|
||||
popd
|
||||
|
||||
- name: Use Node 16
|
||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
- name: Run Node package tests on Node 16
|
||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||
run: |
|
||||
node --version
|
||||
npm run nodejs-tests
|
||||
- name: Use Node 18
|
||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||
uses: actions/setup-node@v3
|
||||
@@ -561,6 +557,16 @@ jobs:
|
||||
run: |
|
||||
node --version
|
||||
npm run nodejs-tests
|
||||
- name: Use Node 20
|
||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Run Node package tests on Node 20
|
||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||
run: |
|
||||
node --version
|
||||
npm run nodejs-tests
|
||||
- name: Use Node latest
|
||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' && matrix.ENABLE_APPLE_SILICON != 'ON' }}
|
||||
uses: actions/setup-node@v3
|
||||
@@ -585,15 +591,16 @@ jobs:
|
||||
lcov --directory . --capture --output-file coverage.info # capture coverage info
|
||||
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
|
||||
lcov --list coverage.info #debug info
|
||||
# Uploading report to CodeCov
|
||||
- name: Upload code coverage
|
||||
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
files: coverage.info
|
||||
name: codecov-osrm-backend
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
|
||||
# # Uploading report to CodeCov
|
||||
# - name: Upload code coverage
|
||||
# if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
|
||||
# uses: codecov/codecov-action@v1
|
||||
# with:
|
||||
# files: coverage.info
|
||||
# name: codecov-osrm-backend
|
||||
# fail_ci_if_error: true
|
||||
# verbose: true
|
||||
- name: Check Apple Silicon binary
|
||||
if: ${{ matrix.ENABLE_APPLE_SILICON == 'ON' }}
|
||||
run: |
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Unreleased
|
||||
- Changes from 5.27.1
|
||||
- Features
|
||||
- ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674)
|
||||
- ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575)
|
||||
- ADDED: Add support for disabling feature datasets. [#6666](https://github.com/Project-OSRM/osrm-backend/pull/6666)
|
||||
- ADDED: Add support for opposite approach request parameter. [#6842](https://github.com/Project-OSRM/osrm-backend/pull/6842)
|
||||
- ADDED: Add support for accessing edge flags in `process_segment` [#6658](https://github.com/Project-OSRM/osrm-backend/pull/6658)
|
||||
- Build:
|
||||
- ADDED: Add CI job which builds OSRM with gcc 12. [#6455](https://github.com/Project-OSRM/osrm-backend/pull/6455)
|
||||
- CHANGED: Upgrade to clang-tidy 15. [#6439](https://github.com/Project-OSRM/osrm-backend/pull/6439)
|
||||
- CHANGED: Update actions/cache to v3. [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
|
||||
- REMOVED: Drop support of Node 12 & 14. [#6431](https://github.com/Project-OSRM/osrm-backend/pull/6431)
|
||||
- ADDED: Add 'load directly' mode to default Cucumber test suite. [#6663](https://github.com/Project-OSRM/osrm-backend/pull/6663)
|
||||
- CHANGED: Drop support for Node 16 [#6855](https://github.com/Project-OSRM/osrm-backend/pull/6855)
|
||||
- NodeJS:
|
||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||
- Misc:
|
||||
@@ -30,10 +34,16 @@
|
||||
- FIXED: Added a variable to preprocessor guard in file osrm-backend/include/util/range_table.hpp to solve build error. [#6596](https://github.com/Project-OSRM/osrm-backend/pull/6596)
|
||||
- FIXED: Ensure required file check in osrm-routed is correctly enforced. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
|
||||
- FIXED: Correct HTTP docs to reflect summary output dependency on steps parameter. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
|
||||
- ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839)
|
||||
- Profiles:
|
||||
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
|
||||
- Routing:
|
||||
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
|
||||
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
|
||||
- FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739)
|
||||
- Debug tiles:
|
||||
- FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726)
|
||||
|
||||
# 5.27.1
|
||||
- Changes from 5.27.0
|
||||
- Misc:
|
||||
|
||||
+55
-36
@@ -73,14 +73,17 @@ include(JSONParser)
|
||||
file(READ "package.json" packagejsonraw)
|
||||
sbeParseJson(packagejson packagejsonraw)
|
||||
|
||||
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)")
|
||||
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
# This regex is not strict enough, but the correct one is too complicated for cmake matching.
|
||||
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
||||
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)([-+][0-9a-zA-Z.-]+)?$")
|
||||
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
set(OSRM_VERSION_PRERELEASE_BUILD ${CMAKE_MATCH_4})
|
||||
|
||||
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
||||
set(OSRM_VERSION packagejson.version)
|
||||
else()
|
||||
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible X.Y.Z, but found ${packagejson.version}")
|
||||
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible label, but found ${packagejson.version}")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
@@ -151,7 +154,7 @@ add_library(UPDATER OBJECT ${UpdaterGlob})
|
||||
add_library(STORAGE OBJECT ${StorageGlob})
|
||||
add_library(ENGINE OBJECT ${EngineGlob})
|
||||
|
||||
if (BUILD_ROUTED)
|
||||
if (BUILD_ROUTED)
|
||||
add_library(SERVER OBJECT ${ServerGlob})
|
||||
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
||||
endif()
|
||||
@@ -312,7 +315,7 @@ add_subdirectory(${FLATBUFFERS_SRC_DIR}
|
||||
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt-9.1.0/include")
|
||||
add_compile_definitions(FMT_HEADER_ONLY)
|
||||
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
|
||||
|
||||
|
||||
|
||||
# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package
|
||||
if (MSVC)
|
||||
@@ -322,22 +325,24 @@ endif()
|
||||
if(ENABLE_CONAN)
|
||||
message(STATUS "Installing dependencies via Conan")
|
||||
|
||||
# Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
|
||||
# Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
|
||||
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR})
|
||||
list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR})
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
|
||||
|
||||
set(CONAN_BOOST_VERSION "1.79.0#96e4902111a2e343a8ba0aa95391bb58")
|
||||
set(CONAN_BZIP2_VERSION "1.0.8#d1b2d5816f25865acf978501dff1f897")
|
||||
set(CONAN_EXPAT_VERSION "2.2.10#916908d4a570ad839edd25322c3268cd")
|
||||
set(CONAN_LUA_VERSION "5.4.4#3ec62efc37cd0a5d80b9e5cb35277360")
|
||||
set(CONAN_TBB_VERSION "2021.3.0#507ec17cbd51a84167e143b20d170eea")
|
||||
|
||||
conan_check(REQUIRED)
|
||||
|
||||
set(CONAN_BOOST_VERSION "1.79.0@#96e4902111a2e343a8ba0aa95391bb58")
|
||||
set(CONAN_BZIP2_VERSION "1.0.8@#d1b2d5816f25865acf978501dff1f897")
|
||||
set(CONAN_EXPAT_VERSION "2.2.10@#916908d4a570ad839edd25322c3268cd")
|
||||
set(CONAN_LUA_VERSION "5.4.4@#3ec62efc37cd0a5d80b9e5cb35277360")
|
||||
set(CONAN_TBB_VERSION "2021.3.0@#507ec17cbd51a84167e143b20d170eea")
|
||||
|
||||
set(CONAN_SYSTEM_INCLUDES ON)
|
||||
|
||||
# TODO:
|
||||
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
|
||||
# TODO:
|
||||
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
|
||||
# with exit code = -1073741515, which means that program cannot load required DLL.
|
||||
if (MSVC)
|
||||
set(TBB_SHARED False)
|
||||
@@ -345,14 +350,14 @@ if(ENABLE_CONAN)
|
||||
set(TBB_SHARED True)
|
||||
endif()
|
||||
|
||||
set(CONAN_ARGS
|
||||
REQUIRES
|
||||
set(CONAN_ARGS
|
||||
REQUIRES
|
||||
"boost/${CONAN_BOOST_VERSION}"
|
||||
"bzip2/${CONAN_BZIP2_VERSION}"
|
||||
"expat/${CONAN_EXPAT_VERSION}"
|
||||
"lua/${CONAN_LUA_VERSION}"
|
||||
"onetbb/${CONAN_TBB_VERSION}"
|
||||
BASIC_SETUP
|
||||
BASIC_SETUP
|
||||
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
|
||||
KEEP_RPATHS
|
||||
NO_OUTPUT_DIRS
|
||||
@@ -361,6 +366,13 @@ if(ENABLE_CONAN)
|
||||
boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
|
||||
BUILD missing
|
||||
)
|
||||
|
||||
# Enable revisions in the conan config
|
||||
execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1 RESULT_VARIABLE RET_CODE)
|
||||
if(NOT "${RET_CODE}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Error setting revisions for Conan: '${RET_CODE}'")
|
||||
endif()
|
||||
|
||||
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
|
||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
|
||||
@@ -389,7 +401,7 @@ if(ENABLE_CONAN)
|
||||
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
|
||||
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
|
||||
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
|
||||
|
||||
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(EXPAT REQUIRED)
|
||||
@@ -462,6 +474,9 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
|
||||
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
|
||||
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
|
||||
|
||||
# Workaround for https://github.com/boostorg/phoenix/issues/111
|
||||
add_dependency_defines(-DBOOST_PHOENIX_STL_TUPLE_H_)
|
||||
|
||||
add_definitions(${OSRM_DEFINES})
|
||||
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
|
||||
|
||||
@@ -639,6 +654,10 @@ install(TARGETS osrm_guidance DESTINATION lib)
|
||||
set(DefaultProfilesDir profiles)
|
||||
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
||||
|
||||
# Install data geojson files to /usr/local/share/osrm/data by default
|
||||
set(DefaultProfilesDir data)
|
||||
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
||||
|
||||
# Setup exporting variables for pkgconfig and subproject
|
||||
#
|
||||
|
||||
@@ -733,23 +752,23 @@ if (ENABLE_FUZZING)
|
||||
add_subdirectory(fuzz)
|
||||
endif ()
|
||||
|
||||
# add headers sanity check target that includes all headers independently
|
||||
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
|
||||
file(GLOB_RECURSE headers_to_check
|
||||
${PROJECT_BINARY_DIR}/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/*.hpp)
|
||||
foreach(header ${headers_to_check})
|
||||
# add headers sanity check target that includes all headers independently
|
||||
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
|
||||
file(GLOB_RECURSE headers_to_check
|
||||
${PROJECT_BINARY_DIR}/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/*.hpp)
|
||||
foreach(header ${headers_to_check})
|
||||
if ("${header}" MATCHES ".*/include/nodejs/.*")
|
||||
# we do not check NodeJS bindings headers
|
||||
continue()
|
||||
endif()
|
||||
get_filename_component(filename ${header} NAME_WE)
|
||||
set(filename "${check_headers_dir}/${filename}.cpp")
|
||||
if (NOT EXISTS ${filename})
|
||||
file(WRITE ${filename} "#include \"${header}\"\n")
|
||||
endif()
|
||||
list(APPEND sources ${filename})
|
||||
endforeach()
|
||||
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
|
||||
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
|
||||
get_filename_component(filename ${header} NAME_WE)
|
||||
set(filename "${check_headers_dir}/${filename}.cpp")
|
||||
if (NOT EXISTS ${filename})
|
||||
file(WRITE ${filename} "#include \"${header}\"\n")
|
||||
endif()
|
||||
list(APPEND sources ${filename})
|
||||
endforeach()
|
||||
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
|
||||
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ For a quick introduction about how the road network is represented in OpenStreet
|
||||
Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
|
||||
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
|
||||
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
|
||||
- [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images
|
||||
- [osrm-backend-docker](https://github.com/project-osrm/osrm-backend/pkgs/container/osrm-backend) - Ready to use Docker images
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ To pass parameters to each location some options support an array-like encoding:
|
||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|
||||
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|
||||
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|
||||
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curbside. |
|
||||
|approaches |`{approach};{approach}[;{approach} ...]` |Restrict the direction on the road network at a waypoint, relative to the input coordinate. |
|
||||
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, the order does not matter. |
|
||||
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|
||||
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of the response and do not want to transfer waste data. |
|
||||
@@ -47,7 +47,7 @@ Where the elements follow the following format:
|
||||
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|
||||
|radius |`double >= 0` or `unlimited` (default) |
|
||||
|hint |Base64 `string` |
|
||||
|approach |`curb` or `unrestricted` (default) |
|
||||
|approach |`curb`, `opposite` or `unrestricted` (default) |
|
||||
|class |A class name determined by the profile or `none`. |
|
||||
|
||||
```
|
||||
|
||||
+4
-4
@@ -63,7 +63,7 @@ Returns the fastest route between two or more coordinates while visiting the way
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
- `options.overview` **[String](https://developer.mozilla.org/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/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/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
`null`/`true`/`false`
|
||||
- `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
|
||||
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||
@@ -101,7 +101,7 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
|
||||
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
|
||||
- `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
|
||||
Must be an integer greater than or equal to `1`. (optional, default `1`)
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
@@ -141,7 +141,7 @@ Optionally returns distance table.
|
||||
- `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use
|
||||
location with given index as source. Default is to use all.
|
||||
- `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate.. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
- `options.fallback_speed` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
|
||||
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points.
|
||||
- `options.scale_factor` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
||||
@@ -298,7 +298,7 @@ Right now, the following combinations are possible:
|
||||
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
|
||||
- `options.source` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
|
||||
- `options.destination` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
|
||||
@@ -32,14 +32,14 @@ Feature: Car - Handle traffic lights
|
||||
| l | traffic_signals |
|
||||
|
||||
When I route I should get
|
||||
| from | to | time | # |
|
||||
| from | to | time | # |
|
||||
| 1 | 2 | 11.1s | no turn with no traffic light |
|
||||
| 3 | 4 | 13.1s | no turn with traffic light |
|
||||
| g | j | 18.7s | turn with no traffic light |
|
||||
| k | n | 20.7s | turn with traffic light |
|
||||
|
||||
|
||||
Scenario: Car - Traffic signal direction
|
||||
Scenario: Car - Traffic signal direction straight
|
||||
Given the node map
|
||||
"""
|
||||
a-1-b-2-c
|
||||
@@ -112,14 +112,14 @@ Feature: Car - Handle traffic lights
|
||||
|
||||
|
||||
|
||||
Scenario: Car - Encounters a traffic light
|
||||
Scenario: Car - Encounters a traffic light direction
|
||||
Given the node map
|
||||
"""
|
||||
a f k
|
||||
| | |
|
||||
b-c-d h-g-i l-m-n
|
||||
| | |
|
||||
e j o
|
||||
a f k p
|
||||
| | | |
|
||||
b-c-d h-g-i l-m-n q-r-s
|
||||
| | | |
|
||||
e j o t
|
||||
|
||||
"""
|
||||
|
||||
@@ -131,53 +131,70 @@ Feature: Car - Handle traffic lights
|
||||
| fgj | primary |
|
||||
| lmn | primary |
|
||||
| kmo | primary |
|
||||
| qrs | primary |
|
||||
| prt | primary |
|
||||
|
||||
And the nodes
|
||||
| node | highway | traffic_signals:direction |
|
||||
| g | traffic_signals | forward |
|
||||
| m | traffic_signals | backward |
|
||||
| g | traffic_signals | |
|
||||
| m | traffic_signals | forward |
|
||||
| r | traffic_signals | backward |
|
||||
|
||||
|
||||
When I route I should get
|
||||
# Base case
|
||||
| from | to | time | # |
|
||||
| a | d | 21.9s | no turn with no traffic light |
|
||||
| a | e | 22.2s | no turn with traffic light |
|
||||
| a | b | 18.7s | turn with no traffic light |
|
||||
| e | b | 21.9s | no turn with no traffic light |
|
||||
| e | a | 22.2s | no turn with traffic light |
|
||||
| a | e | 22.2s | no turn with no traffic light |
|
||||
| a | d | 21.9s | turn with no traffic light |
|
||||
| e | b | 21.9s | turn with no traffic light |
|
||||
| e | a | 22.2s | no turn with no traffic light |
|
||||
| e | d | 18.7s | turn with no traffic light |
|
||||
| d | e | 21.9s | no turn with no traffic light |
|
||||
| d | b | 11s | no turn with traffic light |
|
||||
| d | e | 21.9s | turn with no traffic light |
|
||||
| d | b | 11s | no turn with no traffic light |
|
||||
| d | a | 18.7s | turn with no traffic light |
|
||||
| b | a | 21.9s | no turn with no traffic light |
|
||||
| b | d | 11s | no turn with traffic light |
|
||||
| b | a | 21.9s | turn with no traffic light |
|
||||
| b | d | 11s | no turn with no traffic light |
|
||||
| b | e | 18.7s | turn with no traffic light |
|
||||
|
||||
| f | i | 23.9s | no turn with no traffic light |
|
||||
# All have traffic lights - 2s penalty
|
||||
| f | h | 20.7s | turn with traffic light |
|
||||
| f | j | 24.2s | no turn with traffic light |
|
||||
| f | h | 20.7s | turn with no traffic light |
|
||||
| j | h | 21.9s | no turn with no traffic light |
|
||||
| j | f | 22.2s | no turn with traffic light |
|
||||
| j | i | 18.7s | turn with no traffic light |
|
||||
| i | j | 21.9s | no turn with no traffic light |
|
||||
| i | h | 11s | no turn with traffic light |
|
||||
| i | f | 18.7s | turn with no traffic light |
|
||||
| h | f | 23.9s | no turn with no traffic light |
|
||||
| f | i | 23.9s | turn with traffic light |
|
||||
| j | h | 23.9s | turn with traffic light |
|
||||
| j | f | 24.2s | no turn with traffic light |
|
||||
| j | i | 20.7s | turn with traffic light |
|
||||
| i | j | 23.9s | turn with traffic light |
|
||||
| i | h | 13s | no turn with traffic light |
|
||||
| i | f | 20.7s | turn with traffic light |
|
||||
| h | f | 23.9s | turn with traffic light |
|
||||
| h | i | 13s | no turn with traffic light |
|
||||
| h | j | 20.7s | turn with no traffic light |
|
||||
|
||||
| k | n | 21.9s | no turn with no traffic light |
|
||||
| k | o | 22.2s | no turn with traffic light |
|
||||
| k | l | 18.7s | turn with no traffic light |
|
||||
| o | l | 23.9s | no turn with no traffic light |
|
||||
| o | k | 24.2s | no turn with traffic light |
|
||||
| o | n | 20.7s | turn with no traffic light |
|
||||
| n | o | 23.9s | no turn with no traffic light |
|
||||
| n | l | 13s | no turn with traffic light |
|
||||
| n | k | 20.7s | turn with no traffic light |
|
||||
| l | k | 21.9s | no turn with no traffic light |
|
||||
| l | n | 11s | no turn with traffic light |
|
||||
| l | o | 18.7s | turn with no traffic light |
|
||||
| h | j | 20.7s | turn with traffic light |
|
||||
# Front direction have traffic lights - 2s penalty
|
||||
| k | l | 20.7s | turn with traffic light |
|
||||
| k | o | 24.2s | no turn with traffic light |
|
||||
| k | n | 23.9s | turn with traffic light |
|
||||
| o | l | 21.9s | turn with no traffic light |
|
||||
| o | k | 22.2s | no turn with no traffic light |
|
||||
| o | n | 18.7s | turn with no traffic light |
|
||||
| n | o | 21.9s | turn with no traffic light |
|
||||
| n | l | 11s | no turn with no traffic light |
|
||||
| n | k | 18.7s | turn with no traffic light |
|
||||
| l | k | 23.9s | turn with traffic light |
|
||||
| l | n | 13s | no turn with traffic light |
|
||||
| l | o | 20.7s | turn with traffic light |
|
||||
# Reverse direction have traffic lights - 2s penalty
|
||||
| p | q | 18.7s | turn with no traffic light |
|
||||
| p | t | 22.2s | no turn with no traffic light |
|
||||
| p | s | 21.9s | turn with no traffic light |
|
||||
| t | q | 23.9s | turn with traffic light |
|
||||
| t | p | 24.2s | no turn with traffic light |
|
||||
| t | s | 20.7s | turn with traffic light |
|
||||
| s | t | 23.9s | turn with traffic light |
|
||||
| s | q | 13s | no turn with traffic light |
|
||||
| s | p | 20.7s | turn with traffic light |
|
||||
| q | p | 21.9s | turn with no traffic light |
|
||||
| q | s | 11s | no turn with no traffic light |
|
||||
| q | t | 18.7s | turn with no traffic light |
|
||||
|
||||
|
||||
Scenario: Traffic Signal Geometry
|
||||
@@ -343,3 +360,106 @@ Feature: Car - Handle traffic lights
|
||||
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
|
||||
| a | c | abc,abc | 65 km/h | 22.2,0 | 22.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||
|
||||
|
||||
Scenario: Car - Traffic signal straight direction with edge compression
|
||||
Given the node map
|
||||
"""
|
||||
a-1-b - c - d-2-e
|
||||
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abcde | primary |
|
||||
|
||||
And the nodes
|
||||
| node | highway | traffic_signals:direction |
|
||||
| c | traffic_signals | forward |
|
||||
|
||||
When I route I should get
|
||||
| from | to | time | weight | # |
|
||||
| 1 | 2 | 35.3s | 35.3 | no turn with traffic light |
|
||||
| 2 | 1 | 33.3s | 33.3 | no turn with no traffic light |
|
||||
|
||||
|
||||
Scenario: Car - Traffic signal turn direction with edge compression
|
||||
Given the node map
|
||||
"""
|
||||
d
|
||||
|
|
||||
2
|
||||
|
|
||||
a-1-b - c - f
|
||||
|
|
||||
e
|
||||
|
||||
j
|
||||
|
|
||||
4
|
||||
|
|
||||
g-3-h - i - k
|
||||
|
|
||||
l
|
||||
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abc | primary |
|
||||
| cf | primary |
|
||||
| fd | primary |
|
||||
| fe | primary |
|
||||
| ghi | primary |
|
||||
| ik | primary |
|
||||
| kj | primary |
|
||||
| kl | primary |
|
||||
|
||||
And the nodes
|
||||
| node | highway | traffic_signals:direction |
|
||||
| k | traffic_signals | forward |
|
||||
|
||||
When I route I should get
|
||||
| from | to | time | weight | # |
|
||||
| 1 | 2 | 44.2s | 44.2 | turn with no traffic light |
|
||||
| 2 | 1 | 41s | 41 | turn with no traffic light |
|
||||
| 3 | 4 | 46.2s | 46.2 | turn with traffic light |
|
||||
| 4 | 3 | 41s | 41 | turn with no traffic light |
|
||||
|
||||
|
||||
Scenario: Car - Traffic signal turn direction with turn restriction
|
||||
Given the node map
|
||||
"""
|
||||
d
|
||||
|
|
||||
2
|
||||
|
|
||||
a-1-b - c - f
|
||||
|
|
||||
e
|
||||
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abc | primary |
|
||||
| cf | primary |
|
||||
| fd | primary |
|
||||
| fe | primary |
|
||||
|
||||
And the nodes
|
||||
| node | highway | traffic_signals:direction |
|
||||
| f | traffic_signals | forward |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | way:via | restriction |
|
||||
| restriction | abc | fe | cf | no_right_turn |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | df | fc | f | right_turn_only |
|
||||
|
||||
When I route I should get
|
||||
| from | to | time | weight | # |
|
||||
| 1 | 2 | 46.2s | 46.2 | turn with traffic light |
|
||||
| 2 | 1 | 41s | 41 | turn with no traffic light |
|
||||
|
||||
@@ -154,3 +154,27 @@ Feature: osrm-extract lua ways:get_nodes()
|
||||
Then it should exit successfully
|
||||
And stdout should contain "node 42"
|
||||
And stdout should contain "way 42"
|
||||
|
||||
Scenario: osrm-extract flags accessible in process_segment function
|
||||
Given the profile file
|
||||
"""
|
||||
functions = require('testbot')
|
||||
|
||||
functions.process_segment = function (profile, segment)
|
||||
print('segment forward ' .. tostring(segment.flags.forward) .. ' backward ' .. tostring(segment.flags.backward))
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
And the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
And the data has been saved to disk
|
||||
When I run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit successfully
|
||||
And stdout should contain "segment forward true backward false"
|
||||
|
||||
@@ -23,6 +23,7 @@ Feature: osrm-routed command line options: help
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-matching-size"
|
||||
And stdout should contain "--default-radius"
|
||||
And stdout should contain "--keepalive-timeout"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-routed - Help, short
|
||||
@@ -44,6 +45,7 @@ Feature: osrm-routed command line options: help
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-matching-size"
|
||||
And stdout should contain "--default-radius"
|
||||
And stdout should contain "--keepalive-timeout"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-routed - Help, long
|
||||
@@ -65,4 +67,5 @@ Feature: osrm-routed command line options: help
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-matching-size"
|
||||
And stdout should contain "--default-radius"
|
||||
And stdout should contain "--keepalive-timeout"
|
||||
And it should exit successfully
|
||||
|
||||
@@ -38,7 +38,41 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc,bc |
|
||||
|
||||
Scenario: Start End opposite approach, option unrestricted for Start and End
|
||||
Scenario: Start End same approach, option unrestricted for Start and opposite for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc |
|
||||
|
||||
Scenario: Start End same approach, option opposite for Start and curb for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | opposite curb | ab,bc,bc |
|
||||
|
||||
Scenario: Start End different approach, option unrestricted for Start and End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
@@ -56,7 +90,7 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted unrestricted | ab,bc |
|
||||
|
||||
Scenario: Start End opposite approach, option unrestricted for Start and curb for End
|
||||
Scenario: Start End different approach, option unrestricted for Start and curb for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
@@ -74,6 +108,43 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc |
|
||||
|
||||
Scenario: Start End different approach, option unrestricted for Start and opposite for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc,bc |
|
||||
|
||||
Scenario: Start End different approach, option curb for Start and opposite for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
e
|
||||
a------b------c-----------d
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| cd |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | curb opposite | cd,cd,ab,ab |
|
||||
|
||||
|
||||
###############
|
||||
# Oneway Test #
|
||||
@@ -111,10 +182,44 @@ Feature: Approach parameter
|
||||
| bc | yes |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc |
|
||||
|
||||
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
|
||||
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and opposite for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc |
|
||||
|
||||
Scenario: Test on oneway segment, Start End same approach, option opposite for Start and curb for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | opposite curb | ab,bc |
|
||||
|
||||
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
@@ -132,7 +237,7 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted unrestricted | ab,bc |
|
||||
|
||||
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
|
||||
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and curb for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
@@ -150,6 +255,42 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc |
|
||||
|
||||
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and opposite for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc |
|
||||
|
||||
Scenario: Test on oneway segment, Start End different approach, option curb for Start and opposite for End
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
s
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | curb opposite | ab,bc |
|
||||
|
||||
##############
|
||||
# UTurn Test #
|
||||
##############
|
||||
@@ -175,6 +316,27 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | |
|
||||
|
||||
Scenario: UTurn test, router can find a route because uturn authorized to reach opposite side
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
e s
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | bc | bc | c | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | curb opposite | bc,ab,ab |
|
||||
|
||||
|
||||
Scenario: UTurn test, router can find a route because he can use the roundabout
|
||||
Given the profile "testbot"
|
||||
@@ -198,8 +360,9 @@ Feature: Approach parameter
|
||||
| restriction | bc | bc | c | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc,bc |
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc,bc |
|
||||
| s | e | opposite curb | ab,bc,bc |
|
||||
|
||||
|
||||
Scenario: Start End same approach, option unrestricted for Start and curb for End, left-hand driving
|
||||
@@ -228,6 +391,32 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc |
|
||||
|
||||
Scenario: Start End same approach, option unrestricted for Start and opposite for End, left-hand driving
|
||||
Given the profile file
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
local testbot_process_way = functions.process_way
|
||||
functions.process_way = function(profile, way, result)
|
||||
testbot_process_way(profile, way, result)
|
||||
result.is_left_hand_driving = true
|
||||
end
|
||||
return functions
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc,bc |
|
||||
|
||||
|
||||
#######################
|
||||
# Left-side countries #
|
||||
@@ -260,9 +449,8 @@ Feature: Approach parameter
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
s
|
||||
s e
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
@@ -271,10 +459,50 @@ Feature: Approach parameter
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc,bc |
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc |
|
||||
|
||||
Scenario: [Left-hand-side] Start End opposite approach, option unrestricted for Start and End
|
||||
Scenario: [Left-hand-side] Start End same approach, option unrestricted for Start and opposite for End
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc,bc |
|
||||
|
||||
Scenario: [Left-hand-side] Start End same approach, option opposite for Start and curb for End
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
e s
|
||||
a------b------c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | opposite curb | bc,ab,ab |
|
||||
|
||||
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and End
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
@@ -295,15 +523,16 @@ Feature: Approach parameter
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted unrestricted | ab,bc |
|
||||
|
||||
Scenario: [Left-hand-side] Start End opposite approach, option unrestricted for Start and curb for End
|
||||
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and curb for End
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
s e
|
||||
s
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
@@ -312,5 +541,122 @@ Feature: Approach parameter
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc |
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted curb | ab,bc,bc |
|
||||
|
||||
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and opposite for End
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
s
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | unrestricted opposite | ab,bc |
|
||||
|
||||
Scenario: [Left-hand-side] Start End different approach, option curb for Start and opposite for End
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
s
|
||||
a------b------c
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
|
||||
When I route I should get
|
||||
| from | to | approaches | route |
|
||||
| s | e | curb opposite | ab,bc |
|
||||
|
||||
|
||||
|
||||
Scenario: Routes with more than two waypoints - uturns allowed
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
2 1
|
||||
a------b------c-----------d
|
||||
|
|
||||
3 | 4
|
||||
e------f------g-----------h
|
||||
|
|
||||
|
|
||||
i
|
||||
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| cd |
|
||||
| bf |
|
||||
| ef |
|
||||
| fg |
|
||||
| gh |
|
||||
| ei |
|
||||
|
||||
And the query options
|
||||
| continue_straight | false |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | approaches | locations | # |
|
||||
| 1,2,3,4 | curb curb curb curb | _,_,_,a,b,f,_,_,i,h,_ | 1,2,2,a,b,f,3,3,i,h,4 (Only u-turn at end of roads) |
|
||||
| 1,2,3,4 | curb unrestricted unrestricted curb | _,_,_,b,f,_,_,h,_ | 1,2,2,b,f,3,3,h,4 (Can u-turn at 2 and 3) |
|
||||
| 1,2,3,4 | opposite opposite opposite opposite | _,d,a,_,_,b,f,i,_,_,_ | 1,d,a,2,2,b,f,i,3,3,4 (Only u-turn at end of roads) |
|
||||
| 1,2,3,4 | opposite unrestricted unrestricted opposite | _,d,_,_,b,f,_,_,_ | 1,d,2,2,b,f,3,3,4 (Can u-turn at 2 and 3) |
|
||||
|
||||
|
||||
Scenario: Routes with more than two waypoints - uturns forbidden
|
||||
Given the profile "testbot"
|
||||
And the node map
|
||||
"""
|
||||
2 1
|
||||
a------b------c-----------d
|
||||
|
|
||||
3 | 4
|
||||
e------f------g-----------h
|
||||
|
|
||||
|
|
||||
i
|
||||
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| cd |
|
||||
| bf |
|
||||
| ef |
|
||||
| fg |
|
||||
| gh |
|
||||
| ei |
|
||||
|
||||
And the query options
|
||||
| continue_straight | true |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | approaches | locations | # |
|
||||
| 1,2,3,4 | curb curb curb curb | _,_,_,a,b,f,_,_,i,h,_ | 1,2,2,a,b,f,3,3,i,h,4 (Only u-turn at end of roads) |
|
||||
| 1,2,3,4 | curb opposite opposite curb | _,a,_,_,b,f,i,_,_,h,_ | 1,a,2,2,b,f,i,3,3,h,4 (switches stops with u-turns) |
|
||||
| 1,2,3,4 | opposite opposite opposite opposite | _,d,a,_,_,b,f,i,_,_,_ | 1,d,a,2,2,b,f,i,3,3,4 (Only u-turn at end of roads) |
|
||||
| 1,2,3,4 | opposite curb curb opposite | _,d,_,_,a,b,f,_,_,i,_ | 1,d,2,2,a,b,f,3,3,i,4 (switches stops with u-turns) |
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace osrm::engine::api
|
||||
* optional per coordinate
|
||||
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
|
||||
* towards true north in clockwise direction, optional per coordinate
|
||||
* - approaches: force the phantom node to start towards the node with the road country side.
|
||||
* - approaches: force the phantom node to start towards the node with the road country side or
|
||||
* its opposite
|
||||
*
|
||||
* \see OSRM, Coordinate, Hint, Bearing, RouteParameters, TableParameters,
|
||||
* NearestParameters, TripParameters, MatchParameters and TileParameters
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace osrm::engine
|
||||
enum class Approach : std::uint8_t
|
||||
{
|
||||
CURB = 0,
|
||||
UNRESTRICTED = 1
|
||||
UNRESTRICTED = 1,
|
||||
OPPOSITE = 2
|
||||
|
||||
};
|
||||
} // namespace osrm::engine
|
||||
|
||||
@@ -558,7 +558,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
{
|
||||
bool isOnewaySegment =
|
||||
!(segment.data.forward_segment_id.enabled && segment.data.reverse_segment_id.enabled);
|
||||
if (!isOnewaySegment && approach == Approach::CURB)
|
||||
if (!isOnewaySegment && (approach == Approach::CURB || approach == Approach::OPPOSITE))
|
||||
{
|
||||
// Check the counter clockwise
|
||||
//
|
||||
@@ -573,6 +573,9 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
if (datafacade.IsLeftHandDriving(segment.data.forward_segment_id.id))
|
||||
input_coordinate_is_at_right = !input_coordinate_is_at_right;
|
||||
|
||||
if (approach == Approach::OPPOSITE)
|
||||
input_coordinate_is_at_right = !input_coordinate_is_at_right;
|
||||
|
||||
return std::make_pair(input_coordinate_is_at_right, (!input_coordinate_is_at_right));
|
||||
}
|
||||
return std::make_pair(true, true);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef OSRM_EXTRACTION_SEGMENT_HPP
|
||||
#define OSRM_EXTRACTION_SEGMENT_HPP
|
||||
|
||||
#include <extractor/node_based_edge.hpp>
|
||||
#include <util/coordinate.hpp>
|
||||
|
||||
namespace osrm::extractor
|
||||
@@ -12,9 +13,10 @@ struct ExtractionSegment
|
||||
const osrm::util::Coordinate target_,
|
||||
double distance_,
|
||||
double weight_,
|
||||
double duration_)
|
||||
double duration_,
|
||||
const NodeBasedEdgeClassification flags_)
|
||||
: source(source_), target(target_), distance(distance_), weight(weight_),
|
||||
duration(duration_)
|
||||
duration(duration_), flags(flags_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,6 +25,7 @@ struct ExtractionSegment
|
||||
const double distance;
|
||||
double weight;
|
||||
double duration;
|
||||
const NodeBasedEdgeClassification flags;
|
||||
};
|
||||
} // namespace osrm::extractor
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class GraphCompressor
|
||||
|
||||
public:
|
||||
void Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const TrafficSignals &traffic_signals,
|
||||
TrafficSignals &traffic_signals,
|
||||
ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
|
||||
@@ -39,7 +39,7 @@ class NodeBasedGraphFactory
|
||||
NodeBasedGraphFactory(ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
const TrafficSignals &traffic_signals,
|
||||
TrafficSignals &traffic_signals,
|
||||
std::unordered_set<NodeID> &&barriers,
|
||||
std::vector<util::Coordinate> &&coordinates,
|
||||
extractor::PackedOSMIDs &&osm_node_ids,
|
||||
@@ -71,7 +71,7 @@ class NodeBasedGraphFactory
|
||||
void Compress(ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
const TrafficSignals &traffic_signals);
|
||||
TrafficSignals &traffic_signals);
|
||||
|
||||
// Most ways are bidirectional, making the geometry in forward and backward direction the same,
|
||||
// except for reversal. We make use of this fact by keeping only one representation of the
|
||||
|
||||
@@ -19,6 +19,21 @@ struct TrafficSignals
|
||||
{
|
||||
return bidirectional_nodes.count(to) > 0 || unidirectional_segments.count({from, to}) > 0;
|
||||
}
|
||||
|
||||
void Compress(NodeID from, NodeID via, NodeID to)
|
||||
{
|
||||
bidirectional_nodes.erase(via);
|
||||
if (unidirectional_segments.count({via, to}))
|
||||
{
|
||||
unidirectional_segments.erase({via, to});
|
||||
unidirectional_segments.insert({from, to});
|
||||
}
|
||||
if (unidirectional_segments.count({via, from}))
|
||||
{
|
||||
unidirectional_segments.erase({via, from});
|
||||
unidirectional_segments.insert({to, from});
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace osrm::extractor
|
||||
|
||||
|
||||
@@ -560,6 +560,10 @@ inline bool argumentsToParameter(const Napi::CallbackInfo &args,
|
||||
{
|
||||
params->approaches.push_back(osrm::Approach::CURB);
|
||||
}
|
||||
else if (approach_str == "opposite")
|
||||
{
|
||||
params->approaches.push_back(osrm::Approach::OPPOSITE);
|
||||
}
|
||||
else if (approach_str == "unrestricted")
|
||||
{
|
||||
params->approaches.push_back(osrm::Approach::UNRESTRICTED);
|
||||
@@ -567,13 +571,14 @@ inline bool argumentsToParameter(const Napi::CallbackInfo &args,
|
||||
else
|
||||
{
|
||||
ThrowError(args.Env(),
|
||||
"'approaches' param must be one of [curb, unrestricted]");
|
||||
"'approaches' param must be one of [curb, opposite, unrestricted]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ThrowError(args.Env(), "Approach must be a string: [curb, unrestricted] or null");
|
||||
ThrowError(args.Env(),
|
||||
"Approach must be a string: [curb, opposite, unrestricted] or null");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +166,9 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
|
||||
qi::lit("bearings=") >
|
||||
(-(qi::short_ > ',' > qi::short_))[ph::bind(add_bearing, qi::_r1, qi::_1)] % ';';
|
||||
|
||||
approach_type.add("unrestricted", engine::Approach::UNRESTRICTED)("curb",
|
||||
engine::Approach::CURB);
|
||||
approach_type.add("unrestricted", engine::Approach::UNRESTRICTED)(
|
||||
"curb", engine::Approach::CURB)("opposite", engine::Approach::OPPOSITE);
|
||||
|
||||
approach_rule = qi::lit("approaches=") >
|
||||
(-approach_type %
|
||||
';')[ph::bind(&engine::api::BaseParameters::approaches, qi::_r1) = qi::_1];
|
||||
|
||||
@@ -35,7 +35,9 @@ class RequestHandler;
|
||||
class Connection : public std::enable_shared_from_this<Connection>
|
||||
{
|
||||
public:
|
||||
explicit Connection(boost::asio::io_context &io_context, RequestHandler &handler);
|
||||
explicit Connection(boost::asio::io_context &io_context,
|
||||
RequestHandler &handler,
|
||||
short keepalive_timeout);
|
||||
Connection(const Connection &) = delete;
|
||||
Connection &operator=(const Connection &) = delete;
|
||||
|
||||
|
||||
@@ -31,18 +31,24 @@ class Server
|
||||
{
|
||||
public:
|
||||
// Note: returns a shared instead of a unique ptr as it is captured in a lambda somewhere else
|
||||
static std::shared_ptr<Server>
|
||||
CreateServer(std::string &ip_address, int ip_port, unsigned requested_num_threads)
|
||||
static std::shared_ptr<Server> CreateServer(std::string &ip_address,
|
||||
int ip_port,
|
||||
unsigned requested_num_threads,
|
||||
short keepalive_timeout)
|
||||
{
|
||||
util::Log() << "http 1.1 compression handled by zlib version " << zlibVersion();
|
||||
const unsigned hardware_threads = std::max(1u, std::thread::hardware_concurrency());
|
||||
const unsigned real_num_threads = std::min(hardware_threads, requested_num_threads);
|
||||
return std::make_shared<Server>(ip_address, ip_port, real_num_threads);
|
||||
return std::make_shared<Server>(ip_address, ip_port, real_num_threads, keepalive_timeout);
|
||||
}
|
||||
|
||||
explicit Server(const std::string &address, const int port, const unsigned thread_pool_size)
|
||||
: thread_pool_size(thread_pool_size), acceptor(io_context),
|
||||
new_connection(std::make_shared<Connection>(io_context, request_handler))
|
||||
explicit Server(const std::string &address,
|
||||
const int port,
|
||||
const unsigned thread_pool_size,
|
||||
const short keepalive_timeout)
|
||||
: thread_pool_size(thread_pool_size), keepalive_timeout(keepalive_timeout),
|
||||
acceptor(io_context), new_connection(std::make_shared<Connection>(
|
||||
io_context, request_handler, keepalive_timeout))
|
||||
{
|
||||
const auto port_string = std::to_string(port);
|
||||
|
||||
@@ -94,7 +100,8 @@ class Server
|
||||
if (!e)
|
||||
{
|
||||
new_connection->start();
|
||||
new_connection = std::make_shared<Connection>(io_context, request_handler);
|
||||
new_connection =
|
||||
std::make_shared<Connection>(io_context, request_handler, keepalive_timeout);
|
||||
acceptor.async_accept(
|
||||
new_connection->socket(),
|
||||
boost::bind(&Server::HandleAccept, this, boost::asio::placeholders::error));
|
||||
@@ -107,6 +114,7 @@ class Server
|
||||
|
||||
RequestHandler request_handler;
|
||||
unsigned thread_pool_size;
|
||||
short keepalive_timeout;
|
||||
boost::asio::io_context io_context;
|
||||
boost::asio::ip::tcp::acceptor acceptor;
|
||||
std::shared_ptr<Connection> new_connection;
|
||||
|
||||
@@ -72,12 +72,20 @@ using FloatLongitude = Alias<double, tag::longitude>;
|
||||
// range checks on these (toFixed/toFloat, etc)
|
||||
using UnsafeFloatLatitude = Alias<double, tag::unsafelatitude>;
|
||||
using UnsafeFloatLongitude = Alias<double, tag::unsafelongitude>;
|
||||
static_assert(std::is_pod<FixedLatitude>(), "FixedLatitude is not a valid alias");
|
||||
static_assert(std::is_pod<FixedLongitude>(), "FixedLongitude is not a valid alias");
|
||||
static_assert(std::is_pod<FloatLatitude>(), "FloatLatitude is not a valid alias");
|
||||
static_assert(std::is_pod<FloatLongitude>(), "FloatLongitude is not a valid alias");
|
||||
static_assert(std::is_pod<UnsafeFloatLatitude>(), "UnsafeFloatLatitude is not a valid alias");
|
||||
static_assert(std::is_pod<UnsafeFloatLongitude>(), "UnsafeFloatLongitude is not a valid alias");
|
||||
static_assert(std::is_standard_layout<FixedLatitude>() && std::is_trivial<FixedLatitude>(),
|
||||
"FixedLatitude is not a valid alias");
|
||||
static_assert(std::is_standard_layout<FixedLongitude>() && std::is_trivial<FixedLongitude>(),
|
||||
"FixedLongitude is not a valid alias");
|
||||
static_assert(std::is_standard_layout<FloatLatitude>() && std::is_trivial<FloatLatitude>(),
|
||||
"FloatLatitude is not a valid alias");
|
||||
static_assert(std::is_standard_layout<FloatLongitude>() && std::is_trivial<FloatLongitude>(),
|
||||
"FloatLongitude is not a valid alias");
|
||||
static_assert(std::is_standard_layout<UnsafeFloatLatitude>() &&
|
||||
std::is_trivial<UnsafeFloatLatitude>(),
|
||||
"UnsafeFloatLatitude is not a valid alias");
|
||||
static_assert(std::is_standard_layout<UnsafeFloatLongitude>() &&
|
||||
std::is_trivial<UnsafeFloatLongitude>(),
|
||||
"UnsafeFloatLongitude is not a valid alias");
|
||||
|
||||
/**
|
||||
* Converts a typed latitude from floating to fixed representation.
|
||||
|
||||
@@ -184,7 +184,8 @@ double getLength(iterator_type begin, const iterator_type end, BinaryOperation o
|
||||
return false;
|
||||
};
|
||||
// side-effect find adding up distances
|
||||
std::adjacent_find(begin, end, functor);
|
||||
// Ignore return value, we are only interested in the side-effect
|
||||
[[maybe_unused]] auto _ = std::adjacent_find(begin, end, functor);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -202,7 +203,8 @@ findClosestDistance(const Coordinate coordinate, const iterator_type begin, cons
|
||||
return false;
|
||||
};
|
||||
|
||||
std::adjacent_find(begin, end, compute_minimum_distance);
|
||||
// Ignore return value, we are only interested in the side-effect
|
||||
[[maybe_unused]] auto _ = std::adjacent_find(begin, end, compute_minimum_distance);
|
||||
return current_min;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ struct FingerPrint
|
||||
|
||||
static_assert(sizeof(FingerPrint) == 8, "FingerPrint has unexpected size");
|
||||
static_assert(std::is_trivial<FingerPrint>::value, "FingerPrint needs to be trivial.");
|
||||
static_assert(std::is_pod<FingerPrint>::value, "FingerPrint needs to be a POD.");
|
||||
static_assert(std::is_standard_layout<FingerPrint>::value,
|
||||
"FingerPrint needs have a standard layout.");
|
||||
} // namespace osrm::util
|
||||
|
||||
#endif /* FingerPrint_H */
|
||||
|
||||
@@ -71,10 +71,12 @@ struct turn_penalty
|
||||
using OSMNodeID = osrm::Alias<std::uint64_t, tag::osm_node_id>;
|
||||
// clang-tidy fires `bugprone-throw-keyword-missing` here for unknown reason
|
||||
// NOLINTNEXTLINE(bugprone-throw-keyword-missing)
|
||||
static_assert(std::is_pod<OSMNodeID>(), "OSMNodeID is not a valid alias");
|
||||
static_assert(std::is_standard_layout<OSMNodeID>() && std::is_trivial<OSMNodeID>(),
|
||||
"OSMNodeID is not a valid alias");
|
||||
using OSMWayID = osrm::Alias<std::uint64_t, tag::osm_way_id>;
|
||||
// NOLINTNEXTLINE(bugprone-throw-keyword-missing)
|
||||
static_assert(std::is_pod<OSMWayID>(), "OSMWayID is not a valid alias");
|
||||
static_assert(std::is_standard_layout<OSMWayID>() && std::is_trivial<OSMWayID>(),
|
||||
"OSMWayID is not a valid alias");
|
||||
|
||||
using DuplicatedNodeID = std::uint64_t;
|
||||
using RestrictionID = std::uint64_t;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define OSRM_VERSION_MAJOR @OSRM_VERSION_MAJOR@
|
||||
#define OSRM_VERSION_MINOR @OSRM_VERSION_MINOR@
|
||||
#define OSRM_VERSION_PATCH @OSRM_VERSION_PATCH@
|
||||
#define OSRM_VERSION_MAJOR @OSRM_VERSION_MAJOR@
|
||||
#define OSRM_VERSION_MINOR @OSRM_VERSION_MINOR@
|
||||
#define OSRM_VERSION_PATCH @OSRM_VERSION_PATCH@
|
||||
#define OSRM_VERSION_PRERELEASE_BUILD "@OSRM_VERSION_PRERELEASE_BUILD@"
|
||||
|
||||
#define OSRM_VERSION__(A,B,C) "v" #A "." #B "." #C
|
||||
#define OSRM_VERSION_(A,B,C) OSRM_VERSION__(A,B,C)
|
||||
#define OSRM_VERSION OSRM_VERSION_(OSRM_VERSION_MAJOR, OSRM_VERSION_MINOR, OSRM_VERSION_PATCH)
|
||||
#define OSRM_VERSION__(A,B,C,D) "v" #A "." #B "." #C D
|
||||
#define OSRM_VERSION_(A,B,C,D) OSRM_VERSION__(A,B,C,D)
|
||||
#define OSRM_VERSION OSRM_VERSION_(OSRM_VERSION_MAJOR, OSRM_VERSION_MINOR, OSRM_VERSION_PATCH, OSRM_VERSION_PRERELEASE_BUILD)
|
||||
|
||||
#endif // VERSION_HPP
|
||||
|
||||
Generated
+635
-633
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -4,7 +4,7 @@
|
||||
"private": false,
|
||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++ designed to run on OpenStreetMap data.",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.10"
|
||||
"@mapbox/node-pre-gyp": "^1.0.11"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
@@ -31,7 +31,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/Project-OSRM/osrm-backend",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.18.10",
|
||||
@@ -40,7 +40,6 @@
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"acorn": "^8.8.0",
|
||||
"ansi-escape-sequences": "^5.1.2",
|
||||
"aws-sdk": "~2.0.31",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"babelify": "^10.0.0",
|
||||
"browserify": "^17.0.0",
|
||||
|
||||
@@ -274,6 +274,7 @@ function setup()
|
||||
["be-bru:rural"] = 70,
|
||||
["be-bru:urban"] = 30,
|
||||
["be-vlg:rural"] = 70,
|
||||
["bg:motorway"] = 140,
|
||||
["by:urban"] = 60,
|
||||
["by:motorway"] = 110,
|
||||
["ca-on:rural"] = 80,
|
||||
@@ -295,6 +296,9 @@ function setup()
|
||||
["nl:trunk"] = 100,
|
||||
['no:rural'] = 80,
|
||||
['no:motorway'] = 110,
|
||||
['ph:urban'] = 40,
|
||||
['ph:rural'] = 80,
|
||||
['ph:motorway'] = 100,
|
||||
['pl:rural'] = 100,
|
||||
['pl:trunk'] = 120,
|
||||
['pl:motorway'] = 140,
|
||||
|
||||
@@ -21,7 +21,7 @@ local https = require('ssl.https')
|
||||
Debug.load_profile(arg[1])
|
||||
|
||||
-- load way from the OSM API
|
||||
local url = 'https://www.openstreetmap.org/api/0.6/way/'..arg[2]
|
||||
local url = 'https://api.openstreetmap.org/api/0.6/way/'..arg[2]
|
||||
local body, statusCode, headers, statusText = https.request(url)
|
||||
|
||||
-- parse way tags
|
||||
|
||||
@@ -508,7 +508,7 @@ void encodeVectorTile(const DataFacadeBase &facade,
|
||||
auto tile_line = coordinatesToTileLine(a, b, tile_bbox);
|
||||
if (!tile_line.empty())
|
||||
{
|
||||
SpeedLayerFeatureBuilder fbuilder{speeds_layer, id};
|
||||
SpeedLayerFeatureBuilder fbuilder{speeds_layer, id++};
|
||||
fbuilder.add_linestring_from_container(tile_line);
|
||||
|
||||
fbuilder.set_speed(speed_kmh_idx);
|
||||
@@ -542,7 +542,7 @@ void encodeVectorTile(const DataFacadeBase &facade,
|
||||
auto tile_line = coordinatesToTileLine(b, a, tile_bbox);
|
||||
if (!tile_line.empty())
|
||||
{
|
||||
SpeedLayerFeatureBuilder fbuilder{speeds_layer, id};
|
||||
SpeedLayerFeatureBuilder fbuilder{speeds_layer, id++};
|
||||
fbuilder.add_linestring_from_container(tile_line);
|
||||
|
||||
fbuilder.set_speed(speed_kmh_idx);
|
||||
|
||||
@@ -608,26 +608,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
BOOST_ASSERT(!edge_data1.reversed);
|
||||
BOOST_ASSERT(!edge_data2.reversed);
|
||||
|
||||
// We write out the mapping between the edge-expanded edges and the original nodes.
|
||||
// Since each edge represents a possible maneuver, external programs can use this to
|
||||
// quickly perform updates to edge weights in order to penalize certain turns.
|
||||
|
||||
// If this edge is 'trivial' -- where the compressed edge corresponds exactly to an
|
||||
// original OSM segment -- we can pull the turn's preceding node ID directly with
|
||||
// `node_along_road_entering`;
|
||||
// otherwise, we need to look up the node immediately preceding the turn from the
|
||||
// compressed edge container.
|
||||
const bool isTrivial = m_compressed_edge_container.IsTrivial(node_based_edge_from);
|
||||
|
||||
const auto &from_node =
|
||||
isTrivial ? node_along_road_entering
|
||||
: m_compressed_edge_container.GetLastEdgeSourceID(node_based_edge_from);
|
||||
|
||||
// compute weight and duration penalties
|
||||
// In theory we shouldn't get a directed traffic light on a turn, as it indicates that
|
||||
// the traffic signal direction was potentially ambiguously annotated on the junction
|
||||
// node But we'll check anyway.
|
||||
const auto is_traffic_light = m_traffic_signals.HasSignal(from_node, intersection_node);
|
||||
const auto is_traffic_light =
|
||||
m_traffic_signals.HasSignal(node_along_road_entering, intersection_node);
|
||||
const auto is_uturn =
|
||||
guidance::getTurnDirection(turn_angle) == guidance::DirectionModifier::UTurn;
|
||||
|
||||
@@ -694,6 +680,21 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
true,
|
||||
false};
|
||||
|
||||
// We write out the mapping between the edge-expanded edges and the original nodes.
|
||||
// Since each edge represents a possible maneuver, external programs can use this to
|
||||
// quickly perform updates to edge weights in order to penalize certain turns.
|
||||
|
||||
// If this edge is 'trivial' -- where the compressed edge corresponds exactly to an
|
||||
// original OSM segment -- we can pull the turn's preceding node ID directly with
|
||||
// `node_along_road_entering`;
|
||||
// otherwise, we need to look up the node immediately preceding the turn from the
|
||||
// compressed edge container.
|
||||
const bool isTrivial = m_compressed_edge_container.IsTrivial(node_based_edge_from);
|
||||
|
||||
const auto &from_node =
|
||||
isTrivial ? node_along_road_entering
|
||||
: m_compressed_edge_container.GetLastEdgeSourceID(node_based_edge_from);
|
||||
|
||||
const auto &to_node =
|
||||
m_compressed_edge_container.GetFirstEdgeTargetID(node_based_edge_to);
|
||||
|
||||
|
||||
@@ -706,7 +706,12 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
const auto accurate_distance =
|
||||
util::coordinate_calculation::greatCircleDistance(source_coord, target_coord);
|
||||
|
||||
ExtractionSegment segment(source_coord, target_coord, distance, weight, duration);
|
||||
ExtractionSegment segment(source_coord,
|
||||
target_coord,
|
||||
distance,
|
||||
weight,
|
||||
duration,
|
||||
edge_iterator->result.flags);
|
||||
scripting_environment.ProcessSegment(segment);
|
||||
|
||||
auto &edge = edge_iterator->result;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace osrm::extractor
|
||||
static constexpr int SECOND_TO_DECISECOND = 10;
|
||||
|
||||
void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const TrafficSignals &traffic_signals,
|
||||
TrafficSignals &traffic_signals,
|
||||
ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
@@ -338,6 +338,9 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
// update any involved turn relations
|
||||
turn_path_compressor.Compress(node_u, node_v, node_w);
|
||||
|
||||
// Update traffic signal paths containing compressed node.
|
||||
traffic_signals.Compress(node_u, node_v, node_w);
|
||||
|
||||
// Forward and reversed compressed edge lengths need to match.
|
||||
// Set a dummy empty penalty weight if opposite value exists.
|
||||
auto set_dummy_penalty = [](EdgeWeight &weight_penalty,
|
||||
|
||||
@@ -887,19 +887,21 @@ CoordinateExtractor::PrepareLengthCache(const std::vector<util::Coordinate> &coo
|
||||
segment_distances.push_back(0);
|
||||
// sentinel
|
||||
// NOLINTNEXTLINE(bugprone-unused-return-value)
|
||||
std::find_if(std::next(std::begin(coordinates)),
|
||||
std::end(coordinates),
|
||||
[last_coordinate = coordinates.front(),
|
||||
limit,
|
||||
&segment_distances,
|
||||
accumulated_distance = 0.](const util::Coordinate current_coordinate) mutable {
|
||||
const auto distance = util::coordinate_calculation::greatCircleDistance(
|
||||
last_coordinate, current_coordinate);
|
||||
accumulated_distance += distance;
|
||||
last_coordinate = current_coordinate;
|
||||
segment_distances.push_back(distance);
|
||||
return accumulated_distance >= limit;
|
||||
});
|
||||
// We're only interested in the side effect of the lambda, not the return value
|
||||
[[maybe_unused]] auto _ = std::find_if(
|
||||
std::next(std::begin(coordinates)),
|
||||
std::end(coordinates),
|
||||
[last_coordinate = coordinates.front(),
|
||||
limit,
|
||||
&segment_distances,
|
||||
accumulated_distance = 0.](const util::Coordinate current_coordinate) mutable {
|
||||
const auto distance = util::coordinate_calculation::greatCircleDistance(
|
||||
last_coordinate, current_coordinate);
|
||||
accumulated_distance += distance;
|
||||
last_coordinate = current_coordinate;
|
||||
segment_distances.push_back(distance);
|
||||
return accumulated_distance >= limit;
|
||||
});
|
||||
return segment_distances;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1092,8 @@ CoordinateExtractor::SampleCoordinates(const std::vector<util::Coordinate> &coor
|
||||
};
|
||||
|
||||
// misuse of adjacent_find. Loop over coordinates, until a total sample length is reached
|
||||
std::adjacent_find(coordinates.begin(), coordinates.end(), add_samples_until_length_limit);
|
||||
[[maybe_unused]] auto _ =
|
||||
std::adjacent_find(coordinates.begin(), coordinates.end(), add_samples_until_length_limit);
|
||||
|
||||
return sampled_coordinates;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ NodeBasedGraphFactory::NodeBasedGraphFactory(
|
||||
ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
const TrafficSignals &traffic_signals,
|
||||
TrafficSignals &traffic_signals,
|
||||
std::unordered_set<NodeID> &&barriers,
|
||||
std::vector<util::Coordinate> &&coordinates,
|
||||
extractor::PackedOSMIDs &&osm_node_ids,
|
||||
@@ -72,7 +72,7 @@ void NodeBasedGraphFactory::BuildCompressedOutputGraph(const std::vector<NodeBas
|
||||
void NodeBasedGraphFactory::Compress(ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
const TrafficSignals &traffic_signals)
|
||||
TrafficSignals &traffic_signals)
|
||||
{
|
||||
GraphCompressor graph_compressor;
|
||||
graph_compressor.Compress(barriers,
|
||||
|
||||
@@ -471,6 +471,36 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
[](ExtractionRelationContainer &cont, const ExtractionRelation::OsmIDTyped &rel_id)
|
||||
-> const ExtractionRelation & { return cont.GetRelationData(rel_id); });
|
||||
|
||||
context.state.new_usertype<NodeBasedEdgeClassification>(
|
||||
"NodeBasedEdgeClassification",
|
||||
"forward",
|
||||
// can't just do &NodeBasedEdgeClassification::forward with bitfields
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.forward; }),
|
||||
"backward",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.backward; }),
|
||||
"is_split",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.is_split; }),
|
||||
"roundabout",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.roundabout; }),
|
||||
"circular",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.circular; }),
|
||||
"startpoint",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.startpoint; }),
|
||||
"restricted",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> bool { return c.restricted; }),
|
||||
"road_classification",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> RoadClassification {
|
||||
return c.road_classification;
|
||||
}),
|
||||
"highway_turn_classification",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> uint8_t {
|
||||
return c.highway_turn_classification;
|
||||
}),
|
||||
"access_turn_classification",
|
||||
sol::property([](NodeBasedEdgeClassification &c) -> uint8_t {
|
||||
return c.access_turn_classification;
|
||||
}));
|
||||
|
||||
context.state.new_usertype<ExtractionSegment>("ExtractionSegment",
|
||||
"source",
|
||||
&ExtractionSegment::source,
|
||||
@@ -481,7 +511,9 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
"weight",
|
||||
&ExtractionSegment::weight,
|
||||
"duration",
|
||||
&ExtractionSegment::duration);
|
||||
&ExtractionSegment::duration,
|
||||
"flags",
|
||||
&ExtractionSegment::flags);
|
||||
|
||||
// Keep in mind .location is available only if .pbf is preprocessed to set the location with the
|
||||
// ref using osmium command "osmium add-locations-to-ways"
|
||||
|
||||
@@ -292,7 +292,7 @@ inline void asyncForTiles(const Napi::CallbackInfo &info,
|
||||
* @param {String} [options.geometries=polyline] Returned route geometry format (influences overview and per step). Can also be `geojson`.
|
||||
* @param {String} [options.overview=simplified] Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`).
|
||||
* @param {Boolean} [options.continue_straight] 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.
|
||||
* @param {Array} [options.approaches] Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
* @param {Array} [options.approaches] Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
* `null`/`true`/`false`
|
||||
* @param {Array} [options.waypoints] Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
|
||||
* @param {String} [options.format] Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||
@@ -337,7 +337,7 @@ Napi::Value Engine::route(const Napi::CallbackInfo &info)
|
||||
* @param {Boolean} [options.generate_hints=true] Whether or not adds a Hint to the response which can be used in subsequent requests.
|
||||
* @param {Number} [options.number=1] Number of nearest segments that should be returned.
|
||||
* Must be an integer greater than or equal to `1`.
|
||||
* @param {Array} [options.approaches] Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
* @param {Array} [options.approaches] Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
* @param {String} [options.format] Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
|
||||
* @param {String} [options.snapping] Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
* @param {Function} callback
|
||||
@@ -384,7 +384,7 @@ Napi::Value Engine::nearest(const Napi::CallbackInfo &info)
|
||||
* @param {Array} [options.sources] An array of `index` elements (`0 <= integer < #coordinates`) to use
|
||||
* location with given index as source. Default is to use all.
|
||||
* @param {Array} [options.destinations] An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
|
||||
* @param {Array} [options.approaches] Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
* @param {Array} [options.approaches] Restrict the direction on the road network at a waypoint, relative to the input coordinate.. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
* @param {Number} [options.fallback_speed] Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
|
||||
* @param {String} [options.fallback_coordinate] Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points.
|
||||
* @param {Number} [options.scale_factor] Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
|
||||
@@ -565,7 +565,7 @@ Napi::Value Engine::match(const Napi::CallbackInfo &info)
|
||||
* @param {Boolean} [options.roundtrip=true] Return route is a roundtrip.
|
||||
* @param {String} [options.source=any] Return route starts at `any` or `first` coordinate.
|
||||
* @param {String} [options.destination=any] Return route ends at `any` or `last` coordinate.
|
||||
* @param {Array} [options.approaches] Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
* @param {Array} [options.approaches] Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
|
||||
* @param {String} [options.snapping] Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
|
||||
*
|
||||
* @returns {Object} containing `waypoints` and `trips`.
|
||||
|
||||
@@ -195,7 +195,9 @@ std::size_t DinicMaxFlow::BlockingFlow(FlowEdges &flow,
|
||||
};
|
||||
|
||||
// augment all adjacent edges
|
||||
std::adjacent_find(path.begin(), path.end(), augment_one);
|
||||
// We're only interested in the side-effect of the augment_one function, the return
|
||||
// value is ignored
|
||||
[[maybe_unused]] auto _ = std::adjacent_find(path.begin(), path.end(), augment_one);
|
||||
};
|
||||
|
||||
const auto augment_all_paths = [&](const NodeID sink_node_id) {
|
||||
|
||||
@@ -162,6 +162,14 @@ int Partitioner::Run(const PartitionerConfig &config)
|
||||
extractor::files::readManeuverOverrides(filename, maneuver_overrides, node_sequences);
|
||||
renumber(maneuver_overrides, permutation);
|
||||
renumber(node_sequences, permutation);
|
||||
|
||||
// Although the vector is already sorted, the rename function changes the identifiers, so
|
||||
// the order is not sorted now. So we sort by `from_node` again, so that later lookups can
|
||||
// be done with a binary search.
|
||||
std::sort(maneuver_overrides.begin(),
|
||||
maneuver_overrides.end(),
|
||||
[](const auto &a, const auto &b) { return a.start_node < b.start_node; });
|
||||
|
||||
extractor::files::writeManeuverOverrides(filename, maneuver_overrides, node_sequences);
|
||||
}
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
|
||||
@@ -7,14 +7,17 @@
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
#include <boost/iostreams/filtering_stream.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm::server
|
||||
{
|
||||
|
||||
Connection::Connection(boost::asio::io_context &io_context, RequestHandler &handler)
|
||||
Connection::Connection(boost::asio::io_context &io_context,
|
||||
RequestHandler &handler,
|
||||
short keepalive_timeout)
|
||||
: strand(boost::asio::make_strand(io_context)), TCP_socket(strand), timer(strand),
|
||||
request_handler(handler)
|
||||
request_handler(handler), keepalive_timeout(keepalive_timeout)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -88,7 +91,9 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
|
||||
{
|
||||
keep_alive = true;
|
||||
current_reply.headers.emplace_back("Connection", "keep-alive");
|
||||
current_reply.headers.emplace_back("Keep-Alive", "timeout=5, max=512");
|
||||
current_reply.headers.emplace_back("Keep-Alive",
|
||||
"timeout=" + fmt::to_string(keepalive_timeout) +
|
||||
", max=" + fmt::to_string(processed_requests));
|
||||
}
|
||||
|
||||
// compress the result w/ gzip/deflate if requested
|
||||
|
||||
+18
-4
@@ -107,7 +107,8 @@ inline unsigned generateServerProgramOptions(const int argc,
|
||||
int &ip_port,
|
||||
bool &trial,
|
||||
EngineConfig &config,
|
||||
int &requested_thread_num)
|
||||
int &requested_thread_num,
|
||||
short &keepalive_timeout)
|
||||
{
|
||||
using boost::filesystem::path;
|
||||
using boost::program_options::value;
|
||||
@@ -140,6 +141,9 @@ inline unsigned generateServerProgramOptions(const int argc,
|
||||
("threads,t",
|
||||
value<int>(&requested_thread_num)->default_value(hardware_threads),
|
||||
"Number of threads to use") //
|
||||
("keepalive-timeout,k",
|
||||
value<short>(&keepalive_timeout)->default_value(5),
|
||||
"Default keepalive-timeout. Default: 5 seconds.") //
|
||||
("shared-memory,s",
|
||||
value<bool>(&config.use_shared_memory)->implicit_value(true)->default_value(false),
|
||||
"Load data from shared memory") //
|
||||
@@ -266,8 +270,16 @@ try
|
||||
boost::filesystem::path base_path;
|
||||
|
||||
int requested_thread_num = 1;
|
||||
const unsigned init_result = generateServerProgramOptions(
|
||||
argc, argv, base_path, ip_address, ip_port, trial_run, config, requested_thread_num);
|
||||
short keepalive_timeout = 5;
|
||||
const unsigned init_result = generateServerProgramOptions(argc,
|
||||
argv,
|
||||
base_path,
|
||||
ip_address,
|
||||
ip_port,
|
||||
trial_run,
|
||||
config,
|
||||
requested_thread_num,
|
||||
keepalive_timeout);
|
||||
if (init_result == INIT_OK_DO_NOT_START_ENGINE)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
@@ -307,6 +319,7 @@ try
|
||||
util::Log() << "Threads: " << requested_thread_num;
|
||||
util::Log() << "IP address: " << ip_address;
|
||||
util::Log() << "IP port: " << ip_port;
|
||||
util::Log() << "Keepalive timeout: " << keepalive_timeout;
|
||||
|
||||
#ifndef _WIN32
|
||||
int sig = 0;
|
||||
@@ -319,7 +332,8 @@ try
|
||||
#endif
|
||||
|
||||
auto service_handler = std::make_unique<server::ServiceHandler>(config);
|
||||
auto routing_server = server::Server::CreateServer(ip_address, ip_port, requested_thread_num);
|
||||
auto routing_server =
|
||||
server::Server::CreateServer(ip_address, ip_port, requested_thread_num, keepalive_timeout);
|
||||
|
||||
routing_server->RegisterServiceHandler(std::move(service_handler));
|
||||
|
||||
|
||||
@@ -323,7 +323,8 @@ double findClosestDistance(const std::vector<Coordinate> &lhs, const std::vector
|
||||
return false;
|
||||
};
|
||||
// NOLINTNEXTLINE(bugprone-unused-return-value)
|
||||
std::find_if(std::begin(lhs), std::end(lhs), compute_minimum_distance_in_rhs);
|
||||
[[maybe_unused]] auto _ =
|
||||
std::find_if(std::begin(lhs), std::end(lhs), compute_minimum_distance_in_rhs);
|
||||
return current_min;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
{"key": "maxspeed", "value": "AT:trunk"},
|
||||
{"key": "maxspeed", "value": "BE:motorway"},
|
||||
{"key": "maxspeed", "value": "BE-VLG:rural"},
|
||||
{"key": "maxspeed", "value": "BG:motorway"},
|
||||
{"key": "maxspeed", "value": "BY:urban"},
|
||||
{"key": "maxspeed", "value": "BY:motorway"},
|
||||
{"key": "maxspeed", "value": "CA-ON:rural"},
|
||||
@@ -171,6 +172,9 @@
|
||||
{"key": "maxspeed", "value": "NL:trunk"},
|
||||
{"key": "maxspeed", "value": "NO:rural"},
|
||||
{"key": "maxspeed", "value": "NO:motorway"},
|
||||
{"key": "maxspeed", "value": "PH:urban"},
|
||||
{"key": "maxspeed", "value": "PH:rural"},
|
||||
{"key": "maxspeed", "value": "PH:motorway"},
|
||||
{"key": "maxspeed", "value": "PL:rural"},
|
||||
{"key": "maxspeed", "value": "PL:trunk"},
|
||||
{"key": "maxspeed", "value": "PL:motorway"},
|
||||
|
||||
@@ -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': 156539};
|
||||
exports.test_tile = {'at': [17059, 11948, 15], 'size': 159125};
|
||||
|
||||
// Test files generated by the routing engine; check test/data
|
||||
if (process.env.OSRM_DATA_PATH !== undefined) {
|
||||
|
||||
@@ -573,7 +573,7 @@ test('route: throws on bad radiuses', function(assert) {
|
||||
});
|
||||
|
||||
test('route: routes Monaco with valid approaches values', function(assert) {
|
||||
assert.plan(3);
|
||||
assert.plan(4);
|
||||
var osrm = new OSRM(monaco_path);
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
@@ -586,6 +586,10 @@ test('route: routes Monaco with valid approaches values', function(assert) {
|
||||
osrm.route(options, function(err, route) {
|
||||
assert.ifError(err);
|
||||
});
|
||||
options.approaches = ['opposite', 'opposite'];
|
||||
osrm.route(options, function(err, route) {
|
||||
assert.ifError(err);
|
||||
});
|
||||
options.approaches = ['unrestricted', null];
|
||||
osrm.route(options, function(err, route) {
|
||||
assert.ifError(err);
|
||||
@@ -609,12 +613,12 @@ test('route: throws on bad approaches', function(assert) {
|
||||
coordinates: two_test_coordinates,
|
||||
approaches: ['curb', 'test']
|
||||
}, function(err, route) {}) },
|
||||
/'approaches' param must be one of \[curb, unrestricted\]/);
|
||||
/'approaches' param must be one of \[curb, opposite, unrestricted\]/);
|
||||
assert.throws(function() { osrm.route({
|
||||
coordinates: two_test_coordinates,
|
||||
approaches: [10, 15]
|
||||
}, function(err, route) {}) },
|
||||
/Approach must be a string: \[curb, unrestricted\] or null/);
|
||||
/Approach must be a string: \[curb, opposite, unrestricted\] or null/);
|
||||
});
|
||||
|
||||
test('route: routes Monaco with custom limits on MLD', function(assert) {
|
||||
|
||||
@@ -451,7 +451,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
boost::none,
|
||||
engine::Approach::CURB,
|
||||
engine::Approach::UNRESTRICTED,
|
||||
engine::Approach::CURB,
|
||||
engine::Approach::OPPOSITE,
|
||||
};
|
||||
RouteParameters reference_18{false,
|
||||
false,
|
||||
@@ -466,7 +466,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
approaches_18};
|
||||
|
||||
auto result_18 = parseParameters<RouteParameters>(
|
||||
"1,2;3,4;5,6;7,8?steps=false&approaches=;curb;unrestricted;curb");
|
||||
"1,2;3,4;5,6;7,8?steps=false&approaches=;curb;unrestricted;opposite");
|
||||
BOOST_CHECK(result_18);
|
||||
BOOST_CHECK_EQUAL(reference_18.steps, result_18->steps);
|
||||
BOOST_CHECK_EQUAL(reference_18.alternatives, result_18->alternatives);
|
||||
|
||||
Reference in New Issue
Block a user