Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49c4df0617 | |||
| db869786a4 | |||
| a3a46c20c4 | |||
| 9500facd9c | |||
| 615e015700 | |||
| 02922ecf5e | |||
| bae1b9c5e2 | |||
| 4c35352707 | |||
| c362a3d46d | |||
| 293a7177d0 | |||
| 8af54ffe83 | |||
| 253c2dc570 | |||
| 0c6bb534fd | |||
| 2d02fad09b | |||
| 361e6b998f | |||
| 210fa9d545 | |||
| 7eafb48d20 | |||
| df0f407591 | |||
| f9a8bcc75c | |||
| f815daf026 | |||
| f393f47d43 | |||
| 1e258ed3fa | |||
| de084f201c | |||
| e34a74d4ac | |||
| bd1391f6f7 | |||
| f54631619a | |||
| 070fa1a24c | |||
| f15285e9ee | |||
| bae21f0d5d | |||
| 305df1fb6e | |||
| 9ab0fca31c | |||
| e2e398edc5 | |||
| b87366132b | |||
| f4ef4b022e | |||
| 81d479304e | |||
| 92b53e5be0 | |||
| cc73e753bd | |||
| 725dc396c7 | |||
| 890f0d8d7e | |||
| c9017090a2 | |||
| e7061591e3 |
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"plugins": ["transform-class-properties"],
|
||||
"presets": [
|
||||
"stage-0",
|
||||
"es2015",
|
||||
|
||||
@@ -46,7 +46,6 @@ Thumbs.db
|
||||
|
||||
# build related files #
|
||||
#######################
|
||||
/_build*
|
||||
/build/
|
||||
/example/build/
|
||||
/test/data/monaco*
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
*
|
||||
!README.md
|
||||
!CHANGELOG.md
|
||||
!CONTRIBUTING.MD
|
||||
!LICENCE.TXT
|
||||
!package.json
|
||||
!package-lock.json
|
||||
!yarn.lock
|
||||
!docs
|
||||
!example
|
||||
!taginfo.json
|
||||
!lib/*.js
|
||||
!profiles/*
|
||||
!profiles/lib/*
|
||||
!profiles/examples/*
|
||||
+2
-1
@@ -19,6 +19,7 @@ branches:
|
||||
- master
|
||||
# enable building tags
|
||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||
- "5.9"
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
@@ -301,7 +302,7 @@ before_install:
|
||||
- mkdir -p ${CMAKE_DIR}
|
||||
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1
|
||||
- export PATH=${CMAKE_DIR}/bin:${PATH}
|
||||
- ${MASON} install tbb 2017_U7 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}
|
||||
- ${MASON} install tbb 2017_20161128 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_20161128)/lib/:${LD_LIBRARY_PATH}
|
||||
- ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH}
|
||||
- |
|
||||
if [[ ! -z ${CLANG_VERSION} ]]; then
|
||||
|
||||
+4
-49
@@ -1,57 +1,12 @@
|
||||
# 5.11.0
|
||||
- Changes from 5.10:
|
||||
- Features
|
||||
- BREAKING: Added support for conditional via-way instructions. This features changes the file format of osrm.restrictions and requires re-extraction
|
||||
- Internals
|
||||
- BREAKING: Traffic signals will no longer be represented as turns internally. This requires re-processing of data but enables via-way turn restrictions across highway=traffic_signals
|
||||
- Additional checks for empty segments when loading traffic data files
|
||||
- Tunes the constants for turns in sharp curves just a tiny bit to circumvent a mix-up in fork directions at a specific intersection (https://github.com/Project-OSRM/osrm-backend/issues/4331)
|
||||
- Infrastructure
|
||||
- Refactor datafacade to make implementing additional DataFacades simpler
|
||||
- Bugfixes
|
||||
- API docs are now buildable again
|
||||
- Suppress unnecessary extra turn instruction when exiting a motorway via a motorway_link onto a primary road (https://github.com/Project-OSRM/osrm-backend/issues/4348 scenario 4)
|
||||
- Suppress unnecessary extra turn instruction when taking a tertiary_link road from a teritary onto a residential road (https://github.com/Project-OSRM/osrm-backend/issues/4348 scenario 2)
|
||||
- Various MSVC++ build environment fixes
|
||||
- Avoid a bug that crashes GCC6
|
||||
- Re-include .npmignore to slim down published modules
|
||||
- Fix a pre-processing bug where incorrect directions could be issued when two turns would have similar instructions and we tried to give them distinct values (https://github.com/Project-OSRM/osrm-backend/pull/4375)
|
||||
- The entry bearing for correct the cardinality of a direction value (https://github.com/Project-OSRM/osrm-backend/pull/4353
|
||||
- Change timezones in West Africa to the WAT zone so they're recognized on the Windows platform
|
||||
|
||||
# 5.10.0
|
||||
- Changes from 5.9:
|
||||
- Profiles:
|
||||
- New version 2 profile API which cleans up a number of things and makes it easier to for profiles to include each other. Profiles using the old version 0 and 1 APIs are still supported.
|
||||
- New required `setup()` function that must return a configuration hash. Storing configuration in globals is deprecated.
|
||||
- Passes the config hash returned in `setup()` as an argument to `process_node/way/segment/turn`.
|
||||
- Properties are now set in `.properties` in the config hash returend by setup().
|
||||
- initialize raster sources in `setup()` instead of in a separate callback.
|
||||
- Renames the `sources` helper to `raster`.
|
||||
- Renames `way_functions` to `process_way` (same for node, segment and turn).
|
||||
- Removes `get_restrictions()`. Instead set `.restrictions` in the config hash in `setup()`.
|
||||
- Removes `get_name_suffix_list()`. Instead set `.suffix_list` in the config hash in `setup()`.
|
||||
- Renames `Handlers` to `WayHandlers`.
|
||||
- Pass functions instead of strings to `WayHandlers.run()`, so it's possible to mix in your own functions.
|
||||
- Reorders arguments to `WayHandlers` functions to match `process_way()`.
|
||||
- Profiles must return a hash of profile functions. This makes it easier for profiles to include each other.
|
||||
- Guidance: add support for throughabouts
|
||||
- Bugfixes
|
||||
- Properly save/retrieve datasource annotations for road segments ([#4346](https://github.com/Project-OSRM/osrm-backend/issues/4346)
|
||||
- Fix conditional restriction grammer parsing so it works for single-day-of-week restrictions ([#4357](https://github.com/Project-OSRM/osrm-backend/pull/4357))
|
||||
- Algorithm)
|
||||
- BREAKING: the file format requires re-processing due to the changes on via-ways
|
||||
- Added support for via-way restrictions
|
||||
- Node.js Bindings:
|
||||
- Include binaries in the `node_modules/.bin` directory so they're in the PATH when running inside Node
|
||||
|
||||
# 5.9.2
|
||||
- API:
|
||||
- `annotations=durations,weights,speeds` values no longer include turn penalty values ([#4330](https://github.com/Project-OSRM/osrm-backend/issues/4330))
|
||||
|
||||
# 5.9.1
|
||||
- Infrastructure
|
||||
- STXXL is not required by default
|
||||
- Changes from 5.9.0:
|
||||
- #4322: Deprecated `UseLane`. Use the intersections array if you require lanes between steps
|
||||
- #4321: Fixes a potential crash in the MLD alternative code path when not even a shortest path can be found
|
||||
- #4324: STXXL is not required by default
|
||||
|
||||
# 5.9.0
|
||||
- Changes from 5.8:
|
||||
|
||||
+21
-27
@@ -14,11 +14,6 @@ if(BUILD_AS_SUBPROJECT)
|
||||
message(STATUS "Building libosrm as subproject.")
|
||||
endif()
|
||||
|
||||
# set OSRM_BUILD_DIR location (might be used in various scripts)
|
||||
if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
|
||||
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
option(ENABLE_MASON "Use mason for dependencies" OFF)
|
||||
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||
@@ -41,7 +36,7 @@ if(ENABLE_MASON)
|
||||
set(MASON_EXPAT_VERSION "2.2.0")
|
||||
set(MASON_LUA_VERSION "5.2.4")
|
||||
set(MASON_BZIP2_VERSION "1.0.6")
|
||||
set(MASON_TBB_VERSION "2017_U7")
|
||||
set(MASON_TBB_VERSION "2017_20161128")
|
||||
set(MASON_LIBSHP_VERSION "1.3.0")
|
||||
|
||||
message(STATUS "Enabling mason")
|
||||
@@ -60,8 +55,8 @@ if (POLICY CMP0048)
|
||||
endif()
|
||||
project(OSRM C CXX)
|
||||
set(OSRM_VERSION_MAJOR 5)
|
||||
set(OSRM_VERSION_MINOR 11)
|
||||
set(OSRM_VERSION_PATCH 0)
|
||||
set(OSRM_VERSION_MINOR 9)
|
||||
set(OSRM_VERSION_PATCH 2)
|
||||
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
|
||||
|
||||
add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
@@ -102,11 +97,11 @@ if(WIN32 AND MSVC_VERSION LESS 1900)
|
||||
endif()
|
||||
|
||||
# Strictly require GCC>=4.9 and Clang>=3.4 - GCC 4.8 is already too old for C++14.
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
message(FATAL_ERROR "GCC>=4.9 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||
message(FATAL_ERROR "Clang>=3.4 required. In case you are on Ubuntu upgrade via http://apt.llvm.org")
|
||||
endif()
|
||||
@@ -182,7 +177,7 @@ endif()
|
||||
|
||||
# Disable LTO when mason+gcc is detected before testing for / setting any flags.
|
||||
# Mason builds libraries with Clang, mixing does not work in the context of lto.
|
||||
if(ENABLE_MASON AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ENABLE_LTO)
|
||||
if(ENABLE_MASON AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND ENABLE_LTO)
|
||||
set(ENABLE_LTO OFF)
|
||||
message(WARNING "Mason and GCC's LTO not work together. Disabling LTO.")
|
||||
endif()
|
||||
@@ -211,9 +206,9 @@ endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "Configuring debug mode flags")
|
||||
set(ENABLE_ASSERTIONS ON)
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-omit-frame-pointer")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
|
||||
else()
|
||||
@@ -232,7 +227,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
|
||||
if(ENABLE_LTO AND LTO_AVAILABLE)
|
||||
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
# GCC in addition allows parallelizing LTO
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(NPROC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=${NPROC}")
|
||||
@@ -255,7 +250,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
|
||||
endif()
|
||||
|
||||
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND
|
||||
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" AND NOT MINGW)
|
||||
find_program(GCC_AR gcc-ar)
|
||||
find_program(GCC_RANLIB gcc-ranlib)
|
||||
@@ -271,7 +266,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
|
||||
endif()
|
||||
|
||||
# Same for clang LTO requires their own toolchain
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
find_program(LLVM_AR llvm-ar)
|
||||
find_program(LLVM_RANLIB llvm-ranlib)
|
||||
if ("${LLVM_AR}" STREQUAL "LLVM_AR-NOTFOUND" OR "${LLVM_RANLIB}" STREQUAL "LLVM_RANLIB-NOTFOUND")
|
||||
@@ -285,7 +280,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0")
|
||||
message(STATUS "Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038")
|
||||
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
|
||||
set(ENABLE_LTO Off)
|
||||
@@ -315,9 +310,9 @@ if (ENABLE_SANITIZER)
|
||||
endif()
|
||||
|
||||
# Configuring compilers
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024 -Wno-unused-command-line-argument")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
set(COLOR_FLAG "-fdiagnostics-color=auto")
|
||||
check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
|
||||
if(NOT HAS_COLOR_FLAG)
|
||||
@@ -337,14 +332,13 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
|
||||
endif()
|
||||
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
||||
# using Intel C++
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} zlib)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # avoid compiler error C1128 from scripting_environment_lua.cpp
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32_LEAN_AND_MEAN") # avoid compiler error C2011 from dual #include of winsock.h and winsock2.h
|
||||
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
|
||||
add_dependency_defines(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_dependency_defines(-DNOMINMAX) # avoid min and max macros that can break compilation
|
||||
@@ -360,7 +354,7 @@ execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ERROR_QUIET OUTPUT
|
||||
# For ld.gold and ld.bfs (the GNU linkers) we optimize hard
|
||||
if("${LINKER_VERSION}" MATCHES "GNU gold" OR "${LINKER_VERSION}" MATCHES "GNU ld")
|
||||
message(STATUS "Setting linker optimizations")
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR "${LD_AVOID_GC_SECTIONS}"))
|
||||
if(NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC" OR "${LD_AVOID_GC_SECTIONS}"))
|
||||
# Tell compiler to put every function in separate section, linker can then match sections and functions
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
|
||||
# Tell linker to do dead code and data eminination during link time discarding sections
|
||||
@@ -378,7 +372,7 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
||||
|
||||
# Activate C++1y
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
|
||||
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++1y")
|
||||
endif()
|
||||
@@ -569,7 +563,7 @@ else()
|
||||
endif()
|
||||
|
||||
# prefix compilation with ccache by default if available and on clang or gcc
|
||||
if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
|
||||
if(ENABLE_CCACHE AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"))
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
message(STATUS "Using ccache to speed up incremental builds")
|
||||
@@ -739,10 +733,10 @@ file(GLOB LibraryGlob include/osrm/*.hpp)
|
||||
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
|
||||
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp)
|
||||
set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
||||
set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
||||
set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp)
|
||||
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
|
||||
set(StorageHeader include/storage/storage.hpp include/storage/io_config.hpp include/storage/storage_config.hpp)
|
||||
set(StorageHeader include/storage/storage.hpp include/storage/storage_config.hpp)
|
||||
install(FILES ${EngineHeader} DESTINATION include/osrm/engine)
|
||||
install(FILES ${UtilHeader} DESTINATION include/osrm/util)
|
||||
install(FILES ${StorageHeader} DESTINATION include/osrm/storage)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ if [ x"$remote" = xorigin ] ; then
|
||||
echo "Rejected push to $remote/master" ; exit 1
|
||||
fi
|
||||
|
||||
./scripts/format.sh && ./scripts/error_on_dirty.sh
|
||||
./scripts/format.sh
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Unstaged format changes" ; exit 1
|
||||
fi
|
||||
|
||||
+29
-30
@@ -27,11 +27,11 @@ var osrm = new OSRM('network.osrm');
|
||||
This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
|
||||
- `options.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
|
||||
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
|
||||
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
|
||||
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query 9default: unlimited).
|
||||
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
|
||||
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited).
|
||||
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map matching query (default: unlimited).
|
||||
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
|
||||
- `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max.number of alternatives supported in alternative routes query (default: 3).
|
||||
- `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternative routes supported (default: 3).
|
||||
|
||||
### route
|
||||
|
||||
@@ -45,16 +45,15 @@ Returns the fastest route between two or more coordinates while visiting the way
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
|
||||
- `options.alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes.
|
||||
_Please note that even if alternative routes are requested, a result cannot be guaranteed._ (optional, default `0`)
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
|
||||
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes and return as well.
|
||||
_Please note that even if an alternative route is requested, a result cannot be guaranteed._ (optional, default `false`)
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route leg. (optional, default `false`)
|
||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
|
||||
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
`null`/`true`/`false`
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
@@ -195,14 +194,14 @@ if they can not be matched successfully.
|
||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route. (optional, default `false`)
|
||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
|
||||
- `options.timestamps` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp).
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`.
|
||||
- `options.gaps` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore` (optional, default `split`).
|
||||
- `options.tidy` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Allows the input track modification to obtain better matching quality for noisy tracks (optional, default `false`).
|
||||
- `options.gaps` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore`. (optional, default `split`)
|
||||
- `options.tidy` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allows the input track modification to obtain better matching quality for noisy tracks. (optional, default `false`)
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
@@ -236,7 +235,25 @@ The trip plugin solves the Traveling Salesman Problem using a greedy heuristic
|
||||
waypoints. The returned path does not have to be the shortest path, _ as TSP is NP-hard it is
|
||||
only an approximation.
|
||||
|
||||
Note that all input coordinates have to be connected for the trip service to work.
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
|
||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route steps for each route. (optional, default `false`)
|
||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
|
||||
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returned route is a roundtrip (route returns to first location). (optional, default `true`)
|
||||
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route starts at `any` or `first` coordinate. (optional, default `any`)
|
||||
- `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route ends at `any` or `last` coordinate. (optional, default `any`)
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
A requirement for computing trips is that all input coordinates are connected.
|
||||
Currently, not all combinations of `roundtrip`, `source` and `destination` are supported.
|
||||
Right now, the following combinations are possible:
|
||||
|
||||
@@ -251,24 +268,6 @@ Right now, the following combinations are possible:
|
||||
| false | any | last | no |
|
||||
| false | any | any | no |
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
|
||||
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
|
||||
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
|
||||
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
|
||||
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
|
||||
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
|
||||
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
|
||||
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
|
||||
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
|
||||
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
|
||||
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
|
||||
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
|
||||
- `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
|
||||
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
|
||||
+45
-192
@@ -1,97 +1,31 @@
|
||||
# OSRM profiles
|
||||
OSRM supports "profiles". Profiles representing routing behavior for different transport modes like car, bike and foot. You can also create profiles for variations like a fastest/shortest car profile or fastest/safest/greenest bicycles profile.
|
||||
|
||||
A profile describes whether or not it's possible to route along a particular type of way, whether we can pass a particular node, and how quickly we'll be traveling when we do. This feeds into the way the routing graph is created and thus influences the output routes.
|
||||
OSRM supports "profiles". Configurations representing different routing behaviours for (typically) different transport modes. A profile describes whether or not we route along a particular type of way, or over a particular node in the OpenStreetMap data, and also how quickly we'll be travelling when we do. This feeds into the way the routing graph is created and thus influences the output routes.
|
||||
|
||||
## Available profiles
|
||||
Out-of-the-box OSRM comes with profiles for car, bicycle and foot. You can easily modify these or create new ones if you like.
|
||||
|
||||
Profiles have a 'lua' extension, and are places in 'profiles' directory.
|
||||
Out-of-the-box OSRM comes with several different profiles, including car, bicycle and foot.
|
||||
|
||||
When running OSRM preprocessing commands you specify the profile with the --profile (or the shorthand -p) option, for example:
|
||||
Profile configuration files have a 'lua' extension, and are found under the 'profiles' subdirectory.
|
||||
Alternatively commands will take a lua profile specified with an explicit -p param, for example:
|
||||
|
||||
`osrm-extract --profile ../profiles/car.lua planet-latest.osm.pbf`
|
||||
`osrm-extract -p ../profiles/car.lua planet-latest.osm.pbf`
|
||||
|
||||
## Processing flow
|
||||
It's important to understand that profiles are used when preprocessing the OSM data, NOT at query time when routes are computed.
|
||||
And then **you will need to extract and contract again** (A change to the profile will typically affect the extract step as well as the contract step. See [Processing Flow](https://github.com/Project-OSRM/osrm-backend/wiki/Processing-Flow))
|
||||
|
||||
This means that after modifying a profile **you will need to extract, contract and reload the data again** and to see changes in the routing results. See [Processing Flow](https://github.com/Project-OSRM/osrm-backend/wiki/Processing-Flow) for more.
|
||||
## lua scripts?
|
||||
|
||||
## Profiles are written in LUA
|
||||
Profiles are not just configuration files. They are scripts written in the [LUA scripting language](http://www.lua.org). The reason for this is that OpenStreetMap data is complex, and it's not possible to simply define tag mappings. LUA scripting offers a powerful way to handle all the possible tag combinations found in OpenStreetMap nodes and ways.
|
||||
Profiles are not just configuration files. They are scripts written in the "lua" scripting language ( http://www.lua.org ) The reason for this, is that OpenStreetMap data is not sufficiently straightforward, to simply define tag mappings. Lua scripting offers a powerful way of coping with the complexity of different node,way,relation,tag combinations found within OpenStreetMap data.
|
||||
|
||||
## Basic structure of profiles
|
||||
A profile will process every node and way in the OSM input data to determine what ways are routable in which direction, at what speed, etc.
|
||||
## Basic structure of a profile
|
||||
|
||||
A profile will typically:
|
||||
You can understand these lua scripts enough to make interesting modifications, without needing to get to grips with how they work completely.
|
||||
|
||||
- Define api version (required)
|
||||
- Require library files (optional)
|
||||
- Define setup function (required)
|
||||
- Define process functions (some are required)
|
||||
- Return functions table (required)
|
||||
Towards the top of the file, a profile (such as [car.lua](../profiles/car.lua)) will typically define various configurations as global variables. A lot of these are look-up hashes of one sort or another.
|
||||
|
||||
A profile can also define various local functions it needs.
|
||||
As you scroll down the file you'll see local variables, and then local functions, and finally...
|
||||
|
||||
Looking at [car.lua](../profiles/car.lua) as an example, at the top of the file the api version is defined and then required library files are included.
|
||||
`way_function` and `node_function` are the important functions which are called when extracting OpenStreetMap data with `osrm-extract`.
|
||||
|
||||
Then follows the `setup` functions, which is called once when the profile is loaded. It returns a big hash table of configurations, specifying things like what speed to use for different way types. The configurations are used later in the various processing functions. Many adjustments can be done just be modifying this configuration table.
|
||||
|
||||
The setup function is also where you can do other setup, like loading elevation data source if you want to consider that when processing ways.
|
||||
|
||||
Then comes the `process_node` and `process_way` functions, which are called for each OSM node and way when extracting OpenStreetMap data with `osrm-extract`.
|
||||
|
||||
The `process_turn` function processes every possible turn in the network, and sets a penalty depending on the angle and turn of the movement.
|
||||
|
||||
Profiles can also define a `process_segment` function to handle differences in speed along an OSM way, for example to handle elevation. As you can see, this is not currently used in the car profile.
|
||||
|
||||
At the end of the file, a table if returned with references to the setup and processing functions the profile has defined.
|
||||
|
||||
## Understanding speed, weight and rate
|
||||
When computing a route from A to B there can be different measure of what is the best route. That's why there's a need for different profiles.
|
||||
|
||||
Because speeds very on different types of roads, the shortest and the fastest route are typically different. But there are many other possible preferences. For example a user might prefer a bicycle route that follow parks or other green areas, even though both duration and distance are a bit longer.
|
||||
|
||||
To handle this, OSRM doesn't simply choose the ways with the highest speed. Instead it uses the concept of `weight` and `rate`. The rate is an abstract measure that you can assign to ways as you like to make some ways preferable to others. Routing will prefer ways with high rate.
|
||||
|
||||
The weight of a way normally computed as length / rate. The weight can be thought of as the resistance or cost when passing the way. Routing will prefer ways with low weight.
|
||||
|
||||
You can also set the weight of a way to a fixed value, In this case it's not calculated based on the length or rate, and the rate is ignored.
|
||||
|
||||
You should set the speed to you best estimate of the actual speed that will be used on a particular way. This will result in the best estimated travel times.
|
||||
|
||||
If you want to prefer certain ways due to other factors than the speed, adjust the rate accordingly. If you adjust the speed, the time time estimation will be skewed.
|
||||
|
||||
If you set the same rate on all ways, the result will be shortest path routing.
|
||||
If you set rate = speed on all ways, the result will be fastest path routing.
|
||||
If you want to prioritize certain street, increase the rate on these.
|
||||
|
||||
## Elements
|
||||
### api_version
|
||||
A profile should set api_version at the top of your profile. This is done to ensure that older profiles are still supported when the api changes. If api_version is not defined, 0 will be assumed. The current api version is 2.
|
||||
|
||||
### Library files
|
||||
The folder [profiles/lib/](../profiles/lib/) contains LUA library files for handling many common processing tasks.
|
||||
|
||||
File | Notes
|
||||
------------------|------------------------------
|
||||
way_handlers.lua | Functions for processing way tags
|
||||
tags.lua | Functions for general parsing of OSM tags
|
||||
set.lua | Defines the Set helper for handling sets of values
|
||||
sequence.lua | Defines the Sequence helper for handling sequences of values
|
||||
access.lua | Function for finding relevant access tags
|
||||
destination.lua | Function for finding relevant destination tags
|
||||
destination.lua | Function for determining maximum speed
|
||||
guidance.lua | Function for processing guidance attributes
|
||||
|
||||
They all return a table of functions when you use `require` to load them. You can either store this table and reference it's functions later, of if you need only a single you can store that directly.
|
||||
|
||||
### setup()
|
||||
The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing.
|
||||
|
||||
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have it's own set of globals.
|
||||
|
||||
The following global properties can be set under `properties` in the hash you return in the `setup` function:
|
||||
The following global properties can be set in your profile:
|
||||
|
||||
Attribute | Type | Notes
|
||||
-------------------------------------|----------|----------------------------------------------------------------------------
|
||||
@@ -102,40 +36,17 @@ use_turn_restrictions | Boolean | Are turn instructions followed
|
||||
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed? (default `true`)
|
||||
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
|
||||
max_turn_weight | Float | Maximum turn penalty weight
|
||||
force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `process_segment` will be called for all segments (default `false`)
|
||||
force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that `segment_function` will be called for all segments (default `false`)
|
||||
|
||||
### process_node(profile, node, result)
|
||||
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
|
||||
## way_function
|
||||
|
||||
Argument | Description
|
||||
---------|-------------------------------------------------------
|
||||
profile | The configuration table you returned in `setup`.
|
||||
node | The input node to process (read-only).
|
||||
result | The output that you will modify.
|
||||
Given an OpenStreetMap way, the `way_function` will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash to be returned. The most important thing it will do is set the value of `result.forward_speed` and `result.backward_speed` as a suitable integer value representing the speed for traversing the way.
|
||||
|
||||
The following attributes can be set on `result`:
|
||||
All other calculations stem from that, including the returned timings in driving directions, but also, less directly, it feeds into the actual routing decisions the engine will take (a way with a slow traversal speed, may be less favoured than a way with fast traversal speed, but it depends how long it is, and... what it connects to in the rest of the network graph)
|
||||
|
||||
Attribute | Type | Notes
|
||||
----------------|---------|---------------------------------------------------------
|
||||
barrier | Boolean | Is it an impassable barrier?
|
||||
traffic_lights | Boolean | Is it a traffic light (incurs delay in `process_turn`)?
|
||||
Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the `way_function`. Instead a `way_function` will examine the tagging (e.g. `way:get_value_by_key("highway")` and many others), process this information in various ways, calling other local functions, referencing the global variables and look-up hashes, before arriving at the result.
|
||||
|
||||
## process_way(profile, way, result)
|
||||
Given an OpenStreetMap way, the `process_way` function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash.
|
||||
|
||||
Argument | Description
|
||||
---------|-------------------------------------------------------
|
||||
profile | The configuration table you returned in `setup`.
|
||||
node | The input way to process (read-only).
|
||||
result | The output that you will modify.
|
||||
|
||||
Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way.
|
||||
|
||||
It will also set a number of other attributes on `result`.
|
||||
|
||||
Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the `process_way` function. Instead `process_way` will examine the tag set on the way, process this information in various ways, calling other local functions and referencing the configuration in `profile`, etc, before arriving at the result.
|
||||
|
||||
The following attributes can be set on the result in `process_way`:
|
||||
The following attributes can be set on the result in `way_function`:
|
||||
|
||||
Attribute | Type | Notes
|
||||
----------------------------------------|----------|--------------------------------------------------------------------------
|
||||
@@ -149,7 +60,7 @@ forward_classes | Table | Mark this way as being of a
|
||||
backward_classes | Table | " "
|
||||
duration | Float | Alternative setter for duration of the whole way in both directions
|
||||
weight | Float | Alternative setter for weight of the whole way in both directions
|
||||
turn_lanes_forward | String | Directions for individual lanes (normalized OSM `turn:lanes` value)
|
||||
turn_lanes_forward | String | Directions for individual lanes (normalised OSM `turn:lanes` value)
|
||||
turn_lanes_backward | String | " "
|
||||
forward_restricted | Boolean | Is this a restricted access road? (e.g. private, or deliveries only; used to enable high turn penalty, so that way is only chosen for start/end of route)
|
||||
backward_restricted | Boolean | " "
|
||||
@@ -167,19 +78,32 @@ road_classification.road_priority_class | Enum | Guidance: order in priority
|
||||
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
|
||||
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
|
||||
|
||||
### process_segment(profile, segment)
|
||||
The `process_segment` function is called for every segment of OSM ways. A segment is a straight line between two OSM nodes.
|
||||
### Guidance
|
||||
|
||||
On OpenStreetMap way cannot have different tags on different parts of a way. Instead you would split the way into several smaller ways. However many ways are long. For example, many ways pass hills without any change in tags.
|
||||
The guidance parameters in profiles are currently a work in progress. They can and will change.
|
||||
Please be aware of this when using guidance configuration possibilities.
|
||||
|
||||
Processing each segment of an OSM way makes it possible to have different speeds on different parts of a way based on external data like data about elevation, pollution, noise or scenic value and adjust weight and duration of the segment.
|
||||
Guidance uses road classes to decide on when/if to emit specific instructions and to discover which road is obvious when following a route.
|
||||
Classification uses three flags and a priority-category.
|
||||
The flags indicate whether a road is a motorway (required for on/off ramps), a link type (the ramps itself, if also a motorway) and whether a road may be omittted in considerations (is considered purely for connectivity).
|
||||
The priority-category influences the decision which road is considered the obvious choice and which roads can be seen as fork.
|
||||
Forks can be emitted between roads of similar priority category only. Obvious choices follow a major priority road, if the priority difference is large.
|
||||
|
||||
In the `process_segment` you don't have access to OSM tags. Instead you use the geographical location of the start and end point of the way to lookup other data source, like elevation data. See [rasterbot.lua](../profiles/rasterbot.lua) for an example.
|
||||
## node_function
|
||||
|
||||
The following attributes can be read and set on the result in `process_segment`:
|
||||
The following attributes can be set on the result in `node_function`:
|
||||
|
||||
Attribute | Type | Notes
|
||||
----------------|---------|-------------------------------------------------------
|
||||
barrier | Boolean | Is it an impassable barrier?
|
||||
traffic_lights | Boolean | Is it a traffic light (incurs delay in `turn_function`)?
|
||||
|
||||
## segment_function
|
||||
|
||||
The following attributes can be read and set on the result in `segment_function`:
|
||||
|
||||
Attribute | Read/write? | Type | Notes
|
||||
-------------------|-------------|---------|----------------------------------------
|
||||
-------------------|-------------|---------|------------------------------------------------------
|
||||
source.lon | Read | Float | Co-ordinates of segment start
|
||||
source.lat | Read | Float | " "
|
||||
target.lon | Read | Float | Co-ordinates of segment end
|
||||
@@ -188,88 +112,17 @@ target.distance | Read | Float | Length of segment
|
||||
weight | Read/write | Float | Routing weight for this segment
|
||||
duration | Read/write | Float | Duration for this segment
|
||||
|
||||
### process_turn(profile, turn)
|
||||
The `process_turn` function is called for every possible turn in the network. Based on the angle and type of turn you assign the weight and duration of the movement.
|
||||
## turn_function
|
||||
|
||||
The following attributes can be read and set on the result in `process_turn`:
|
||||
The following attributes can be read and set on the result in `turn_function`:
|
||||
|
||||
Attribute | Read/write? | Type | Notes
|
||||
-------------------|-------------|---------|------------------------------------------------------
|
||||
direction_modifier | Read | Enum | Geometry of turn. Defined in `include/extractor/guidance/turn_instruction.hpp`
|
||||
turn_type | Read | Enum | Priority of turn. Defined in `include/extractor/guidance/turn_instruction.hpp`
|
||||
has_traffic_light | Read | Boolean | Is a traffic light present at this turn?
|
||||
source_restricted | Read | Boolean | Is it from a restricted access road? (See definition in `process_way`)
|
||||
target_restricted | Read | Boolean | Is it to a restricted access road? (See definition in `process_way`)
|
||||
source_restricted | Read | Boolean | Is it from a restricted access road? (See definition in `way_function`)
|
||||
target_restricted | Read | Boolean | Is it to a restricted access road? (See definition in `way_function`)
|
||||
angle | Read | Float | Angle of turn in degrees (`0-360`: `0`=u-turn, `180`=straight on)
|
||||
duration | Read/write | Float | Penalty to be applied for this turn (duration in deciseconds)
|
||||
weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
|
||||
|
||||
## Guidance
|
||||
The guidance parameters in profiles are currently a work in progress. They can and will change.
|
||||
Please be aware of this when using guidance configuration possibilities.
|
||||
|
||||
Guidance uses road classes to decide on when/if to emit specific instructions and to discover which road is obvious when following a route.
|
||||
Classification uses three flags and a priority-category.
|
||||
The flags indicate whether a road is a motorway (required for on/off ramps), a link type (the ramps itself, if also a motorway) and whether a road may be omitted in considerations (is considered purely for connectivity).
|
||||
The priority-category influences the decision which road is considered the obvious choice and which roads can be seen as fork.
|
||||
Forks can be emitted between roads of similar priority category only. Obvious choices follow a major priority road, if the priority difference is large.
|
||||
|
||||
### Using raster data
|
||||
OSRM has build-in support for loading an interpolating raster data in ASCII format. This can be used e.g. for factoring in elevation when computing routes.
|
||||
|
||||
Use `raster:load()` in your `setup` function to load data and store the source in your configuration hash:
|
||||
|
||||
```lua
|
||||
function setup()
|
||||
return {
|
||||
raster_source = raster:load(
|
||||
"rastersource.asc", -- file to load
|
||||
0, -- longitude min
|
||||
0.1, -- longitude max
|
||||
0, -- latitude min
|
||||
0.1, -- latitude max
|
||||
5, -- number of rows
|
||||
4 -- number of columns
|
||||
)
|
||||
}
|
||||
end
|
||||
```
|
||||
|
||||
The input data must an ASCII file with rows of integers. e.g.:
|
||||
|
||||
```
|
||||
0 0 0 0
|
||||
0 0 0 250
|
||||
0 0 250 500
|
||||
0 0 0 250
|
||||
0 0 0 0
|
||||
```
|
||||
|
||||
In your `segment_function` you can then access the raster source and use `raster:query()` to query to find the nearest data point, or `raster:interpolate()` to interpolate a value based on nearby data points.
|
||||
|
||||
You must check whether the result is valid before use it.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
function process_segment (profile, segment)
|
||||
local sourceData = raster:query(profile.raster_source, segment.source.lon, segment.source.lat)
|
||||
local targetData = raster:query(profile.raster_source, segment.target.lon, segment.target.lat)
|
||||
|
||||
local invalid = sourceData.invalid_data()
|
||||
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
||||
-- use values to adjust weight and duration
|
||||
[...]
|
||||
end
|
||||
```
|
||||
|
||||
See [rasterbot.lua](../profiles/rasterbot.lua) and [rasterbotinterp.lua](../profiles/rasterbotinterp.lua) for examples.
|
||||
|
||||
### Helper functions
|
||||
There are a few helper functions defined in the global scope that profiles can use:
|
||||
|
||||
durationIsValid
|
||||
parseDuration
|
||||
trimLaneString
|
||||
applyAccessTokens
|
||||
canonicalizeStringList
|
||||
+2
-2
@@ -47,10 +47,10 @@ We may introduce forward-compatible changes: query parameters and response prope
|
||||
4. Make sure the `package.json` is up to date.
|
||||
5. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
|
||||
6. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
|
||||
7. Use `npm run docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
|
||||
7. Use `npm run build-api-docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
|
||||
8. Push tags and commits: `git push; git push --tags`
|
||||
9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
|
||||
10. Wait until the travis build has been completed and check if the node binaries were published by doing:
|
||||
`rm -rf node_modules && npm install` locally.
|
||||
11. For final releases run `npm publish` or `npm publish --tag next` for release candidates.
|
||||
12. Bump version in `package.json` to `{MAJOR}.{MINOR+1}.0-latest.1` on the `master` branch after the release.
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Feature: Bicycle - Route around alleys
|
||||
|
||||
Background:
|
||||
Given the profile file "bicycle" initialized with
|
||||
Given the profile file
|
||||
"""
|
||||
profile.properties.weight_name = 'cyclability'
|
||||
require 'bicycle'
|
||||
properties.weight_name = 'cyclability'
|
||||
"""
|
||||
|
||||
Scenario: Bicycle - Avoid taking alleys
|
||||
|
||||
@@ -4,7 +4,7 @@ Feature: Bicycle - Handle cycling
|
||||
Background:
|
||||
Given the profile "bicycle"
|
||||
|
||||
Scenario: Bicycle - Use a movable bridge
|
||||
Scenario: Bicycle - Use a ferry route
|
||||
Given the node map
|
||||
"""
|
||||
a b c
|
||||
@@ -21,6 +21,13 @@ Feature: Bicycle - Handle cycling
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | g | abc,cde,efg,efg | cycling,cycling,cycling,cycling |
|
||||
| b | f | abc,cde,efg,efg | cycling,cycling,cycling,cycling |
|
||||
| e | c | cde,cde | cycling,cycling |
|
||||
| e | b | cde,abc,abc | cycling,cycling,cycling |
|
||||
| e | a | cde,abc,abc | cycling,cycling,cycling |
|
||||
| c | e | cde,cde | cycling,cycling |
|
||||
| c | f | cde,efg,efg | cycling,cycling,cycling |
|
||||
| c | g | cde,efg,efg | cycling,cycling,cycling |
|
||||
|
||||
Scenario: Bicycle - Properly handle durations
|
||||
Given the node map
|
||||
|
||||
@@ -21,15 +21,15 @@ Feature: Bike - Destination only, no passing through
|
||||
| axye | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| a | c | ab,bcd |
|
||||
| a | d | ab,bcd |
|
||||
| a | e | axye,axye |
|
||||
| e | d | de,de |
|
||||
| e | c | de,bcd |
|
||||
| e | b | de,bcd |
|
||||
| e | a | axye,axye |
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| a | c | ab,bcd,bcd |
|
||||
| a | d | ab,bcd,bcd |
|
||||
| a | e | axye,axye |
|
||||
| e | d | de,de |
|
||||
| e | c | de,bcd,bcd |
|
||||
| e | b | de,bcd,bcd |
|
||||
| e | a | axye,axye |
|
||||
|
||||
Scenario: Bike - Destination only street
|
||||
Given the node map
|
||||
@@ -49,15 +49,15 @@ Feature: Bike - Destination only, no passing through
|
||||
| axye | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| a | c | ab,bc |
|
||||
| a | d | ab,bc,cd |
|
||||
| a | e | axye,axye |
|
||||
| e | d | de,de |
|
||||
| e | c | de,cd,cd |
|
||||
| e | b | de,cd,bc |
|
||||
| e | a | axye,axye |
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| a | c | ab,bc,bc |
|
||||
| a | d | ab,bc,cd,cd |
|
||||
| a | e | axye,axye |
|
||||
| e | d | de,de |
|
||||
| e | c | de,cd,cd |
|
||||
| e | b | de,cd,bc,bc |
|
||||
| e | a | axye,axye |
|
||||
|
||||
Scenario: Bike - Routing inside a destination only area
|
||||
Given the node map
|
||||
@@ -76,8 +76,8 @@ Feature: Bike - Destination only, no passing through
|
||||
| axye | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | e | ab,bc,cd,de |
|
||||
| e | a | de,cd,bc,ab |
|
||||
| b | d | bc,cd |
|
||||
| d | b | cd,bc |
|
||||
| from | to | route |
|
||||
| a | e | ab,bc,cd,de,de |
|
||||
| e | a | de,cd,bc,ab,ab |
|
||||
| b | d | bc,cd,cd |
|
||||
| d | b | cd,bc,bc |
|
||||
|
||||
@@ -21,7 +21,12 @@ Feature: Bike - Handle ferry routes
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | g | abc,cde,efg,efg |
|
||||
| b | f | abc,cde,efg,efg |
|
||||
| e | c | cde,cde |
|
||||
| e | b | cde,abc,abc |
|
||||
| e | a | cde,abc,abc |
|
||||
| c | e | cde,cde |
|
||||
| c | f | cde,efg,efg |
|
||||
| c | g | cde,efg,efg |
|
||||
|
||||
Scenario: Bike - Ferry duration, single node
|
||||
|
||||
@@ -20,8 +20,11 @@ Feature: Bike - Mode flag
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | d | ab,bc,cd,cd | cycling,ferry,cycling,cycling |
|
||||
| d | a | cd,bc,ab,ab | cycling,ferry,cycling,cycling |
|
||||
| c | a | bc,ab,ab | ferry,cycling,cycling |
|
||||
| d | b | cd,bc,bc | cycling,ferry,ferry |
|
||||
| a | c | ab,bc,bc | cycling,ferry,ferry |
|
||||
| b | d | bc,cd,cd | ferry,cycling,cycling |
|
||||
|
||||
Scenario: Bike - Mode when using a train
|
||||
Given the node map
|
||||
@@ -39,10 +42,12 @@ Feature: Bike - Mode flag
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | d | ab,bc,cd,cd | cycling,train,cycling,cycling |
|
||||
| d | a | cd,bc,ab,ab | cycling,train,cycling,cycling |
|
||||
| c | a | bc,ab,ab | train,cycling,cycling |
|
||||
| d | b | cd,bc,bc | cycling,train,train |
|
||||
| a | c | ab,bc,bc | cycling,train,train |
|
||||
| b | d | bc,cd,cd | train,cycling,cycling |
|
||||
|
||||
#representative test for all pushes (and mode changes). Where a bike is pushed is tested over in access.feature
|
||||
Scenario: Bike - Mode when pushing bike against oneways
|
||||
Given the node map
|
||||
"""
|
||||
@@ -65,6 +70,96 @@ Feature: Bike - Mode flag
|
||||
| d | a | cd,bc,ab,ab | cycling,pushing bike,cycling,cycling |
|
||||
| c | a | bc,ab,ab | pushing bike,cycling,cycling |
|
||||
| d | b | cd,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| a | c | ab,bc,bc | cycling,cycling,cycling |
|
||||
| b | d | bc,cd,cd | cycling,cycling,cycling |
|
||||
|
||||
Scenario: Bike - Mode when pushing on pedestrain streets
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
c d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| ab | primary |
|
||||
| bc | pedestrian |
|
||||
| cd | primary |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | d | ab,bc,cd,cd | cycling,pushing bike,cycling,cycling |
|
||||
| d | a | cd,bc,ab,ab | cycling,pushing bike,cycling,cycling |
|
||||
| c | a | bc,ab,ab | pushing bike,cycling,cycling |
|
||||
| d | b | cd,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| a | c | ab,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| b | d | bc,cd,cd | pushing bike,cycling,cycling |
|
||||
|
||||
Scenario: Bike - Mode when pushing on pedestrain areas
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
c d f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | area |
|
||||
| ab | primary | |
|
||||
| bcd | pedestrian | yes |
|
||||
| df | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | f | ab,bcd,df,df | cycling,pushing bike,cycling,cycling |
|
||||
| f | a | df,bcd,ab,ab | cycling,pushing bike,cycling,cycling |
|
||||
| d | a | bcd,ab,ab | pushing bike,cycling,cycling |
|
||||
| f | b | df,bcd,bcd | cycling,pushing bike,pushing bike |
|
||||
| a | d | ab,bcd,bcd | cycling,pushing bike,pushing bike |
|
||||
| b | f | bcd,df,df | pushing bike,cycling,cycling |
|
||||
|
||||
Scenario: Bike - Mode when pushing on steps
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
c d f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| ab | primary |
|
||||
| bc | steps |
|
||||
| cd | primary |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | d | ab,bc,cd,cd | cycling,pushing bike,cycling,cycling |
|
||||
| d | a | cd,bc,ab,ab | cycling,pushing bike,cycling,cycling |
|
||||
| c | a | bc,ab,ab | pushing bike,cycling,cycling |
|
||||
| d | b | cd,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| a | c | ab,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| b | d | bc,cd,cd | pushing bike,cycling,cycling |
|
||||
|
||||
Scenario: Bike - Mode when bicycle=dismount
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
c d f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | bicycle |
|
||||
| ab | primary | |
|
||||
| bc | primary | dismount |
|
||||
| cd | primary | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | d | ab,bc,cd,cd | cycling,pushing bike,cycling,cycling |
|
||||
| d | a | cd,bc,ab,ab | cycling,pushing bike,cycling,cycling |
|
||||
| c | a | bc,ab,ab | pushing bike,cycling,cycling |
|
||||
| d | b | cd,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| a | c | ab,bc,bc | cycling,pushing bike,pushing bike |
|
||||
| b | d | bc,cd,cd | pushing bike,cycling,cycling |
|
||||
|
||||
Scenario: Bicycle - Modes when starting on forward oneway
|
||||
Given the node map
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
@routing @bicycle @ref @name
|
||||
Feature: Bike - Way ref
|
||||
|
||||
Background:
|
||||
Given the profile "bicycle"
|
||||
|
||||
Scenario: Bike - Way with both name and ref
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | ref |
|
||||
| ab | Utopia Drive | E7 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | ref |
|
||||
| a | b | Utopia Drive,Utopia Drive | E7,E7 |
|
||||
|
||||
Scenario: Bike - Way with only ref
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | ref |
|
||||
| ab | | E7 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | ref |
|
||||
| a | b | , | E7,E7 |
|
||||
|
||||
Scenario: Bike - Way with only name
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name |
|
||||
| ab | Utopia Drive |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | Utopia Drive,Utopia Drive |
|
||||
@@ -7,8 +7,6 @@ Feature: Bike - Turn restrictions
|
||||
Given the profile "bicycle"
|
||||
Given a grid size of 200 meters
|
||||
|
||||
# check to see if bicycle profiles handle relations. The code path is the same as in cars.
|
||||
# If relations are passed, all variants tested in car also work for bike
|
||||
@no_turning
|
||||
Scenario: Bike - No left turn
|
||||
Given the node map
|
||||
@@ -35,7 +33,188 @@ Feature: Bike - Turn restrictions
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
## exceptions are different for bike over car and need to be tested here
|
||||
@no_turning
|
||||
Scenario: Bike - No right turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | ej | j | no_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Bike - No u-turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | wj | j | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Bike - Handle any no_* relation
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | wj | j | no_weird_zigzags |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@only_turning
|
||||
Scenario: Bike - Only left turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | wj | j | only_left_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@only_turning
|
||||
Scenario: Bike - Only right turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | ej | j | only_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@only_turning
|
||||
Scenario: Bike - Only straight on
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | nj | j | only_straight_on |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Bike - Handle any only_* restriction
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| sj | yes | no |
|
||||
| nj | -1 | no |
|
||||
| wj | -1 | no |
|
||||
| ej | -1 | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | nj | j | only_weird_zigzags |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@except
|
||||
Scenario: Bike - Except tag and on no_ restrictions
|
||||
Given the node map
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Feature: Bicycle - Adds penalties to unsafe roads
|
||||
|
||||
Background:
|
||||
Given the profile file "bicycle" initialized with
|
||||
Given the profile file
|
||||
"""
|
||||
profile.properties.weight_name = 'cyclability'
|
||||
require 'bicycle'
|
||||
properties.weight_name = 'cyclability'
|
||||
"""
|
||||
|
||||
Scenario: Bike - Apply penalties to ways without cycleways
|
||||
|
||||
@@ -7,9 +7,10 @@ Feature: Turn Penalties
|
||||
|
||||
|
||||
Scenario: Bicycle - Turn penalties on cyclability
|
||||
Given the profile file "bicycle" initialized with
|
||||
Given the profile file
|
||||
"""
|
||||
profile.properties.weight_name = 'cyclability'
|
||||
require 'bicycle'
|
||||
properties.weight_name = 'cyclability'
|
||||
"""
|
||||
|
||||
Given the node map
|
||||
|
||||
@@ -22,7 +22,13 @@ Feature: Car - Handle driving
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | g | abc,cde,efg,efg | driving,driving,driving,driving |
|
||||
| b | f | abc,cde,efg,efg | driving,driving,driving,driving |
|
||||
| e | c | cde,cde | driving,driving |
|
||||
| e | b | cde,abc,abc | driving,driving,driving |
|
||||
| e | a | cde,abc,abc | driving,driving,driving |
|
||||
| c | e | cde,cde | driving,driving |
|
||||
| c | f | cde,efg,efg | driving,driving,driving |
|
||||
| c | g | cde,efg,efg | driving,driving,driving |
|
||||
|
||||
Scenario: Car - Control test without durations, osrm uses movable bridge speed to calculate duration
|
||||
Given the node map
|
||||
@@ -41,6 +47,8 @@ Feature: Car - Handle driving
|
||||
When I route I should get
|
||||
| from | to | route | modes | speed | time |
|
||||
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 13 km/h | 340s +-1 |
|
||||
| b | f | abc,cde,efg,efg | driving,driving,driving,driving | 9 km/h | 318s +-1 |
|
||||
| c | e | cde,cde | driving,driving | 5 km/h | 295s +-1 |
|
||||
| e | c | cde,cde | driving,driving | 5 km/h | 295s +-1 |
|
||||
|
||||
Scenario: Car - Properly handle durations
|
||||
@@ -60,5 +68,6 @@ Feature: Car - Handle driving
|
||||
When I route I should get
|
||||
| from | to | route | modes | speed |
|
||||
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 7 km/h |
|
||||
| b | f | abc,cde,efg,efg | driving,driving,driving,driving | 5 km/h |
|
||||
| c | e | cde,cde | driving,driving | 2 km/h |
|
||||
| e | c | cde,cde | driving,driving | 2 km/h |
|
||||
|
||||
@@ -72,75 +72,6 @@ Feature: Car - Turn restrictions
|
||||
| n | m | nj,pjm,pjm |
|
||||
| s | m | js,pjm,pjm |
|
||||
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - Restriction With Compressed Geometry
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# time stamp for 10am on Tues, 02 May 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
|
|
||||
i
|
||||
|
|
||||
j-k-l-m
|
||||
|
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| nij |
|
||||
| js |
|
||||
| jklm |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | nij | jklm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| n | m | nij,js,js,jklm,jklm |
|
||||
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - Restriction With Compressed Geometry and Traffic Signal
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# time stamp for 10am on Tues, 02 May 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
|
|
||||
i
|
||||
|
|
||||
j-k-l-m
|
||||
|
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| nij |
|
||||
| js |
|
||||
| jklm |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| i | traffic_signal |
|
||||
| k | traffic_signal |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | nij | jklm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| n | m | nij,js,js,jklm,jklm |
|
||||
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - ignores except restriction
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
@@ -599,81 +530,6 @@ Feature: Car - Turn restrictions
|
||||
| n | p | nj,js,js,jp,jp |
|
||||
| m | p | mj,jp,jp |
|
||||
|
||||
@restriction-way
|
||||
Scenario: Car - prohibit turn
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# 5pm Wed 02 May, 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction:conditional |
|
||||
| restriction | ab | be | de | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
# condition is off
|
||||
@restriction-way
|
||||
Scenario: Car - prohibit turn
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# time stamp for 12am on Tues, 02 May 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493726400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493726400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction:conditional |
|
||||
| restriction | ab | be | de | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,be,de,de |
|
||||
| a | f | ab,be,ef,ef |
|
||||
| c | d | bc,be,de,de |
|
||||
| c | f | bc,be,ef,ef |
|
||||
|
||||
# https://www.openstreetmap.org/#map=18/38.91099/-77.00888
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - DC North capitol situation, two on one off
|
||||
@@ -883,175 +739,3 @@ Feature: Car - Turn restrictions
|
||||
| from | to | route | turns |
|
||||
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
|
||||
| a | e | albic,dobe,dobe | depart,turn left,arrive |
|
||||
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - Conditional restriction with multiple time windows
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# 5pm Wed 02 May, 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
a f
|
||||
| |
|
||||
b - e - h
|
||||
| | |
|
||||
c d - g
|
||||
1
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| de |
|
||||
| ef |
|
||||
| be |
|
||||
| eh |
|
||||
| gh |
|
||||
| dg |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction:conditional |
|
||||
| restriction | ab | be | ef | no_uturn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | ed | dg | d | no_uturn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | f | ab,bc,bc,be,ef,ef |
|
||||
| f | 1 | ef,eh,gh,dg,dg |
|
||||
|
||||
@restriction-way @overlap
|
||||
Scenario: Car - prohibit turn
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# 5pm Wed 02 May, 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction:conditional |
|
||||
| restriction | ab | be | de | no_right_turn @ (Mo-Fr 07:00-11:00) |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | be | de | no_right_turn |
|
||||
|
||||
# condition is off, but the general restriction should take precedence
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
@restriction-way @overlap
|
||||
Scenario: Car - prohibit turn
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# 5pm Wed 02 May, 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction:conditional |
|
||||
| restriction | ab | be | de | no_right_turn @ (Mo-Fr 07:00-11:00) |
|
||||
|
||||
And the relations
|
||||
| type | way:from | node:via | way:to | restriction:conditional |
|
||||
| restriction | be | e | de | no_right_turn @ (Mo-Fr 16:00-18:00) |
|
||||
|
||||
# way restriction is off, node-restriction is on
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,ef,ef,de,de | depart,turn left,turn left,continue uturn,new name straight,arrive | c,b,e,f,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
@restriction-way @overlap
|
||||
Scenario: Car - prohibit turn
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# 5pm Wed 02 May, 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction:conditional |
|
||||
| restriction | ab | be | de | no_right_turn @ (Mo-Fr 16:00-18:00) |
|
||||
|
||||
And the relations
|
||||
| type | way:from | node:via | way:to | restriction:conditional |
|
||||
| restriction | be | e | de | no_right_turn @ (Mo-Fr 07:00-11:00) |
|
||||
|
||||
# node restrictino is off, way restriction is on
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ Feature: Car - Handle ferry routes
|
||||
| b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.4s |
|
||||
| c | e | cde,cde | ferry,ferry | 5 km/h | 151.4s |
|
||||
| e | c | cde,cde | ferry,ferry | 5 km/h | 151.4s |
|
||||
|
||||
Scenario: Car - Properly handle simple durations
|
||||
Given the node map
|
||||
"""
|
||||
@@ -92,20 +91,3 @@ Feature: Car - Handle ferry routes
|
||||
| b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 18 km/h | 78.4s |
|
||||
| c | e | cde,cde | ferry,ferry | 11 km/h | 67.4s |
|
||||
| e | c | cde,cde | ferry,ferry | 11 km/h | 67.4s |
|
||||
|
||||
@snapping
|
||||
Scenario: Car - Snapping when using a ferry
|
||||
Given the node map
|
||||
"""
|
||||
a b c d e f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | route | duration |
|
||||
| ab | primary | | |
|
||||
| bcde | | ferry | 0:10 |
|
||||
| ef | primary | | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes | time |
|
||||
| c | d | bcde,bcde | ferry,ferry | 600s |
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
@routing @car @mode
|
||||
Feature: Car - Mode flag
|
||||
Background:
|
||||
Given the profile "car"
|
||||
|
||||
Scenario: Car - Mode when using a ferry
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
c d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | route | duration |
|
||||
| ab | primary | | |
|
||||
| bc | | ferry | 0:01 |
|
||||
| cd | primary | | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | d | ab,bc,cd,cd | driving,ferry,driving,driving |
|
||||
| d | a | cd,bc,ab,ab | driving,ferry,driving,driving |
|
||||
| c | a | bc,ab,ab | ferry,driving,driving |
|
||||
| d | b | cd,bc,bc | driving,ferry,ferry |
|
||||
| a | c | ab,bc,bc | driving,ferry,ferry |
|
||||
| b | d | bc,cd,cd | ferry,driving,driving |
|
||||
|
||||
Scenario: Car - Snapping when using a ferry
|
||||
Given the node map
|
||||
"""
|
||||
a b c d e f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | route | duration |
|
||||
| ab | primary | | |
|
||||
| bcde | | ferry | 0:10 |
|
||||
| ef | primary | | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | modes | time |
|
||||
| c | d | bcde,bcde | ferry,ferry | 600s |
|
||||
|
||||
|
||||
@@ -5,6 +5,22 @@ Feature: Car - Street names in instructions
|
||||
Given the profile "car"
|
||||
Given a grid size of 5 meters
|
||||
|
||||
Scenario: Car - A named street
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | ref |
|
||||
| ab | My Way | |
|
||||
| bc | Your Way | A1 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | ref |
|
||||
| a | c | My Way,Your Way | ,A1|
|
||||
|
||||
Scenario: Car - A named street with pronunciation
|
||||
Given the node map
|
||||
"""
|
||||
|
||||
@@ -506,525 +506,3 @@ Feature: Car - Turn restrictions
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@restriction @compression
|
||||
Scenario: Restriction On Compressed Geometry
|
||||
Given the node map
|
||||
"""
|
||||
i
|
||||
|
|
||||
f - e
|
||||
| |
|
||||
a - b - c - d
|
||||
|
|
||||
g
|
||||
|
|
||||
h
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abc |
|
||||
| cde |
|
||||
| efc |
|
||||
| cgh |
|
||||
| ei |
|
||||
|
||||
And the relations
|
||||
| type | way:from | node:via | way:to | restriction |
|
||||
| restriction | abc | c | cgh | no_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | h | abc,cde,efc,cgh,cgh |
|
||||
|
||||
@restriction-way
|
||||
Scenario: Car - prohibit turn
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | be | de | no_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
@restriction @overlap
|
||||
Scenario: Car - prohibit turn
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | be | de | no_right_turn |
|
||||
| restriction | bc | be | ef | no_left_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,be,ef,ef,de,de |
|
||||
| a | f | ab,be,ef,ef |
|
||||
| c | d | bc,be,de,de |
|
||||
| c | f | bc,be,de,de,ef,ef |
|
||||
|
||||
@restriction-way @overlap
|
||||
Scenario: Two times same way
|
||||
Given the node map
|
||||
"""
|
||||
h g
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
a - b - c - - - - - - - - - - - - - - - - - - - f
|
||||
| | \ /
|
||||
i - d - e - - - - - - - - - - - - - - - - -
|
||||
"""
|
||||
# The long distances here are required to make other turns undesriable in comparison to the restricted turns.
|
||||
# Otherwise they might just be picked without the actual turns being restricted
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | no |
|
||||
| bc | no |
|
||||
| cd | yes |
|
||||
| ce | yes |
|
||||
| cf | yes |
|
||||
| cg | yes |
|
||||
| bh | no |
|
||||
| fedib | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bc | ce | no_right_turn |
|
||||
| restriction | ab | bc | cd | no_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | i | ab,bc,cf,fedib,fedib |
|
||||
|
||||
|
||||
@restriction-way @overlap
|
||||
Scenario: Car - prohibit turn
|
||||
Given the node map
|
||||
"""
|
||||
a j
|
||||
| |
|
||||
b---i
|
||||
| |
|
||||
c---h
|
||||
| |
|
||||
d---g
|
||||
| |
|
||||
e f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | oneway |
|
||||
| ab | left | yes |
|
||||
| bc | left | yes |
|
||||
| cd | left | yes |
|
||||
| de | left | yes |
|
||||
| fg | right | yes |
|
||||
| gh | right | yes |
|
||||
| hi | right | yes |
|
||||
| ij | right | yes |
|
||||
| dg | first | no |
|
||||
| ch | second | no |
|
||||
| bi | third | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bi | ij | no_u_turn |
|
||||
| restriction | bc | ch | hi | no_u_turn |
|
||||
| restriction | fg | dg | de | no_u_turn |
|
||||
| restriction | gh | ch | cd | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | j | left,first,right,right |
|
||||
| f | e | right,third,left,left |
|
||||
|
||||
@restriction
|
||||
Scenario: Car - allow only turn
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | be | ef | only_left_on |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
@restriction
|
||||
Scenario: Car - allow only turn
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| be |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | be | ed | only_right_on |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,be,de,de |
|
||||
|
||||
@restriction
|
||||
Scenario: Multi Way restriction
|
||||
Given the node map
|
||||
"""
|
||||
k j
|
||||
| |
|
||||
h - - g - f - - e
|
||||
| |
|
||||
| |
|
||||
a - - b - c - - d
|
||||
| |
|
||||
l i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | oneway |
|
||||
| ab | horiz | yes |
|
||||
| bc | horiz | yes |
|
||||
| cd | horiz | yes |
|
||||
| ef | horiz | yes |
|
||||
| fg | horiz | yes |
|
||||
| gh | horiz | yes |
|
||||
| ic | vert | yes |
|
||||
| cf | vert | yes |
|
||||
| fj | vert | yes |
|
||||
| kg | vert | yes |
|
||||
| gb | vert | yes |
|
||||
| bl | vert | yes |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bc,cf,fg | gh | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | h | horiz,vert,horiz,horiz |
|
||||
|
||||
@restriction
|
||||
Scenario: Multi-Way overlapping single-way
|
||||
Given the node map
|
||||
"""
|
||||
e
|
||||
|
|
||||
a - b - c - d
|
||||
|
|
||||
f - g
|
||||
|
|
||||
h
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name |
|
||||
| ab | abcd |
|
||||
| bc | abcd |
|
||||
| cd | abcd |
|
||||
| hf | hfb |
|
||||
| fb | hfb |
|
||||
| gf | gf |
|
||||
| ce | ce |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bc | ce | only_left_turn |
|
||||
| restriction | gf | fb,bc | cd | only_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | abcd,ce,ce,abcd,abcd | depart,turn left,continue uturn,turn left,arrive | a,c,e,c,d |
|
||||
| a | e | abcd,ce,ce | depart,turn left,arrive | a,c,e |
|
||||
| a | f | abcd,hfb,hfb | depart,turn right,arrive | a,b,f |
|
||||
| g | e | gf,hfb,abcd,ce,ce | depart,turn right,turn right,turn left,arrive | g,f,b,c,e |
|
||||
| g | d | gf,hfb,abcd,abcd | depart,turn right,turn right,arrive | g,f,b,d |
|
||||
| h | e | hfb,abcd,ce,ce | depart,end of road right,turn left,arrive | h,b,c,e |
|
||||
| h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d |
|
||||
|
||||
|
||||
@restriction
|
||||
Scenario: Car - prohibit turn, traffic lights
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
a d
|
||||
| |
|
||||
g i
|
||||
| |
|
||||
h j
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name |
|
||||
| hgab | ab |
|
||||
| bc | bc |
|
||||
| be | be |
|
||||
| jide | de |
|
||||
| ef | ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | hgab | be | jide | no_right_turn |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| g | traffic_signals |
|
||||
| i | traffic_signals |
|
||||
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | locations |
|
||||
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |
|
||||
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
|
||||
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
|
||||
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |
|
||||
|
||||
|
||||
@restriction @overlap @geometry
|
||||
Scenario: Geometry
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b-g-e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| bge |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bge | de | no_right_turn |
|
||||
| restriction | bc | bge | ef | no_left_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,bge,ef,ef,de,de |
|
||||
| a | f | ab,bge,ef,ef |
|
||||
| c | d | bc,bge,de,de |
|
||||
| c | f | bc,bge,de,de,ef,ef |
|
||||
|
||||
@restriction @overlap @geometry @traffic-signals
|
||||
Scenario: Geometry
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b-g-e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| bge |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| g | traffic_signals |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bge | de | no_right_turn |
|
||||
| restriction | bc | bge | ef | no_left_turn |
|
||||
|
||||
# this case is currently not handling the via-way restrictions and we need support for looking across traffic signals.
|
||||
# It is mainly included to show limitations and to prove that we don't crash hard here
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,bge,ef,ef,de,de |
|
||||
| a | f | ab,bge,ef,ef |
|
||||
| c | d | bc,bge,de,de |
|
||||
| c | f | bc,bge,de,de,ef,ef |
|
||||
|
||||
# don't crash hard on invalid restrictions
|
||||
@restriction @invalid
|
||||
Scenario: Geometry
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b---e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | |
|
||||
| bc | |
|
||||
| be | yes |
|
||||
| de | |
|
||||
| ef | |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | de | be | ab | no_left_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | f | ab,be,ef,ef |
|
||||
|
||||
|
||||
@restriction @overlap @geometry
|
||||
Scenario: Duplicated restriction
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
|
||||
| f
|
||||
| |
|
||||
b-g-e
|
||||
| |
|
||||
| d
|
||||
|
|
||||
a
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| bge |
|
||||
| de |
|
||||
| ef |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | bge | ef | e | no_left_turn |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:via | way:to | restriction |
|
||||
| restriction | ab | bge | de | no_right_turn |
|
||||
| restriction | bc | bge | ef | no_left_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | ab,bc,bc,bge,de,de |
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
@routing @testbot @sidebias
|
||||
Feature: Testbot - side bias
|
||||
|
||||
Scenario: Left-hand bias
|
||||
Given the profile file "car" initialized with
|
||||
Background:
|
||||
Given the profile file
|
||||
"""
|
||||
profile.left_hand_driving = true
|
||||
profile.turn_bias = 1/1.075
|
||||
require 'testbot'
|
||||
properties.left_hand_driving = true
|
||||
"""
|
||||
|
||||
Scenario: Left hand bias
|
||||
Given the profile file "car" extended with
|
||||
"""
|
||||
properties.left_hand_driving = true
|
||||
profile.turn_bias = properties.left_hand_driving and 1/1.075 or 1.075
|
||||
"""
|
||||
Given the node map
|
||||
"""
|
||||
@@ -24,11 +31,11 @@ Feature: Testbot - side bias
|
||||
| d | a | bd,ab,ab | 24s +-1 |
|
||||
| d | c | bd,bc,bc | 27s +-1 |
|
||||
|
||||
Scenario: Right-hand bias
|
||||
Given the profile file "car" initialized with
|
||||
Scenario: Right hand bias
|
||||
Given the profile file "car" extended with
|
||||
"""
|
||||
profile.left_hand_driving = true
|
||||
profile.turn_bias = 1.075
|
||||
properties.left_hand_driving = false
|
||||
profile.turn_bias = properties.left_hand_driving and 1/1.075 or 1.075
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
@@ -49,11 +56,6 @@ Feature: Testbot - side bias
|
||||
| d | c | bd,bc,bc | 24s +-1 |
|
||||
|
||||
Scenario: Roundabout exit counting for left sided driving
|
||||
Given the profile file "testbot" initialized with
|
||||
"""
|
||||
profile.left_hand_driving = true
|
||||
profile.turn_bias = 1/1.075
|
||||
"""
|
||||
And a grid size of 10 meters
|
||||
And the node map
|
||||
"""
|
||||
|
||||
@@ -37,57 +37,3 @@ Feature: Car - Handle traffic lights
|
||||
| 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: Tarrif Signal Geometry
|
||||
Given the query options
|
||||
| overview | full |
|
||||
| geometries | polyline |
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
a - b - c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abc | primary |
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | geometry |
|
||||
| a | c | abc,abc | _ibE_ibE?gJ?gJ |
|
||||
|
||||
@traffic
|
||||
Scenario: Traffic update on the edge with a traffic signal
|
||||
Given the node map
|
||||
"""
|
||||
a - b - c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abc | primary |
|
||||
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
|
||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||
And the speed file
|
||||
"""
|
||||
1,2,65
|
||||
2,1,65
|
||||
"""
|
||||
And the query options
|
||||
| annotations | datasources,nodes,speed,duration,weight |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
|
||||
| a | c | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||
| c | a | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
@routing @car @weight
|
||||
Feature: Car - weights
|
||||
|
||||
Scenario: Only routes down service road when that's the destination
|
||||
Background: Use specific speeds
|
||||
Given the profile "car"
|
||||
And the node map
|
||||
|
||||
Scenario: Only routes down service road when that's the destination
|
||||
Given the node map
|
||||
"""
|
||||
a--b--c
|
||||
|
|
||||
@@ -23,8 +25,7 @@ Feature: Car - weights
|
||||
| a | d | abc,bdf,bdf | 18 km/h | 71.7 |
|
||||
|
||||
Scenario: Does not jump off the highway to go down service road
|
||||
Given the profile "car"
|
||||
And the node map
|
||||
Given the node map
|
||||
"""
|
||||
a
|
||||
|
|
||||
@@ -62,9 +63,10 @@ Feature: Car - weights
|
||||
| a | e | ab,be,be | 14 km/h | 112 |
|
||||
|
||||
Scenario: Distance weights
|
||||
Given the profile file "car" initialized with
|
||||
Given the profile file "car" extended with
|
||||
"""
|
||||
profile.properties.weight_name = 'distance'
|
||||
api_version = 1
|
||||
properties.weight_name = 'distance'
|
||||
"""
|
||||
|
||||
Given the node map
|
||||
|
||||
@@ -21,7 +21,13 @@ Feature: Foot - Handle ferry routes
|
||||
When I route I should get
|
||||
| from | to | route | modes |
|
||||
| a | g | abc,cde,efg,efg | walking,ferry,walking,walking |
|
||||
| b | f | abc,cde,efg,efg | walking,ferry,walking,walking |
|
||||
| e | c | cde,cde | ferry,ferry |
|
||||
| e | b | cde,abc,abc | ferry,walking,walking |
|
||||
| e | a | cde,abc,abc | ferry,walking,walking |
|
||||
| c | e | cde,cde | ferry,ferry |
|
||||
| c | f | cde,efg,efg | ferry,walking,walking |
|
||||
| c | g | cde,efg,efg | ferry,walking,walking |
|
||||
|
||||
Scenario: Foot - Ferry duration, single node
|
||||
Given the node map
|
||||
|
||||
@@ -14,9 +14,25 @@ Feature: Foot - Street names in instructions
|
||||
|
||||
And the ways
|
||||
| nodes | name | ref |
|
||||
| ab | My Way | |
|
||||
| bc | | A7 |
|
||||
| ab | My Way | A6 |
|
||||
| bc | Your Way | B7 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | ref |
|
||||
| a | c | My Way,, | ,A7,A7 |
|
||||
| from | to | route |
|
||||
| a | c | My Way,Your Way,Your Way |
|
||||
|
||||
@unnamed
|
||||
Scenario: Foot - No longer use way type to describe unnamed ways, see #3231
|
||||
Given the node map
|
||||
"""
|
||||
a b c d
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | name |
|
||||
| ab | footway | |
|
||||
| bcd | track | |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | d | , |
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
@routing @foot @ref @name
|
||||
Feature: Foot - Way ref
|
||||
|
||||
Background:
|
||||
Given the profile "foot"
|
||||
|
||||
Scenario: Foot - Way with both name and ref
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | ref |
|
||||
| ab | Utopia Drive | E7 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | ref |
|
||||
| a | b | Utopia Drive,Utopia Drive | E7,E7 |
|
||||
|
||||
Scenario: Foot - Way with only ref
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | ref |
|
||||
| ab | | E7 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | ref |
|
||||
| a | b | , | E7,E7 |
|
||||
|
||||
Scenario: Foot - Way with only name
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name |
|
||||
| ab | Utopia Drive |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | Utopia Drive,Utopia Drive |
|
||||
@@ -32,6 +32,84 @@ Feature: Foot - Turn restrictions
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Foot - No right turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | ej | j | no_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Foot - No u-turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | wj | j | no_u_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Foot - Handle any no_* relation
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | wj | j | no_weird_zigzags |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@only_turning
|
||||
Scenario: Foot - Only left turn
|
||||
Given the node map
|
||||
@@ -58,6 +136,84 @@ Feature: Foot - Turn restrictions
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@only_turning
|
||||
Scenario: Foot - Only right turn
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | ej | j | only_right_turn |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@only_turning
|
||||
Scenario: Foot - Only straight on
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | nj | j | only_straight_on |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@no_turning
|
||||
Scenario: Foot - Handle any only_* restriction
|
||||
Given the node map
|
||||
"""
|
||||
n
|
||||
w j e
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| nj | -1 |
|
||||
| wj | -1 |
|
||||
| ej | -1 |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
| restriction | sj | nj | j | only_weird_zigzags |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | w | sj,wj,wj |
|
||||
| s | n | sj,nj,nj |
|
||||
| s | e | sj,ej,ej |
|
||||
|
||||
@except
|
||||
Scenario: Foot - Except tag and on no_ restrictions
|
||||
Given the node map
|
||||
@@ -90,6 +246,30 @@ Feature: Foot - Turn restrictions
|
||||
| s | c | sj,cj,cj |
|
||||
| s | d | sj,dj,dj |
|
||||
|
||||
@except
|
||||
Scenario: Foot - Except tag and on only_ restrictions
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
j
|
||||
s
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| sj | yes |
|
||||
| aj | no |
|
||||
| bj | no |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction | except |
|
||||
| restriction | sj | aj | j | only_straight_on | foot |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| s | a | sj,aj,aj |
|
||||
| s | b | sj,bj,bj |
|
||||
|
||||
@except
|
||||
Scenario: Foot - Multiple except tag values
|
||||
Given the node map
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
@routing @foot @roundabout @instruction @todo
|
||||
@routing @foot @roundabout @instruction
|
||||
Feature: Roundabout Instructions
|
||||
|
||||
Background:
|
||||
Given the profile "foot"
|
||||
|
||||
@todo
|
||||
Scenario: Foot - Roundabout instructions
|
||||
# You can walk in both directions on a roundabout, bu the normal roundabout instructions don't
|
||||
# make sense when you're going the opposite way around the roundabout.
|
||||
@@ -26,7 +27,7 @@ Feature: Roundabout Instructions
|
||||
| abcda | roundabout |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| from | to | route | turns |
|
||||
| s | t | sa,tb | depart,roundabout-exit-1,arrive |
|
||||
| s | u | sa,uc | depart,roundabout-exit-2,arrive |
|
||||
| s | v | sa,vd | depart,roundabout-exit-3,arrive |
|
||||
|
||||
@@ -582,9 +582,9 @@ Feature: Turn Lane Guidance
|
||||
|
||||
@anticipate
|
||||
Scenario: No Lanes for Roundabouts, see #2626
|
||||
Given the profile file "car" initialized with
|
||||
Given the profile file "car" extended with
|
||||
"""
|
||||
profile.left_hand_driving = true
|
||||
properties.left_hand_driving = true
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
@@ -814,32 +814,3 @@ Feature: Turn Lane Guidance
|
||||
| waypoints | route | turns | locations | lanes |
|
||||
| a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:false;none:true none:true right:false, |
|
||||
| a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true;left:false none:false none:false none:true,none:false none:false right:true, |
|
||||
|
||||
@anticipate
|
||||
Scenario: Oak St, Franklin St
|
||||
Given a grid size of 10 meters
|
||||
Given the node map
|
||||
"""
|
||||
g
|
||||
. . f
|
||||
. d `
|
||||
e ` .
|
||||
.
|
||||
.
|
||||
. . c
|
||||
. b `
|
||||
a `
|
||||
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | name | turn:lanes | oneway | highway |
|
||||
| ab | Oak St | left\|left\|left | yes | secondary |
|
||||
| cb | Oak St | right | yes | tertiary |
|
||||
| bd | Franklin St | left;through\|through\|through;right\|right | yes | secondary |
|
||||
| dg | Franklin St | | yes | secondary |
|
||||
| edf | Fell St | | | secondary |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | lanes |
|
||||
| a,f | Oak St,Franklin St,Fell St,Fell St | depart,turn left,turn right,arrive | ,left:false left:true left:true,straight;left:false straight:false straight;right:true right:true, |
|
||||
|
||||
@@ -863,8 +863,8 @@ Feature: Slipways and Dedicated Turn Lanes
|
||||
| af | primary | sliproad | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | locations |
|
||||
| s,g | main,sliproad,another,another | depart,turn right,turn slight left,arrive | s,a,f,g |
|
||||
| waypoints | route | turns | locations |
|
||||
| s,g | main,sliproad,another,another | depart,turn right,turn left,arrive | s,a,f,g |
|
||||
|
||||
@sliproads:
|
||||
Scenario: Throughabout-Sliproad
|
||||
@@ -944,55 +944,3 @@ Feature: Slipways and Dedicated Turn Lanes
|
||||
When I route I should get
|
||||
| waypoints | route | turns | locations |
|
||||
| a,k | road,,, | depart,turn right,roundabout turn right exit-1,arrive | a,b,h,k |
|
||||
|
||||
@sliproads
|
||||
Scenario: Sliproad with 4 roads at target
|
||||
Given the node map
|
||||
"""
|
||||
d
|
||||
.
|
||||
s . a . b . c . t
|
||||
` . '
|
||||
` . '
|
||||
'.'
|
||||
e
|
||||
.
|
||||
f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | name | oneway |
|
||||
| sabct | primary | sabct | |
|
||||
| dbef | primary | dbef | |
|
||||
| ae | primary_link | ae | yes |
|
||||
| ec | primary_link | ec | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | locations |
|
||||
| s,f | sabct,dbef,dbef | depart,turn right,arrive | s,a,f |
|
||||
| f,t | dbef,sabct,sabct | depart,turn right,arrive | f,e,t |
|
||||
|
||||
@sliproads
|
||||
Scenario: Sliproad and acute angle (50°) at the main intersection
|
||||
Given the node map
|
||||
"""
|
||||
d
|
||||
/
|
||||
s . a . . b . c
|
||||
` /
|
||||
' /
|
||||
e
|
||||
/
|
||||
f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | name | oneway |
|
||||
| sabc | primary | sabc | |
|
||||
| dbef | primary | dbef | |
|
||||
| ae | primary_link | ae | yes |
|
||||
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | locations |
|
||||
| s,f | sabc,dbef,dbef | depart,turn right,arrive | s,a,f |
|
||||
|
||||
@@ -3,10 +3,11 @@ Feature: Basic Roundabout
|
||||
|
||||
Background:
|
||||
Given a grid size of 10 meters
|
||||
Given the profile file "car" initialized with
|
||||
"""
|
||||
profile.properties.left_hand_driving = true
|
||||
"""
|
||||
Given the profile file
|
||||
"""
|
||||
require 'car'
|
||||
properties.left_hand_driving = true
|
||||
"""
|
||||
|
||||
Scenario: Roundabout exit counting for left sided driving
|
||||
And a grid size of 10 meters
|
||||
|
||||
@@ -567,5 +567,5 @@ Feature: Basic Roundabout
|
||||
| ab | residential | in | | |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | turns | route |
|
||||
| a,f | depart,turn right,arrive | in,through,through |
|
||||
| waypoints | turns | route |
|
||||
| a,f | depart,turn right,roundabout turn straight exit-1,arrive | in,through,through,through |
|
||||
|
||||
@@ -763,7 +763,7 @@ Feature: Basic Roundabout
|
||||
|
||||
When I route I should get
|
||||
| waypoints | bearings | route | turns |
|
||||
| e,f | 90 90 | edf,edf | depart,arrive |
|
||||
| e,f | 90 90 | edf,edf,edf | depart,roundabout-exit-1,arrive |
|
||||
| e,h | 90 135 | edf,gch,gch | depart,roundabout-exit-2,arrive |
|
||||
| g,f | 45 90 | gch,edf,edf | depart,roundabout-exit-2,arrive |
|
||||
| g,h | 45 135 | gch,gch,gch | depart,roundabout-exit-1,arrive |
|
||||
@@ -843,6 +843,6 @@ Feature: Basic Roundabout
|
||||
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns | distance |
|
||||
| e | k | ebds,ufghl,jhik,jhik | depart,rstur-exit-2,turn right,arrive | 189.1m |
|
||||
| 1 | k | ebds,ufghl,jhik,jhik | depart,rstur-exit-2,turn right,arrive | 159.1m |
|
||||
| from | to | route | turns | distance |
|
||||
| e | k | ebds,ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rotary-exit-1,rstur-exit-2,turn right,arrive | 189.1m |
|
||||
| 1 | k | ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rstur-exit-2,turn right,arrive | 159.1m |
|
||||
|
||||
@@ -809,14 +809,14 @@ Feature: Simple Turns
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | intersections |
|
||||
| a,g | Perle,Heide,Heide | depart,turn right,arrive | true:90;true:90 true:195 false:270 true:345;true:18 |
|
||||
| a,k | Perle,Friede,Friede | depart,turn left,arrive | true:90;true:90 true:195 false:270 true:345;true:153 |
|
||||
| a,e | Perle,Perle | depart,arrive | true:90,true:90 true:195 false:270 true:345;true:270 |
|
||||
| e,k | Perle,Friede,Friede | depart,turn right,arrive | true:270;false:90 true:195 true:270 true:345;true:153 |
|
||||
| e,g | Perle,Heide,Heide | depart,turn left,arrive | true:270;false:90 true:195 true:270 true:345;true:18 |
|
||||
| h,k | Heide,Friede | depart,arrive | true:16,true:90 true:195 true:270 true:345;true:153 |
|
||||
| h,e | Heide,Perle,Perle | depart,turn right,arrive | true:16;true:90 true:195 true:270 true:345;true:270 |
|
||||
| h,a | Heide,Perle,Perle | depart,turn left,arrive | true:16;true:90 true:195 true:270 true:345;true:90 |
|
||||
| a,g | Perle,Heide,Heide | depart,turn right,arrive | true:90;true:90 true:180 false:270 true:345;true:18 |
|
||||
| a,k | Perle,Friede,Friede | depart,turn left,arrive | true:90;true:90 true:180 false:270 true:345;true:153 |
|
||||
| a,e | Perle,Perle | depart,arrive | true:90,true:90 true:180 false:270 true:345;true:270 |
|
||||
| e,k | Perle,Friede,Friede | depart,turn right,arrive | true:270;false:90 true:180 true:270 true:345;true:153 |
|
||||
| e,g | Perle,Heide,Heide | depart,turn left,arrive | true:270;false:90 true:180 true:270 true:345;true:18 |
|
||||
| h,k | Heide,Friede | depart,arrive | true:16,true:90 true:180 true:270 true:345;true:153 |
|
||||
| h,e | Heide,Perle,Perle | depart,turn right,arrive | true:16;true:90 true:180 true:270 true:345;true:270 |
|
||||
| h,a | Heide,Perle,Perle | depart,turn left,arrive | true:16;true:90 true:180 true:270 true:345;true:90 |
|
||||
|
||||
#http://www.openstreetmap.org/#map=19/52.53293/13.32956
|
||||
Scenario: Curved Exit from Curved Road
|
||||
@@ -1006,8 +1006,8 @@ Feature: Simple Turns
|
||||
| waypoints | route | turns |
|
||||
| a,e | Heide,Heide,Heide | depart,continue uturn,arrive |
|
||||
| a,g | Heide,Fenn,Fenn | depart,turn right,arrive |
|
||||
| a,h | Heide,Friede,Friede | depart,turn left,arrive |
|
||||
| i,e | Perle,Heide,Heide | depart,turn sharp right,arrive |
|
||||
| a,h | Heide,Friede,Friede | depart,turn slight left,arrive |
|
||||
| i,e | Perle,Heide,Heide | depart,turn right,arrive |
|
||||
| i,h | Perle,Friede,Friede | depart,turn left,arrive |
|
||||
|
||||
#http://www.openstreetmap.org/#map=19/52.48630/13.36017
|
||||
@@ -1189,7 +1189,7 @@ Feature: Simple Turns
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,c | rose,trift,trift | depart,turn slight left,arrive |
|
||||
| a,c | rose,trift | depart,arrive |
|
||||
| a,k | rose,muhle,muhle | depart,turn slight right,arrive |
|
||||
| d,f | trift,rose | depart,arrive |
|
||||
| d,k | trift,muhle,muhle | depart,turn sharp left,arrive |
|
||||
|
||||
@@ -788,9 +788,9 @@ Feature: Simple Turns
|
||||
| bg | primary | yes |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,d | abc,bd,bd | depart,turn right,arrive |
|
||||
| a,f | abc,bf,bf | depart,turn slight right,arrive |
|
||||
| waypoints | route | turns |
|
||||
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
|
||||
| a,f | abc,bf,bf | depart,turn right,arrive |
|
||||
|
||||
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 3
|
||||
Given the node map
|
||||
|
||||
@@ -33,25 +33,15 @@ Feature: osrm-contract command line option: edge-weight-updates-over-factor
|
||||
|
||||
|
||||
Scenario: Logging using weigts as durations for non-duration profile
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.weight_name = 'steps'
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
properties.weight_name = 'steps'
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.weight = 1
|
||||
result.duration = 1
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
And the data has been saved to disk
|
||||
|
||||
|
||||
@@ -12,20 +12,15 @@ Feature: osrm-extract lua ways:get_nodes()
|
||||
And the data has been saved to disk
|
||||
|
||||
Scenario: osrm-extract - Passing base file
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
functions = require('testbot')
|
||||
|
||||
function way_function(profile, way, result)
|
||||
function way_function(way, result)
|
||||
for _, node in ipairs(way:get_nodes()) do
|
||||
print('node id ' .. node:id())
|
||||
end
|
||||
result.forward_mode = mode.driving
|
||||
result.forward_speed = 1
|
||||
end
|
||||
|
||||
functions.process_way = way_function
|
||||
return functions
|
||||
"""
|
||||
When I run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit successfully
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
Feature: Invalid profile API versions
|
||||
|
||||
Background:
|
||||
Given a grid size of 100 meters
|
||||
|
||||
Scenario: Profile API version too low
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = -1
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
ab
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
And the data has been saved to disk
|
||||
|
||||
When I try to run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit with an error
|
||||
And stderr should contain "Invalid profile API version"
|
||||
|
||||
Scenario: Profile API version too high
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 3
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
ab
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
And the data has been saved to disk
|
||||
|
||||
When I try to run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit with an error
|
||||
And stderr should contain "Invalid profile API version"
|
||||
@@ -1,36 +1,84 @@
|
||||
Feature: Profile API version 0
|
||||
|
||||
Scenario: Profile api version 0
|
||||
Background:
|
||||
Given a grid size of 100 meters
|
||||
|
||||
Scenario: Not-defined API version
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 0
|
||||
-- set profile properties
|
||||
properties.u_turn_penalty = 20
|
||||
properties.traffic_signal_penalty = 2
|
||||
properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.left_hand_driving = false
|
||||
properties.weight_name = 'duration'
|
||||
function node_function (node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
end
|
||||
function way_function(way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('way_function ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
function turn_function (angle)
|
||||
print('turn_function ' .. angle)
|
||||
return angle == 0 and 0 or 42
|
||||
end
|
||||
function segment_function (source, target, distance, weight)
|
||||
print ('segment_function ' .. source.lon .. ' ' .. source.lat)
|
||||
end
|
||||
"""
|
||||
"""
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.forward_speed = 1
|
||||
end
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
ab
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
And the data has been saved to disk
|
||||
|
||||
When I try to run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit successfully
|
||||
And stderr should not contain "Invalid profile API version"
|
||||
|
||||
Scenario: Out-bound API version
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 2
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
ab
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
And the data has been saved to disk
|
||||
|
||||
When I try to run "osrm-extract --profile {profile_file} {osm_file}"
|
||||
Then it should exit with an error
|
||||
And stderr should contain "Invalid profile API version"
|
||||
|
||||
|
||||
Scenario: Basic profile function calls and property values
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 0
|
||||
|
||||
-- set profile properties
|
||||
properties.u_turn_penalty = 20
|
||||
properties.traffic_signal_penalty = 2
|
||||
properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.left_hand_driving = false
|
||||
properties.weight_name = 'duration'
|
||||
|
||||
function node_function (node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
end
|
||||
|
||||
function way_function(way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('way_function ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
|
||||
function turn_function (angle)
|
||||
print('turn_function ' .. angle)
|
||||
return angle == 0 and 0 or 42
|
||||
end
|
||||
|
||||
function segment_function (source, target, distance, weight)
|
||||
print ('segment_function ' .. source.lon .. ' ' .. source.lat)
|
||||
end
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
a
|
||||
@@ -57,60 +105,3 @@ Feature: Profile API version 0
|
||||
| a | b | ac,cb,cb | 24.2s |
|
||||
| a | d | ac,cd,cd | 24.2s |
|
||||
| a | e | ac,ce | 20s |
|
||||
|
||||
Scenario: Profile version undefined, assume version 0
|
||||
Given the profile file
|
||||
"""
|
||||
-- set profile properties
|
||||
properties.u_turn_penalty = 20
|
||||
properties.traffic_signal_penalty = 2
|
||||
properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.left_hand_driving = false
|
||||
properties.weight_name = 'duration'
|
||||
function node_function (node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
end
|
||||
function way_function(way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('way_function ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
function turn_function (angle)
|
||||
print('turn_function ' .. angle)
|
||||
return angle == 0 and 0 or 42
|
||||
end
|
||||
function segment_function (source, target, distance, weight)
|
||||
print ('segment_function ' .. source.lon .. ' ' .. source.lat)
|
||||
end
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
a
|
||||
b c d
|
||||
e
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ac |
|
||||
| cb |
|
||||
| cd |
|
||||
| ce |
|
||||
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 "node_function"
|
||||
And stdout should contain "way_function"
|
||||
And stdout should contain "turn_function"
|
||||
And stdout should contain "segment_function"
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | ac,cb,cb | 24.2s |
|
||||
| a | d | ac,cd,cd | 24.2s |
|
||||
| a | e | ac,ce | 20s |
|
||||
@@ -6,42 +6,41 @@ Feature: Profile API version 1
|
||||
Scenario: Basic profile function calls and property values
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 1
|
||||
api_version = 1
|
||||
|
||||
-- set profile properties
|
||||
properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.weight_name = 'test_version1'
|
||||
properties.weight_precision = 2
|
||||
-- set profile properties
|
||||
properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.weight_name = 'test_version1'
|
||||
properties.weight_precision = 2
|
||||
|
||||
assert(properties.max_turn_weight == 327.67)
|
||||
assert(properties.max_turn_weight == 327.67)
|
||||
|
||||
function node_function (node, result)
|
||||
print(node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
end
|
||||
function node_function (node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
end
|
||||
|
||||
function way_function(way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.weight = 10
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('way_function ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
function way_function(way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.weight = 10
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('way_function ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
|
||||
function turn_function (turn)
|
||||
print('turn_function', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light)
|
||||
turn.weight = turn.angle == 0 and 0 or 4.2
|
||||
turn.duration = turn.weight
|
||||
end
|
||||
function turn_function (turn)
|
||||
print('turn_function', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light)
|
||||
turn.weight = turn.angle == 0 and 0 or 4.2
|
||||
turn.duration = turn.weight
|
||||
end
|
||||
|
||||
function segment_function (segment)
|
||||
print ('segment_function ' .. segment.source.lon .. ' ' .. segment.source.lat)
|
||||
end
|
||||
"""
|
||||
function segment_function (segment)
|
||||
print ('segment_function ' .. segment.source.lon .. ' ' .. segment.source.lat)
|
||||
end
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
a
|
||||
@@ -68,165 +67,3 @@ Feature: Profile API version 1
|
||||
| a | b | ac,cb,cb | 19.2s |
|
||||
| a | d | ac,cd,cd | 19.2s |
|
||||
| a | e | ac,ce | 20s |
|
||||
|
||||
Scenario: Basic profile function calls and property values
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 1
|
||||
|
||||
-- set profile properties
|
||||
properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.weight_name = 'test_version1'
|
||||
properties.weight_precision = 2
|
||||
|
||||
assert(properties.max_turn_weight == 327.67)
|
||||
|
||||
function node_function (node, result)
|
||||
print(node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
end
|
||||
|
||||
function way_function(way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.weight = 10
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('way_function ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
|
||||
function turn_function (turn)
|
||||
print('turn_function', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light)
|
||||
turn.weight = turn.angle == 0 and 0 or 4.2
|
||||
turn.duration = turn.weight
|
||||
end
|
||||
|
||||
function segment_function (segment)
|
||||
print ('segment_function ' .. segment.source.lon .. ' ' .. segment.source.lat)
|
||||
end
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
a
|
||||
bcd
|
||||
e
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ac |
|
||||
| cb |
|
||||
| cd |
|
||||
| ce |
|
||||
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 "node_function"
|
||||
And stdout should contain "way_function"
|
||||
And stdout should contain "turn_function"
|
||||
And stdout should contain "segment_function"
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | ac,cb,cb | 19.2s |
|
||||
| a | d | ac,cd,cd | 19.2s |
|
||||
| a | e | ac,ce | 20s |
|
||||
|
||||
Scenario: Weighting based on raster sources
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 1
|
||||
|
||||
properties.force_split_edges = true
|
||||
|
||||
function source_function()
|
||||
local path = os.getenv('OSRM_RASTER_SOURCE')
|
||||
if not path then
|
||||
path = 'rastersource.asc'
|
||||
end
|
||||
raster_source = sources:load(
|
||||
path,
|
||||
0, -- lon_min
|
||||
0.1, -- lon_max
|
||||
0, -- lat_min
|
||||
0.1, -- lat_max
|
||||
5, -- nrows
|
||||
4 -- ncols
|
||||
)
|
||||
end
|
||||
|
||||
function way_function (way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.forward_mode = mode.cycling
|
||||
result.backward_mode = mode.cycling
|
||||
result.forward_speed = 15
|
||||
result.backward_speed = 15
|
||||
end
|
||||
|
||||
function segment_function (segment)
|
||||
local sourceData = sources:query(raster_source, segment.source.lon, segment.source.lat)
|
||||
local targetData = sources:query(raster_source, segment.target.lon, segment.target.lat)
|
||||
io.write('evaluating segment: ' .. sourceData.datum .. ' ' .. targetData.datum .. '\n')
|
||||
local invalid = sourceData.invalid_data()
|
||||
local scaled_weight = segment.weight
|
||||
local scaled_duration = segment.duration
|
||||
|
||||
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
||||
local slope = (targetData.datum - sourceData.datum) / segment.distance
|
||||
scaled_weight = scaled_weight / (1.0 - (slope * 5.0))
|
||||
scaled_duration = scaled_duration / (1.0 - (slope * 5.0))
|
||||
io.write(' slope: ' .. slope .. '\n')
|
||||
io.write(' was weight: ' .. segment.weight .. '\n')
|
||||
io.write(' new weight: ' .. scaled_weight .. '\n')
|
||||
io.write(' was duration: ' .. segment.duration .. '\n')
|
||||
io.write(' new duration: ' .. scaled_duration .. '\n')
|
||||
end
|
||||
|
||||
segment.weight = scaled_weight
|
||||
segment.duration = scaled_duration
|
||||
end
|
||||
"""
|
||||
And the node locations
|
||||
| node | lat | lon |
|
||||
| a | 0.1 | 0.1 |
|
||||
| b | 0.05 | 0.1 |
|
||||
| c | 0.0 | 0.1 |
|
||||
| d | 0.05 | 0.03 |
|
||||
| e | 0.05 | 0.066 |
|
||||
| f | 0.075 | 0.066 |
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| ab | primary |
|
||||
| ad | primary |
|
||||
| bc | primary |
|
||||
| dc | primary |
|
||||
| de | primary |
|
||||
| eb | primary |
|
||||
| df | primary |
|
||||
| fb | primary |
|
||||
And the raster source
|
||||
"""
|
||||
0 0 0 0
|
||||
0 0 0 250
|
||||
0 0 250 500
|
||||
0 0 0 250
|
||||
0 0 0 0
|
||||
"""
|
||||
And the data has been saved to disk
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | speed |
|
||||
| a | b | ab,ab | 8 km/h |
|
||||
| b | a | ab,ab | 22 km/h |
|
||||
| a | c | ab,bc,bc | 12 km/h |
|
||||
| b | c | bc,bc | 22 km/h |
|
||||
| a | d | ad,ad | 15 km/h |
|
||||
| d | c | dc,dc | 15 km/h |
|
||||
| d | e | de,de | 10 km/h |
|
||||
| e | b | eb,eb | 10 km/h |
|
||||
| d | f | df,df | 15 km/h |
|
||||
| f | b | fb,fb | 7 km/h |
|
||||
| d | b | de,eb,eb | 10 km/h |
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
Feature: Profile API version 2
|
||||
|
||||
Background:
|
||||
Given a grid size of 100 meters
|
||||
|
||||
Scenario: Basic profile function calls and property values
|
||||
Given the profile file
|
||||
"""
|
||||
api_version = 2
|
||||
|
||||
Set = require('lib/set')
|
||||
Sequence = require('lib/sequence')
|
||||
Handlers = require("lib/way_handlers")
|
||||
find_access_tag = require("lib/access").find_access_tag
|
||||
limit = require("lib/maxspeed").limit
|
||||
|
||||
|
||||
function setup()
|
||||
return {
|
||||
properties = {
|
||||
max_speed_for_map_matching = 180/3.6,
|
||||
use_turn_restrictions = true,
|
||||
continue_straight_at_waypoint = true,
|
||||
weight_name = 'test_version2',
|
||||
weight_precision = 2
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function process_node(profile, node, result)
|
||||
print ('process_node ' .. node:id())
|
||||
end
|
||||
|
||||
function process_way(profile, way, result)
|
||||
result.name = way:get_value_by_key('name')
|
||||
result.weight = 10
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 36
|
||||
result.backward_speed = 36
|
||||
print ('process_way ' .. way:id() .. ' ' .. result.name)
|
||||
end
|
||||
|
||||
function process_turn (profile, turn)
|
||||
print('process_turn', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light)
|
||||
turn.weight = turn.angle == 0 and 0 or 4.2
|
||||
turn.duration = turn.weight
|
||||
end
|
||||
|
||||
function process_segment (profile, segment)
|
||||
print ('process_segment ' .. segment.source.lon .. ' ' .. segment.source.lat)
|
||||
end
|
||||
|
||||
return {
|
||||
setup = setup,
|
||||
process_node = process_node,
|
||||
process_way = process_way,
|
||||
process_segment = process_segment,
|
||||
process_turn = process_turn
|
||||
}
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
a
|
||||
bcd
|
||||
e
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ac |
|
||||
| cb |
|
||||
| cd |
|
||||
| ce |
|
||||
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 "process_node"
|
||||
And stdout should contain "process_way"
|
||||
And stdout should contain "process_turn"
|
||||
And stdout should contain "process_segment"
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | ac,cb,cb | 19.2s |
|
||||
| a | d | ac,cd,cd | 19.2s |
|
||||
| a | e | ac,ce | 20s |
|
||||
@@ -248,20 +248,17 @@ module.exports = function () {
|
||||
fs.writeFile(this.penaltiesCacheFile, data, callback);
|
||||
});
|
||||
|
||||
this.Given(/^the profile file(?: "([^"]*)" initialized with)?$/, (profile, data, callback) => {
|
||||
this.Given(/^the profile file(?: "([^"]*)" extended with)?$/, (profile, data, callback) => {
|
||||
const lua_profiles_path = this.PROFILES_PATH.split(path.sep).join('/');
|
||||
let text = 'package.path = "' + lua_profiles_path + '/?.lua;" .. package.path\n';
|
||||
if (profile == null) {
|
||||
text += data + '\n';
|
||||
} else {
|
||||
text += 'local functions = require("' + profile + '")\n';
|
||||
text += 'functions.setup_parent = functions.setup\n';
|
||||
text += 'functions.setup = function()\n';
|
||||
text += 'local profile = functions.setup_parent()\n';
|
||||
text += data + '\n';
|
||||
text += 'return profile\n';
|
||||
text += 'end\n';
|
||||
text += 'return functions\n';
|
||||
text += 'local f = assert(io.open("' + lua_profiles_path + '/' + profile + '.lua", "r"))\n';
|
||||
text += 'local s = f:read("*all") .. [[\n' + data + '\n]]\n';
|
||||
text += 'f:close()\n';
|
||||
text += 'local m = assert(loadstring and loadstring(s) or load(s))\n';
|
||||
text += 'm()\n';
|
||||
}
|
||||
this.profileFile = this.profileCacheFile;
|
||||
// TODO: Don't overwrite if it exists
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
@routing @speed @annotations
|
||||
@routing @speed @annotations @turn_penalty
|
||||
Feature: Annotations
|
||||
|
||||
Scenario: Ensure that turn penalties aren't included in annotations
|
||||
Background:
|
||||
Given the profile "turnbot"
|
||||
Given a grid size of 100 meters
|
||||
|
||||
Scenario: Ensure that turn penalties aren't included in annotations
|
||||
Given the node map
|
||||
"""
|
||||
h i
|
||||
@@ -25,37 +27,4 @@ Feature: Annotations
|
||||
| from | to | route | a:speed | a:weight |
|
||||
| h | j | hk,jk,jk | 6.7:6.7 | 15:15 |
|
||||
| i | m | il,lm,lm | 6.7:6.7 | 15:15 |
|
||||
| j | m | jk,lm | 6.7:6.7:6.7 | 15:15:15 |
|
||||
|
||||
|
||||
Scenario: There should be different forward/reverse datasources
|
||||
Given the profile "testbot"
|
||||
|
||||
And the node map
|
||||
"""
|
||||
a b c d e f g h i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abcdefghi | primary |
|
||||
|
||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||
|
||||
# Note: 180km/h == 50m/s for speed annotations
|
||||
And the speed file
|
||||
"""
|
||||
1,2,180,1
|
||||
2,1,180,1
|
||||
3,4,180,1
|
||||
5,6,180,1
|
||||
8,7,180,1
|
||||
"""
|
||||
And the query options
|
||||
| annotations | datasources,speed |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | a:datasources | a:speed |
|
||||
| a | i | abcdefghi,abcdefghi | 1:0:1:0:1:0:0:0 | 50:10:50:10:50:10:10:10 |
|
||||
| i | a | abcdefghi,abcdefghi | 0:1:0:0:0:0:0:1 | 10:50:10:10:10:10:10:50 |
|
||||
| j | m | jk,lm | 6.7:6.7:6.7 | 15:15:15 |
|
||||
@@ -0,0 +1,35 @@
|
||||
@routing @datastore @testbot
|
||||
Feature: Temporary tests related to osrm-datastore
|
||||
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
|
||||
Scenario: Scenario ab
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| b | a | ab,ab |
|
||||
|
||||
Scenario: Scenaria xy
|
||||
Given the node map
|
||||
"""
|
||||
x y
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| xy |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| x | y | xy,xy |
|
||||
| y | x | xy,xy |
|
||||
@@ -226,3 +226,23 @@ Feature: Distance calculation
|
||||
| x | v | xv,xv | 424m +-1 |
|
||||
| x | w | xw,xw | 360m +-1 |
|
||||
| x | y | xy,xy | 316m +-1 |
|
||||
|
||||
@maze
|
||||
Scenario: Distance of a maze of short segments
|
||||
Given a grid size of 7 meters
|
||||
Given the node map
|
||||
"""
|
||||
a b s t
|
||||
d c r q
|
||||
e f o p
|
||||
h g n m
|
||||
i j k l
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abcdefghijklmnopqrst |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | distance |
|
||||
| a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-1 |
|
||||
|
||||
@@ -221,24 +221,15 @@ Feature: Basic Distance Matrix
|
||||
| 4 | 30 +-1 | 40 +-1 | 70 +-1 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix based on segment durations
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.traffic_signal_penalty = 0
|
||||
profile.u_turn_penalty = 0
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_segment = function(profile, segment)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
function segment_function (segment)
|
||||
segment.weight = 2
|
||||
segment.duration = 11
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
And the node map
|
||||
@@ -263,25 +254,16 @@ Feature: Basic Distance Matrix
|
||||
|
||||
|
||||
Scenario: Testbot - Travel time matrix for alternative loop paths
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.traffic_signal_penalty = 0
|
||||
profile.u_turn_penalty = 0
|
||||
profile.weight_precision = 3
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_segment = function(profile, segment)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_precision = 3
|
||||
function segment_function (segment)
|
||||
segment.weight = 777
|
||||
segment.duration = 3
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
|
||||
@@ -21,12 +21,12 @@ Feature: Durations
|
||||
| ef | primary | 01:02:03 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | ab,ab | 60s +-1 |
|
||||
| b | c | bc,bc | 600s +-1 |
|
||||
| c | d | cd,cd | 3600s +-1 |
|
||||
| d | e | de,de | 36000s +-1 |
|
||||
| e | f | ef,ef | 3723s +-1 |
|
||||
| from | to | route | distance | time |
|
||||
| a | b | ab,ab | 100m +-1 | 60s +-1 |
|
||||
| b | c | bc,bc | 200m +-1 | 600s +-1 |
|
||||
| c | d | cd,cd | 300m +-1 | 3600s +-1 |
|
||||
| d | e | de,de | 141m +-2 | 36000s +-1 |
|
||||
| e | f | ef,ef | 224m +-2 | 3723s +-1 |
|
||||
|
||||
@todo
|
||||
Scenario: Partial duration of ways
|
||||
@@ -40,7 +40,7 @@ Feature: Durations
|
||||
| abc | primary | 0:01 |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | c | abc,abc | 60s +-1 |
|
||||
| a | b | ab,ab | 20s +-1 |
|
||||
| b | c | bc,bc | 40s +-1 |
|
||||
| from | to | route | distance | time |
|
||||
| a | c | abc,abc | 300m +-1 | 60s +-1 |
|
||||
| a | b | ab,ab | 100m +-1 | 20s +-1 |
|
||||
| b | c | bc,bc | 200m +-1 | 40s +-1 |
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
@routing @testbot @nil
|
||||
Feature: Testbot - Check assigning nil values
|
||||
Scenario: Assign nil values to all way strings
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
functions = require('testbot')
|
||||
function way_function (way, result)
|
||||
result.name = "name"
|
||||
result.ref = "ref"
|
||||
result.destinations = "destinations"
|
||||
result.pronunciation = "pronunciation"
|
||||
result.turn_lanes_forward = "turn_lanes_forward"
|
||||
result.turn_lanes_backward = "turn_lanes_backward"
|
||||
|
||||
function way_function(profile, way, result)
|
||||
result.name = nil
|
||||
result.ref = nil
|
||||
result.destinations = nil
|
||||
result.exits = nil
|
||||
result.pronunciation = nil
|
||||
result.turn_lanes_forward = nil
|
||||
result.turn_lanes_backward = nil
|
||||
result.name = nil
|
||||
result.ref = nil
|
||||
result.destinations = nil
|
||||
result.exits = nil
|
||||
result.pronunciation = nil
|
||||
result.turn_lanes_forward = nil
|
||||
result.turn_lanes_backward = nil
|
||||
|
||||
result.forward_speed = 10
|
||||
result.backward_speed = 10
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 10
|
||||
result.backward_speed = 10
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
end
|
||||
|
||||
functions.process_way = way_function
|
||||
return functions
|
||||
"""
|
||||
Given the node map
|
||||
"""
|
||||
|
||||
@@ -5,6 +5,51 @@ Feature: Testbot - oneways
|
||||
Given the profile "testbot"
|
||||
Given a grid size of 250 meters
|
||||
|
||||
Scenario: Routing on a oneway roundabout
|
||||
Given the node map
|
||||
"""
|
||||
v
|
||||
x d c
|
||||
e b
|
||||
f a
|
||||
g h y
|
||||
z
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
| cd | yes |
|
||||
| de | yes |
|
||||
| ef | yes |
|
||||
| fg | yes |
|
||||
| gh | yes |
|
||||
| ha | yes |
|
||||
| vx | yes |
|
||||
| vy | yes |
|
||||
| yz | yes |
|
||||
| xe | yes |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| b | c | bc,bc |
|
||||
| c | d | cd,cd |
|
||||
| d | e | de,de |
|
||||
| e | f | ef,ef |
|
||||
| f | g | fg,fg |
|
||||
| g | h | gh,gh |
|
||||
| h | a | ha,ha |
|
||||
| b | a | bc,cd,de,ef,fg,gh,ha,ha |
|
||||
| c | b | cd,de,ef,fg,gh,ha,ab,ab |
|
||||
| d | c | de,ef,fg,gh,ha,ab,bc,bc |
|
||||
| e | d | ef,fg,gh,ha,ab,bc,cd,cd |
|
||||
| f | e | fg,gh,ha,ab,bc,cd,de,de |
|
||||
| g | f | gh,ha,ab,bc,cd,de,ef,ef |
|
||||
| h | g | ha,ab,bc,cd,de,ef,fg,fg |
|
||||
| a | h | ab,bc,cd,de,ef,fg,gh,gh |
|
||||
|
||||
Scenario: Testbot - Simple oneway
|
||||
Then routability should be
|
||||
| highway | foot | oneway | forw | backw |
|
||||
@@ -15,6 +60,27 @@ Feature: Testbot - oneways
|
||||
| highway | foot | oneway | forw | backw |
|
||||
| primary | no | -1 | | x |
|
||||
|
||||
Scenario: Testbot - Around the Block
|
||||
Given the node map
|
||||
"""
|
||||
a b
|
||||
e d c f
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway | foot |
|
||||
| ab | yes | no |
|
||||
| bc | | no |
|
||||
| cd | | no |
|
||||
| da | | no |
|
||||
| de | | no |
|
||||
| cf | | no |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | b | ab,ab |
|
||||
| b | a | bc,cd,da,da |
|
||||
|
||||
Scenario: Testbot - Handle various oneway tag values
|
||||
Then routability should be
|
||||
| foot | oneway | forw | backw |
|
||||
@@ -27,3 +93,19 @@ Feature: Testbot - oneways
|
||||
| no | true | x | |
|
||||
| no | 1 | x | |
|
||||
| no | -1 | | x |
|
||||
|
||||
Scenario: Testbot - Two consecutive oneways
|
||||
Given the node map
|
||||
"""
|
||||
a b c
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
|
||||
|
||||
When I route I should get
|
||||
| from | to | route |
|
||||
| a | c | ab,bc,bc |
|
||||
|
||||
@@ -26,33 +26,6 @@ Feature: Penalties
|
||||
| a | c | abc,abc | 20s +-1 | 200m +-1 |
|
||||
| d | f | def,def | 27s +-1 | 200m +-1 |
|
||||
|
||||
# Penalties not on the phantom nodes
|
||||
Scenario: Traffic signals should incur a delay, without changing distance
|
||||
Given the node map
|
||||
"""
|
||||
a b c d e
|
||||
f g h i j
|
||||
"""
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| c | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bcd |
|
||||
| de |
|
||||
| fg |
|
||||
| ghi |
|
||||
| ij |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time | distance |
|
||||
| a | e | ab,bcd,de | 47s +-1 | 400m +-1 |
|
||||
| f | j | fg,ghi,ij | 40s +-1 | 400m +-1 |
|
||||
|
||||
|
||||
Scenario: Signal penalty should not depend on way type
|
||||
Given the node map
|
||||
"""
|
||||
@@ -99,35 +72,55 @@ Feature: Penalties
|
||||
| from | to | route | time |
|
||||
| a | e | abcde,abcde | 61s +-1 |
|
||||
|
||||
@todo
|
||||
Scenario: Signal penalty should not depend on way type
|
||||
Given the node map
|
||||
"""
|
||||
a b c
|
||||
d e f
|
||||
g h i
|
||||
"""
|
||||
@todo
|
||||
Scenario: Signal penalty should not depend on way type
|
||||
Given the node map
|
||||
"""
|
||||
a b c
|
||||
d e f
|
||||
g h i
|
||||
"""
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
| e | traffic_signals |
|
||||
| h | traffic_signals |
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
| e | traffic_signals |
|
||||
| h | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abc | primary |
|
||||
| def | secondary |
|
||||
| ghi | tertiary |
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| abc | primary |
|
||||
| def | secondary |
|
||||
| ghi | tertiary |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | abc,abc | 10s +-1 |
|
||||
| a | c | abc,abc | 27s +-1 |
|
||||
| d | e | def,def | 20s +-1 |
|
||||
| d | f | def,def | 47s +-1 |
|
||||
| g | h | ghi,ghi | 30s +-1 |
|
||||
| g | i | ghi,ghi | 67s +-1 |
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | b | abc,abc | 10s +-1 |
|
||||
| a | c | abc,abc | 27s +-1 |
|
||||
| d | e | def,def | 20s +-1 |
|
||||
| d | f | def,def | 47s +-1 |
|
||||
| g | h | ghi,ghi | 30s +-1 |
|
||||
| g | i | ghi,ghi | 67s +-1 |
|
||||
|
||||
Scenario: Passing multiple traffic signals should incur a accumulated delay
|
||||
Given the node map
|
||||
"""
|
||||
a b c d e
|
||||
"""
|
||||
|
||||
And the nodes
|
||||
| node | highway |
|
||||
| b | traffic_signals |
|
||||
| c | traffic_signals |
|
||||
| d | traffic_signals |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abcde |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | time |
|
||||
| a | e | abcde,abcde | 61s +-1 |
|
||||
|
||||
@todo
|
||||
Scenario: Starting or ending at a traffic signal should not incur a delay
|
||||
|
||||
@@ -39,17 +39,13 @@ Feature: Projection to nearest point on road
|
||||
|
||||
|
||||
Scenario: Projection results negative duration
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
functions = require('testbot')
|
||||
|
||||
function segment_function(profile, segment)
|
||||
api_version = 1
|
||||
function segment_function (segment)
|
||||
segment.weight = 5.5
|
||||
segment.duration = 2.8
|
||||
end
|
||||
|
||||
functions.process_segment = segment_function
|
||||
return functions
|
||||
"""
|
||||
|
||||
Given the node locations
|
||||
|
||||
@@ -84,11 +84,12 @@ Feature: Traffic - speeds
|
||||
|
||||
|
||||
Scenario: Weighting based on speed file weights, ETA based on file durations
|
||||
Given the profile file "testbot" initialized with
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_precision = 2
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_precision = 2
|
||||
"""
|
||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||
|
||||
@@ -8,11 +8,12 @@ Feature: Traffic - speeds edge cases
|
||||
And the ways
|
||||
| nodes | highway |
|
||||
| ab | primary |
|
||||
And the profile file "testbot" initialized with
|
||||
And the profile file "testbot" extended with
|
||||
"""
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_precision = 2
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_precision = 2
|
||||
"""
|
||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||
And the customize extra arguments "--segment-speed-file {speeds_file}"
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
@routing @testbot @turn_penalty
|
||||
Feature: Turn Penalties
|
||||
|
||||
Scenario: Turns should incur a delay that depend on the angle
|
||||
Background:
|
||||
Given the profile "turnbot"
|
||||
Given a grid size of 200 meters
|
||||
|
||||
|
||||
Scenario: Turns should incur a delay that depend on the angle
|
||||
Given the node map
|
||||
"""
|
||||
c d e
|
||||
|
||||
+44
-101
@@ -60,27 +60,18 @@ Feature: Weight tests
|
||||
|
||||
|
||||
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_name = 'steps'
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_name = 'steps'
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.forward_speed = 42
|
||||
result.backward_speed = 42
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
And the node map
|
||||
"""
|
||||
@@ -96,27 +87,18 @@ Feature: Weight tests
|
||||
And it should exit with an error
|
||||
|
||||
Scenario: Step weights -- way_function: second way wins
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_name = 'steps'
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_name = 'steps'
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.duration = 42
|
||||
result.weight = 35
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
Given the node map
|
||||
@@ -137,28 +119,19 @@ Feature: Weight tests
|
||||
| h,a | , | 140m +-1 | 35,0 | 42s,0s |
|
||||
|
||||
Scenario: Step weights -- way_function: higher weight_per_meter is preferred
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_name = 'steps'
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_name = 'steps'
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.duration = 42
|
||||
result.forward_rate = 1
|
||||
result.backward_rate = 0.5
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
Given the node map
|
||||
@@ -182,32 +155,22 @@ Feature: Weight tests
|
||||
| h,f | , | 40m | 80,0 | 12s,0s |
|
||||
|
||||
Scenario: Step weights -- segment_function
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_name = 'steps'
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_name = 'steps'
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.weight = 42
|
||||
result.duration = 3
|
||||
end
|
||||
|
||||
functions.process_segment = function(profile, segment)
|
||||
function segment_function (segment)
|
||||
segment.weight = 1
|
||||
segment.duration = 11
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
Given the node map
|
||||
@@ -232,39 +195,28 @@ Feature: Weight tests
|
||||
|
||||
|
||||
Scenario: Step weights -- segment_function and turn_function with weight precision
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_name = 'steps'
|
||||
profile.properties.weight_precision = 3
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_name = 'steps'
|
||||
properties.weight_precision = 3
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.weight = 42
|
||||
result.duration = 3
|
||||
end
|
||||
|
||||
functions.process_segment = function(profile, segment)
|
||||
function segment_function (segment)
|
||||
segment.weight = 1.11
|
||||
segment.duration = 100
|
||||
end
|
||||
|
||||
functions.process_turn = function(profile, turn)
|
||||
function turn_function (turn)
|
||||
print (turn.angle)
|
||||
turn.weight = 2 + turn.angle / 100
|
||||
turn.duration = turn.angle
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
Given the node map
|
||||
@@ -289,32 +241,22 @@ Feature: Weight tests
|
||||
|
||||
@traffic @speed
|
||||
Scenario: Step weights -- segment_function with speed and turn updates
|
||||
Given the profile file
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
local functions = require('testbot')
|
||||
functions.setup_testbot = functions.setup
|
||||
|
||||
functions.setup = function()
|
||||
local profile = functions.setup_testbot()
|
||||
profile.properties.traffic_signal_penalty = 0
|
||||
profile.properties.u_turn_penalty = 0
|
||||
profile.properties.weight_name = 'steps'
|
||||
return profile
|
||||
end
|
||||
|
||||
functions.process_way = function(profile, way, result)
|
||||
api_version = 1
|
||||
properties.traffic_signal_penalty = 0
|
||||
properties.u_turn_penalty = 0
|
||||
properties.weight_name = 'steps'
|
||||
function way_function(way, result)
|
||||
result.forward_mode = mode.driving
|
||||
result.backward_mode = mode.driving
|
||||
result.weight = 42
|
||||
result.duration = 3
|
||||
end
|
||||
|
||||
functions.process_segment = function(profile, segment)
|
||||
function segment_function (segment)
|
||||
segment.weight = 10
|
||||
segment.duration = 11
|
||||
end
|
||||
|
||||
return functions
|
||||
"""
|
||||
|
||||
And the node map
|
||||
@@ -347,9 +289,10 @@ Feature: Weight tests
|
||||
|
||||
@traffic @speed
|
||||
Scenario: Step weights -- segment_function with speed and turn updates with fallback to durations
|
||||
Given the profile file "testbot" initialized with
|
||||
Given the profile file "testbot" extended with
|
||||
"""
|
||||
profile.properties.weight_precision = 3
|
||||
api_version = 1
|
||||
properties.weight_precision = 3
|
||||
"""
|
||||
|
||||
And the node map
|
||||
|
||||
@@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef CONTRACTOR_OPTIONS_HPP
|
||||
#define CONTRACTOR_OPTIONS_HPP
|
||||
|
||||
#include "storage/io_config.hpp"
|
||||
#include "updater/updater_config.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
@@ -40,30 +39,31 @@ namespace osrm
|
||||
namespace contractor
|
||||
{
|
||||
|
||||
struct ContractorConfig final : storage::IOConfig
|
||||
struct ContractorConfig
|
||||
{
|
||||
ContractorConfig()
|
||||
: IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"}),
|
||||
requested_num_threads(0)
|
||||
{
|
||||
}
|
||||
ContractorConfig() : requested_num_threads(0) {}
|
||||
|
||||
// Infer the output names from the path of the .osrm file
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
void UseDefaultOutputNames()
|
||||
{
|
||||
IOConfig::UseDefaultOutputNames(base);
|
||||
updater_config.UseDefaultOutputNames(base);
|
||||
level_output_path = osrm_input_path.string() + ".level";
|
||||
core_output_path = osrm_input_path.string() + ".core";
|
||||
graph_output_path = osrm_input_path.string() + ".hsgr";
|
||||
node_file_path = osrm_input_path.string() + ".enw";
|
||||
updater_config.osrm_input_path = osrm_input_path;
|
||||
updater_config.UseDefaultOutputNames();
|
||||
}
|
||||
|
||||
bool IsValid() const { return IOConfig::IsValid() && updater_config.IsValid(); }
|
||||
|
||||
updater::UpdaterConfig updater_config;
|
||||
|
||||
boost::filesystem::path osrm_input_path;
|
||||
|
||||
std::string level_output_path;
|
||||
std::string core_output_path;
|
||||
std::string graph_output_path;
|
||||
|
||||
std::string node_file_path;
|
||||
|
||||
bool use_cached_priority;
|
||||
|
||||
unsigned requested_num_threads;
|
||||
|
||||
@@ -1,37 +1,52 @@
|
||||
#ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
||||
#define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
|
||||
|
||||
#include "updater/updater_config.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "storage/io_config.hpp"
|
||||
#include "updater/updater_config.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace customizer
|
||||
{
|
||||
|
||||
struct CustomizationConfig final : storage::IOConfig
|
||||
struct CustomizationConfig
|
||||
{
|
||||
CustomizationConfig()
|
||||
: IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.ebg", ".osrm.partition", ".osrm.cells", ".osrm.mldgr"}),
|
||||
requested_num_threads(0)
|
||||
CustomizationConfig() : requested_num_threads(0) {}
|
||||
|
||||
void UseDefaults()
|
||||
{
|
||||
std::string basepath = base_path.string();
|
||||
|
||||
const std::string ext = ".osrm";
|
||||
const auto pos = basepath.find(ext);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
basepath.replace(pos, ext.size(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown extension
|
||||
}
|
||||
|
||||
edge_based_graph_path = basepath + ".osrm.ebg";
|
||||
mld_partition_path = basepath + ".osrm.partition";
|
||||
mld_storage_path = basepath + ".osrm.cells";
|
||||
mld_graph_path = basepath + ".osrm.mldgr";
|
||||
|
||||
updater_config.osrm_input_path = basepath + ".osrm";
|
||||
updater_config.UseDefaultOutputNames();
|
||||
}
|
||||
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
{
|
||||
IOConfig::UseDefaultOutputNames(base);
|
||||
updater_config.UseDefaultOutputNames(base);
|
||||
}
|
||||
// might be changed to the node based graph at some point
|
||||
boost::filesystem::path base_path;
|
||||
boost::filesystem::path edge_based_graph_path;
|
||||
boost::filesystem::path mld_partition_path;
|
||||
boost::filesystem::path mld_storage_path;
|
||||
boost::filesystem::path mld_graph_path;
|
||||
|
||||
unsigned requested_num_threads;
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef OSRM_ENGINE_DATAFACADE_DATAFACADE_HPP
|
||||
#define OSRM_ENGINE_DATAFACADE_DATAFACADE_HPP
|
||||
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
|
||||
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
|
||||
template <typename AlgorithmT>
|
||||
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -480,17 +480,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_DURATION_LIST]),
|
||||
num_entries);
|
||||
|
||||
auto geometries_fwd_datasources_list_ptr = data_layout.GetBlockPtr<DatasourceID>(
|
||||
memory_block, storage::DataLayout::GEOMETRIES_FWD_DATASOURCES_LIST);
|
||||
util::vector_view<DatasourceID> geometry_fwd_datasources_list(
|
||||
geometries_fwd_datasources_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_DATASOURCES_LIST]);
|
||||
|
||||
auto geometries_rev_datasources_list_ptr = data_layout.GetBlockPtr<DatasourceID>(
|
||||
memory_block, storage::DataLayout::GEOMETRIES_REV_DATASOURCES_LIST);
|
||||
util::vector_view<DatasourceID> geometry_rev_datasources_list(
|
||||
geometries_rev_datasources_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_DATASOURCES_LIST]);
|
||||
auto datasources_list_ptr = data_layout.GetBlockPtr<DatasourceID>(
|
||||
memory_block, storage::DataLayout::DATASOURCES_LIST);
|
||||
util::vector_view<DatasourceID> datasources_list(
|
||||
datasources_list_ptr, data_layout.num_entries[storage::DataLayout::DATASOURCES_LIST]);
|
||||
|
||||
segment_data = extractor::SegmentDataView{std::move(geometry_begin_indices),
|
||||
std::move(geometry_node_list),
|
||||
@@ -498,8 +491,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
std::move(geometry_rev_weight_list),
|
||||
std::move(geometry_fwd_duration_list),
|
||||
std::move(geometry_rev_duration_list),
|
||||
std::move(geometry_fwd_datasources_list),
|
||||
std::move(geometry_rev_datasources_list)};
|
||||
std::move(datasources_list)};
|
||||
|
||||
m_datasources = data_layout.GetBlockPtr<extractor::Datasources>(
|
||||
memory_block, storage::DataLayout::DATASOURCES_NAMES);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
|
||||
|
||||
#include "engine/data_watchdog.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/datafacade/process_memory_allocator.hpp"
|
||||
|
||||
@@ -10,56 +9,48 @@ namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename AlgorithmT, template <typename A> class FacadeT> class DataFacadeProvider
|
||||
template <typename AlgorithmT> class DataFacadeProvider
|
||||
{
|
||||
using FacadeT = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||
|
||||
public:
|
||||
using Facade = FacadeT<AlgorithmT>;
|
||||
|
||||
virtual ~DataFacadeProvider() = default;
|
||||
|
||||
virtual std::shared_ptr<const Facade> Get() const = 0;
|
||||
virtual std::shared_ptr<const FacadeT> Get() const = 0;
|
||||
};
|
||||
|
||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
||||
class ImmutableProvider final : public DataFacadeProvider<AlgorithmT, FacadeT>
|
||||
template <typename AlgorithmT> class ImmutableProvider final : public DataFacadeProvider<AlgorithmT>
|
||||
{
|
||||
public:
|
||||
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;
|
||||
using FacadeT = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||
|
||||
public:
|
||||
ImmutableProvider(const storage::StorageConfig &config)
|
||||
: immutable_data_facade(std::make_shared<Facade>(
|
||||
: immutable_data_facade(std::make_shared<FacadeT>(
|
||||
std::make_shared<datafacade::ProcessMemoryAllocator>(config)))
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<const Facade> Get() const override final { return immutable_data_facade; }
|
||||
std::shared_ptr<const FacadeT> Get() const override final { return immutable_data_facade; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<const Facade> immutable_data_facade;
|
||||
std::shared_ptr<const FacadeT> immutable_data_facade;
|
||||
};
|
||||
|
||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
||||
class WatchingProvider : public DataFacadeProvider<AlgorithmT, FacadeT>
|
||||
template <typename AlgorithmT> class WatchingProvider final : public DataFacadeProvider<AlgorithmT>
|
||||
{
|
||||
using FacadeT = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||
DataWatchdog<AlgorithmT> watchdog;
|
||||
|
||||
public:
|
||||
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;
|
||||
|
||||
std::shared_ptr<const Facade> Get() const override final { return watchdog.Get(); }
|
||||
std::shared_ptr<const FacadeT> Get() const override final
|
||||
{
|
||||
// We need a singleton here because multiple instances of DataWatchdog
|
||||
// conflict on shared memory mappings
|
||||
return watchdog.Get();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename AlgorithmT>
|
||||
using DataFacadeProvider = detail::DataFacadeProvider<AlgorithmT, DataFacade>;
|
||||
template <typename AlgorithmT>
|
||||
using WatchingProvider = detail::WatchingProvider<AlgorithmT, DataFacade>;
|
||||
template <typename AlgorithmT>
|
||||
using ImmutableProvider = detail::ImmutableProvider<AlgorithmT, DataFacade>;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+24
-18
@@ -85,41 +85,47 @@ template <typename Algorithm> class Engine final : public EngineInterface
|
||||
Status Route(const api::RouteParameters ¶ms,
|
||||
util::json::Object &result) const override final
|
||||
{
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
|
||||
return route_plugin.HandleRequest(algorithms, params, result);
|
||||
auto facade = facade_provider->Get();
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
|
||||
return route_plugin.HandleRequest(*facade, algorithms, params, result);
|
||||
}
|
||||
|
||||
Status Table(const api::TableParameters ¶ms,
|
||||
util::json::Object &result) const override final
|
||||
{
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
|
||||
return table_plugin.HandleRequest(algorithms, params, result);
|
||||
auto facade = facade_provider->Get();
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
|
||||
return table_plugin.HandleRequest(*facade, algorithms, params, result);
|
||||
}
|
||||
|
||||
Status Nearest(const api::NearestParameters ¶ms,
|
||||
util::json::Object &result) const override final
|
||||
{
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
|
||||
return nearest_plugin.HandleRequest(algorithms, params, result);
|
||||
auto facade = facade_provider->Get();
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
|
||||
return nearest_plugin.HandleRequest(*facade, algorithms, params, result);
|
||||
}
|
||||
|
||||
Status Trip(const api::TripParameters ¶ms, util::json::Object &result) const override final
|
||||
{
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
|
||||
return trip_plugin.HandleRequest(algorithms, params, result);
|
||||
auto facade = facade_provider->Get();
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
|
||||
return trip_plugin.HandleRequest(*facade, algorithms, params, result);
|
||||
}
|
||||
|
||||
Status Match(const api::MatchParameters ¶ms,
|
||||
util::json::Object &result) const override final
|
||||
{
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
|
||||
return match_plugin.HandleRequest(algorithms, params, result);
|
||||
auto facade = facade_provider->Get();
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
|
||||
return match_plugin.HandleRequest(*facade, algorithms, params, result);
|
||||
}
|
||||
|
||||
Status Tile(const api::TileParameters ¶ms, std::string &result) const override final
|
||||
{
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
|
||||
return tile_plugin.HandleRequest(algorithms, params, result);
|
||||
auto facade = facade_provider->Get();
|
||||
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
|
||||
return tile_plugin.HandleRequest(*facade, algorithms, params, result);
|
||||
}
|
||||
|
||||
static bool CheckCompability(const EngineConfig &config);
|
||||
@@ -152,9 +158,9 @@ bool Engine<routing_algorithms::ch::Algorithm>::CheckCompability(const EngineCon
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.hsgr")))
|
||||
if (!boost::filesystem::exists(config.storage_config.hsgr_data_path))
|
||||
return false;
|
||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.hsgr"),
|
||||
storage::io::FileReader in(config.storage_config.hsgr_data_path,
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto size = in.GetSize();
|
||||
@@ -183,9 +189,9 @@ bool Engine<routing_algorithms::corech::Algorithm>::CheckCompability(const Engin
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.core")))
|
||||
if (!boost::filesystem::exists(config.storage_config.core_data_path))
|
||||
return false;
|
||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.core"),
|
||||
storage::io::FileReader in(config.storage_config.core_data_path,
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto size = in.GetSize();
|
||||
@@ -208,9 +214,9 @@ bool Engine<routing_algorithms::mld::Algorithm>::CheckCompability(const EngineCo
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.partition")))
|
||||
if (!boost::filesystem::exists(config.storage_config.mld_partition_path))
|
||||
return false;
|
||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.partition"),
|
||||
storage::io::FileReader in(config.storage_config.mld_partition_path,
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto size = in.GetSize();
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -21,6 +20,7 @@ namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
|
||||
// Extracts the geometry for each segment and calculates the traveled distance
|
||||
// Combines the geometry form the phantom node with the PathData
|
||||
// to the full route geometry.
|
||||
@@ -53,9 +53,9 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
source_node.fwd_segment_position + (reversed_source ? 1 : 0);
|
||||
const auto source_node_id =
|
||||
reversed_source ? source_node.reverse_segment_id.id : source_node.forward_segment_id.id;
|
||||
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||
std::vector<NodeID> source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id);
|
||||
|
||||
const auto source_gemetry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||
const std::vector<NodeID> source_geometry =
|
||||
facade.GetUncompressedForwardGeometry(source_gemetry_id);
|
||||
geometry.osm_node_ids.push_back(
|
||||
facade.GetOSMNodeIDOfNode(source_geometry[source_segment_start_coordinate]));
|
||||
|
||||
@@ -78,26 +78,21 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
}
|
||||
|
||||
prev_coordinate = coordinate;
|
||||
|
||||
const auto osm_node_id = facade.GetOSMNodeIDOfNode(path_point.turn_via_node);
|
||||
if (osm_node_id != geometry.osm_node_ids.back())
|
||||
{
|
||||
geometry.annotations.emplace_back(LegGeometry::Annotation{
|
||||
current_distance,
|
||||
// NOTE: we want annotations to include only the duration/weight
|
||||
// of the segment itself. For segments immediately before
|
||||
// a turn, the duration_until_turn/weight_until_turn values
|
||||
// include the turn cost. To counter this, we subtract
|
||||
// the duration_of_turn/weight_of_turn value, which is 0 for
|
||||
// non-preceeding-turn segments, but contains the turn value
|
||||
// for segments before a turn.
|
||||
(path_point.duration_until_turn - path_point.duration_of_turn) / 10.,
|
||||
(path_point.weight_until_turn - path_point.weight_of_turn) /
|
||||
facade.GetWeightMultiplier(),
|
||||
path_point.datasource_id});
|
||||
geometry.locations.push_back(std::move(coordinate));
|
||||
geometry.osm_node_ids.push_back(osm_node_id);
|
||||
}
|
||||
geometry.annotations.emplace_back(LegGeometry::Annotation{
|
||||
current_distance,
|
||||
// NOTE: we want annotations to include only the duration/weight
|
||||
// of the segment itself. For segments immediately before
|
||||
// a turn, the duration_until_turn/weight_until_turn values
|
||||
// include the turn cost. To counter this, we subtract
|
||||
// the duration_of_turn/weight_of_turn value, which is 0 for
|
||||
// non-preceeding-turn segments, but contains the turn value
|
||||
// for segments before a turn.
|
||||
(path_point.duration_until_turn - path_point.duration_of_turn) / 10.,
|
||||
(path_point.weight_until_turn - path_point.weight_of_turn) /
|
||||
facade.GetWeightMultiplier(),
|
||||
path_point.datasource_id});
|
||||
geometry.locations.push_back(std::move(coordinate));
|
||||
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node));
|
||||
}
|
||||
current_distance =
|
||||
util::coordinate_calculation::haversineDistance(prev_coordinate, target_node.location);
|
||||
@@ -107,9 +102,9 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
|
||||
const auto target_node_id =
|
||||
reversed_target ? target_node.reverse_segment_id.id : target_node.forward_segment_id.id;
|
||||
const auto target_geometry_id = facade.GetGeometryIndex(target_node_id).id;
|
||||
const auto target_gemetry_id = facade.GetGeometryIndex(target_node_id).id;
|
||||
const std::vector<DatasourceID> forward_datasources =
|
||||
facade.GetUncompressedForwardDatasources(target_geometry_id);
|
||||
facade.GetUncompressedForwardDatasources(target_gemetry_id);
|
||||
|
||||
// FIXME if source and target phantoms are on the same segment then duration and weight
|
||||
// will be from one projected point till end of segment
|
||||
@@ -132,7 +127,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
const auto target_segment_end_coordinate =
|
||||
target_node.fwd_segment_position + (reversed_target ? 0 : 1);
|
||||
const std::vector<NodeID> target_geometry =
|
||||
facade.GetUncompressedForwardGeometry(target_geometry_id);
|
||||
facade.GetUncompressedForwardGeometry(target_gemetry_id);
|
||||
geometry.osm_node_ids.push_back(
|
||||
facade.GetOSMNodeIDOfNode(target_geometry[target_segment_end_coordinate]));
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#ifndef RAW_ROUTE_DATA_H
|
||||
#define RAW_ROUTE_DATA_H
|
||||
|
||||
#include "extractor/class_data.hpp"
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
|
||||
#include "engine/phantom_node.hpp"
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
|
||||
#include "util/guidance/entry_class.hpp"
|
||||
#include "util/guidance/turn_bearing.hpp"
|
||||
#include "util/guidance/turn_lanes.hpp"
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
|
||||
#include "engine/map_matching/bayes_classifier.hpp"
|
||||
#include "engine/routing_algorithms/map_matching.hpp"
|
||||
#include "engine/routing_algorithms/shortest_path.hpp"
|
||||
#include "util/json_util.hpp"
|
||||
|
||||
#include <vector>
|
||||
@@ -29,7 +32,8 @@ class MatchPlugin : public BasePlugin
|
||||
{
|
||||
}
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::MatchParameters ¶meters,
|
||||
util::json::Object &json_result) const;
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ class NearestPlugin final : public BasePlugin
|
||||
public:
|
||||
explicit NearestPlugin(const int max_results);
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::NearestParameters ¶ms,
|
||||
util::json::Object &result) const;
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
#include "engine/api/table_parameters.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
|
||||
#include "engine/routing_algorithms/many_to_many.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
namespace osrm
|
||||
@@ -20,7 +21,8 @@ class TablePlugin final : public BasePlugin
|
||||
public:
|
||||
explicit TablePlugin(const int max_locations_distance_table);
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TableParameters ¶ms,
|
||||
util::json::Object &result) const;
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace plugins
|
||||
class TilePlugin final : public BasePlugin
|
||||
{
|
||||
public:
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TileParameters ¶meters,
|
||||
std::string &pbf_buffer) const;
|
||||
};
|
||||
|
||||
@@ -38,7 +38,8 @@ class TripPlugin final : public BasePlugin
|
||||
public:
|
||||
explicit TripPlugin(const int max_locations_trip_) : max_locations_trip(max_locations_trip_) {}
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TripParameters ¶meters,
|
||||
util::json::Object &json_result) const;
|
||||
};
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
|
||||
#include "engine/api/route_parameters.hpp"
|
||||
#include "engine/api/route_api.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
|
||||
#include "engine/search_engine_data.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
@@ -31,7 +32,8 @@ class ViaRoutePlugin final : public BasePlugin
|
||||
public:
|
||||
explicit ViaRoutePlugin(int max_locations_viaroute, int max_alternatives);
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::RouteParameters &route_parameters,
|
||||
util::json::Object &json_result) const;
|
||||
};
|
||||
|
||||
@@ -46,8 +46,6 @@ class RoutingAlgorithmsInterface
|
||||
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes) const = 0;
|
||||
|
||||
virtual const DataFacadeBase &GetFacade() const = 0;
|
||||
|
||||
virtual bool HasAlternativePathSearch() const = 0;
|
||||
virtual bool HasShortestPathSearch() const = 0;
|
||||
virtual bool HasDirectShortestPathSearch() const = 0;
|
||||
@@ -61,7 +59,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
||||
{
|
||||
public:
|
||||
RoutingAlgorithms(SearchEngineData<Algorithm> &heaps,
|
||||
std::shared_ptr<const DataFacade<Algorithm>> facade)
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade)
|
||||
: heaps(heaps), facade(facade)
|
||||
{
|
||||
}
|
||||
@@ -95,8 +93,6 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
||||
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes) const final override;
|
||||
|
||||
const DataFacadeBase &GetFacade() const final override { return *facade; }
|
||||
|
||||
bool HasAlternativePathSearch() const final override
|
||||
{
|
||||
return routing_algorithms::HasAlternativePathSearch<Algorithm>::value;
|
||||
@@ -129,7 +125,9 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
||||
|
||||
private:
|
||||
SearchEngineData<Algorithm> &heaps;
|
||||
std::shared_ptr<const DataFacade<Algorithm>> facade;
|
||||
|
||||
// Owned by shared-ptr passed to the query
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
|
||||
};
|
||||
|
||||
template <typename Algorithm>
|
||||
@@ -138,7 +136,7 @@ RoutingAlgorithms<Algorithm>::AlternativePathSearch(const PhantomNodes &phantom_
|
||||
unsigned number_of_alternatives) const
|
||||
{
|
||||
return routing_algorithms::alternativePathSearch(
|
||||
heaps, *facade, phantom_node_pair, number_of_alternatives);
|
||||
heaps, facade, phantom_node_pair, number_of_alternatives);
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
@@ -147,14 +145,14 @@ InternalRouteResult RoutingAlgorithms<Algorithm>::ShortestPathSearch(
|
||||
const boost::optional<bool> continue_straight_at_waypoint) const
|
||||
{
|
||||
return routing_algorithms::shortestPathSearch(
|
||||
heaps, *facade, phantom_node_pair, continue_straight_at_waypoint);
|
||||
heaps, facade, phantom_node_pair, continue_straight_at_waypoint);
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
InternalRouteResult
|
||||
RoutingAlgorithms<Algorithm>::DirectShortestPathSearch(const PhantomNodes &phantom_nodes) const
|
||||
{
|
||||
return routing_algorithms::directShortestPathSearch(heaps, *facade, phantom_nodes);
|
||||
return routing_algorithms::directShortestPathSearch(heaps, facade, phantom_nodes);
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
@@ -164,7 +162,7 @@ RoutingAlgorithms<Algorithm>::ManyToManySearch(const std::vector<PhantomNode> &p
|
||||
const std::vector<std::size_t> &target_indices) const
|
||||
{
|
||||
return routing_algorithms::manyToManySearch(
|
||||
heaps, *facade, phantom_nodes, source_indices, target_indices);
|
||||
heaps, facade, phantom_nodes, source_indices, target_indices);
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
@@ -176,7 +174,7 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<Algorithm>::MapMatc
|
||||
const bool allow_splitting) const
|
||||
{
|
||||
return routing_algorithms::mapMatching(heaps,
|
||||
*facade,
|
||||
facade,
|
||||
candidates_list,
|
||||
trace_coordinates,
|
||||
trace_timestamps,
|
||||
@@ -189,7 +187,7 @@ inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<Algorithm>::G
|
||||
const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes) const
|
||||
{
|
||||
return routing_algorithms::getTileTurns(*facade, edges, sorted_edge_indexes);
|
||||
return routing_algorithms::getTileTurns(facade, edges, sorted_edge_indexes);
|
||||
}
|
||||
|
||||
// CoreCH overrides
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ALTERNATIVE_PATH_ROUTING_HPP
|
||||
#define ALTERNATIVE_PATH_ROUTING_HPP
|
||||
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/internal_route_result.hpp"
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
@@ -16,15 +16,17 @@ namespace engine
|
||||
namespace routing_algorithms
|
||||
{
|
||||
|
||||
InternalManyRoutesResult alternativePathSearch(SearchEngineData<ch::Algorithm> &search_engine_data,
|
||||
const DataFacade<ch::Algorithm> &facade,
|
||||
const PhantomNodes &phantom_node_pair,
|
||||
unsigned number_of_alternatives);
|
||||
InternalManyRoutesResult
|
||||
alternativePathSearch(SearchEngineData<ch::Algorithm> &search_engine_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
|
||||
const PhantomNodes &phantom_node_pair,
|
||||
unsigned number_of_alternatives);
|
||||
|
||||
InternalManyRoutesResult alternativePathSearch(SearchEngineData<mld::Algorithm> &search_engine_data,
|
||||
const DataFacade<mld::Algorithm> &facade,
|
||||
const PhantomNodes &phantom_node_pair,
|
||||
unsigned number_of_alternatives);
|
||||
InternalManyRoutesResult
|
||||
alternativePathSearch(SearchEngineData<mld::Algorithm> &search_engine_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
|
||||
const PhantomNodes &phantom_node_pair,
|
||||
unsigned number_of_alternatives);
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define DIRECT_SHORTEST_PATH_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/internal_route_result.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
|
||||
@@ -22,9 +22,10 @@ namespace routing_algorithms
|
||||
/// This variation is only an optimazation for graphs with slow queries, for example
|
||||
/// not fully contracted graphs.
|
||||
template <typename Algorithm>
|
||||
InternalRouteResult directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
const PhantomNodes &phantom_nodes);
|
||||
InternalRouteResult
|
||||
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const PhantomNodes &phantom_nodes);
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define MANY_TO_MANY_ROUTING_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
|
||||
#include "util/typedefs.hpp"
|
||||
@@ -17,11 +17,12 @@ namespace routing_algorithms
|
||||
{
|
||||
|
||||
template <typename Algorithm>
|
||||
std::vector<EdgeWeight> manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
const std::vector<PhantomNode> &phantom_nodes,
|
||||
const std::vector<std::size_t> &source_indices,
|
||||
const std::vector<std::size_t> &target_indices);
|
||||
std::vector<EdgeWeight>
|
||||
manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const std::vector<PhantomNode> &phantom_nodes,
|
||||
const std::vector<std::size_t> &source_indices,
|
||||
const std::vector<std::size_t> &target_indices);
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define MAP_MATCHING_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/map_matching/sub_matching.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
|
||||
@@ -24,7 +24,7 @@ static const constexpr double DEFAULT_GPS_PRECISION = 5;
|
||||
// P. Newson and J. Krumm; 2009; ACM GIS
|
||||
template <typename Algorithm>
|
||||
SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const CandidateLists &candidates_list,
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/internal_route_result.hpp"
|
||||
#include "engine/phantom_node.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
@@ -134,13 +134,23 @@ void annotatePath(const FacadeT &facade,
|
||||
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_segment_id.id == target_node_id ||
|
||||
phantom_node_pair.target_phantom.reverse_segment_id.id == target_node_id);
|
||||
|
||||
// datastructures to hold extracted data from geometry
|
||||
std::vector<NodeID> id_vector;
|
||||
std::vector<EdgeWeight> weight_vector;
|
||||
std::vector<EdgeWeight> duration_vector;
|
||||
std::vector<DatasourceID> datasource_vector;
|
||||
auto node_from = unpacked_nodes.begin(), node_last = std::prev(unpacked_nodes.end());
|
||||
for (auto edge = unpacked_edges.begin(); node_from != node_last; ++node_from, ++edge)
|
||||
{
|
||||
const auto &edge_data = facade.GetEdgeData(*edge);
|
||||
const auto turn_id = edge_data.turn_id; // edge-based graph edge index
|
||||
const auto node_id = *node_from; // edge-based graph node index
|
||||
const auto name_index = facade.GetNameIndex(node_id);
|
||||
const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id);
|
||||
const extractor::TravelMode travel_mode = facade.GetTravelMode(node_id);
|
||||
const auto classes = facade.GetClassData(node_id);
|
||||
|
||||
const auto get_segment_geometry = [&](const auto geometry_index) {
|
||||
const auto geometry_index = facade.GetGeometryIndex(node_id);
|
||||
std::vector<NodeID> id_vector;
|
||||
|
||||
std::vector<EdgeWeight> weight_vector;
|
||||
std::vector<EdgeWeight> duration_vector;
|
||||
std::vector<DatasourceID> datasource_vector;
|
||||
if (geometry_index.forward)
|
||||
{
|
||||
id_vector = facade.GetUncompressedForwardGeometry(geometry_index.id);
|
||||
@@ -155,22 +165,6 @@ void annotatePath(const FacadeT &facade,
|
||||
duration_vector = facade.GetUncompressedReverseDurations(geometry_index.id);
|
||||
datasource_vector = facade.GetUncompressedReverseDatasources(geometry_index.id);
|
||||
}
|
||||
};
|
||||
|
||||
auto node_from = unpacked_nodes.begin(), node_last = std::prev(unpacked_nodes.end());
|
||||
for (auto edge = unpacked_edges.begin(); node_from != node_last; ++node_from, ++edge)
|
||||
{
|
||||
const auto &edge_data = facade.GetEdgeData(*edge);
|
||||
const auto turn_id = edge_data.turn_id; // edge-based graph edge index
|
||||
const auto node_id = *node_from; // edge-based graph node index
|
||||
const auto name_index = facade.GetNameIndex(node_id);
|
||||
const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id);
|
||||
const extractor::TravelMode travel_mode = facade.GetTravelMode(node_id);
|
||||
const auto classes = facade.GetClassData(node_id);
|
||||
|
||||
const auto geometry_index = facade.GetGeometryIndex(node_id);
|
||||
get_segment_geometry(geometry_index);
|
||||
|
||||
BOOST_ASSERT(id_vector.size() > 0);
|
||||
BOOST_ASSERT(datasource_vector.size() > 0);
|
||||
BOOST_ASSERT(weight_vector.size() == id_vector.size() - 1);
|
||||
@@ -222,14 +216,21 @@ void annotatePath(const FacadeT &facade,
|
||||
}
|
||||
|
||||
std::size_t start_index = 0, end_index = 0;
|
||||
std::vector<unsigned> id_vector;
|
||||
std::vector<EdgeWeight> weight_vector;
|
||||
std::vector<EdgeWeight> duration_vector;
|
||||
std::vector<DatasourceID> datasource_vector;
|
||||
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||
const auto target_geometry = facade.GetGeometryIndex(target_node_id);
|
||||
const auto is_local_path = source_geometry_id == target_geometry.id && unpacked_path.empty();
|
||||
|
||||
get_segment_geometry(target_geometry);
|
||||
const auto target_geometry_id = facade.GetGeometryIndex(target_node_id).id;
|
||||
const auto is_local_path = source_geometry_id == target_geometry_id && unpacked_path.empty();
|
||||
|
||||
if (target_traversed_in_reverse)
|
||||
{
|
||||
id_vector = facade.GetUncompressedReverseGeometry(target_geometry_id);
|
||||
weight_vector = facade.GetUncompressedReverseWeights(target_geometry_id);
|
||||
duration_vector = facade.GetUncompressedReverseDurations(target_geometry_id);
|
||||
datasource_vector = facade.GetUncompressedReverseDatasources(target_geometry_id);
|
||||
|
||||
if (is_local_path)
|
||||
{
|
||||
start_index =
|
||||
@@ -245,6 +246,11 @@ void annotatePath(const FacadeT &facade,
|
||||
start_index = phantom_node_pair.source_phantom.fwd_segment_position;
|
||||
}
|
||||
end_index = phantom_node_pair.target_phantom.fwd_segment_position;
|
||||
|
||||
id_vector = facade.GetUncompressedForwardGeometry(target_geometry_id);
|
||||
weight_vector = facade.GetUncompressedForwardWeights(target_geometry_id);
|
||||
duration_vector = facade.GetUncompressedForwardDurations(target_geometry_id);
|
||||
datasource_vector = facade.GetUncompressedForwardDatasources(target_geometry_id);
|
||||
}
|
||||
|
||||
// Given the following compressed geometry:
|
||||
@@ -302,10 +308,28 @@ void annotatePath(const FacadeT &facade,
|
||||
unpacked_path.front().duration_until_turn =
|
||||
std::max(unpacked_path.front().duration_until_turn - source_duration, 0);
|
||||
}
|
||||
|
||||
// there is no equivalent to a node-based node in an edge-expanded graph.
|
||||
// two equivalent routes may start (or end) at different node-based edges
|
||||
// as they are added with the offset how much "weight" on the edge
|
||||
// has already been traversed. Depending on offset one needs to remove
|
||||
// the last node.
|
||||
if (unpacked_path.size() > 1)
|
||||
{
|
||||
const std::size_t last_index = unpacked_path.size() - 1;
|
||||
const std::size_t second_to_last_index = last_index - 1;
|
||||
|
||||
if (unpacked_path[last_index].turn_via_node ==
|
||||
unpacked_path[second_to_last_index].turn_via_node)
|
||||
{
|
||||
unpacked_path.pop_back();
|
||||
}
|
||||
BOOST_ASSERT(!unpacked_path.empty());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
double getPathDistance(const DataFacade<Algorithm> &facade,
|
||||
double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const std::vector<PathData> unpacked_path,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom)
|
||||
@@ -358,11 +382,12 @@ double getPathDistance(const DataFacade<Algorithm> &facade,
|
||||
}
|
||||
|
||||
template <typename AlgorithmT>
|
||||
InternalRouteResult extractRoute(const DataFacade<AlgorithmT> &facade,
|
||||
const EdgeWeight weight,
|
||||
const PhantomNodes &phantom_nodes,
|
||||
const std::vector<NodeID> &unpacked_nodes,
|
||||
const std::vector<EdgeID> &unpacked_edges)
|
||||
InternalRouteResult
|
||||
extractRoute(const datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT> &facade,
|
||||
const EdgeWeight weight,
|
||||
const PhantomNodes &phantom_nodes,
|
||||
const std::vector<NodeID> &unpacked_nodes,
|
||||
const std::vector<EdgeID> &unpacked_edges)
|
||||
{
|
||||
InternalRouteResult raw_route_data;
|
||||
raw_route_data.segment_end_coordinates = {phantom_nodes};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define OSRM_ENGINE_ROUTING_BASE_CH_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/routing_algorithms/routing_base.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ch
|
||||
|
||||
// Stalling
|
||||
template <bool DIRECTION, typename HeapT>
|
||||
bool stallAtNode(const DataFacade<Algorithm> &facade,
|
||||
bool stallAtNode(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const NodeID node,
|
||||
const EdgeWeight weight,
|
||||
const HeapT &query_heap)
|
||||
@@ -49,7 +49,7 @@ bool stallAtNode(const DataFacade<Algorithm> &facade,
|
||||
}
|
||||
|
||||
template <bool DIRECTION>
|
||||
void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
||||
void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const NodeID node,
|
||||
const EdgeWeight weight,
|
||||
SearchEngineData<Algorithm>::QueryHeap &heap)
|
||||
@@ -113,7 +113,7 @@ we need to add an offset to the termination criterion.
|
||||
static constexpr bool ENABLE_STALLING = true;
|
||||
static constexpr bool DISABLE_STALLING = false;
|
||||
template <bool DIRECTION, bool STALLING = ENABLE_STALLING>
|
||||
void routingStep(const DataFacade<Algorithm> &facade,
|
||||
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
NodeID &middle_node_id,
|
||||
@@ -186,7 +186,8 @@ void routingStep(const DataFacade<Algorithm> &facade,
|
||||
}
|
||||
|
||||
template <bool UseDuration>
|
||||
EdgeWeight getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
|
||||
EdgeWeight getLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
NodeID node)
|
||||
{
|
||||
EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT;
|
||||
for (auto edge : facade.GetAdjacentEdgeRange(node))
|
||||
@@ -226,7 +227,7 @@ EdgeWeight getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
|
||||
* original edge found.
|
||||
*/
|
||||
template <typename BidirectionalIterator, typename Callback>
|
||||
void unpackPath(const DataFacade<Algorithm> &facade,
|
||||
void unpackPath(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
BidirectionalIterator packed_path_begin,
|
||||
BidirectionalIterator packed_path_end,
|
||||
Callback &&callback)
|
||||
@@ -326,7 +327,7 @@ void unpackPath(const FacadeT &facade,
|
||||
* @param to the node the CH edge finishes at
|
||||
* @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge
|
||||
*/
|
||||
void unpackEdge(const DataFacade<Algorithm> &facade,
|
||||
void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const NodeID from,
|
||||
const NodeID to,
|
||||
std::vector<NodeID> &unpacked_path);
|
||||
@@ -353,7 +354,7 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHe
|
||||
// requires
|
||||
// a force loop, if the heaps have been initialized with positive offsets.
|
||||
void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
std::int32_t &weight,
|
||||
@@ -366,13 +367,14 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
// Requires the heaps for be empty
|
||||
// If heaps should be adjusted to be initialized outside of this function,
|
||||
// the addition of force_loop parameters might be required
|
||||
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<ch::Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
||||
double
|
||||
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
||||
|
||||
} // namespace ch
|
||||
|
||||
@@ -388,7 +390,7 @@ namespace corech
|
||||
// requires
|
||||
// a force loop, if the heaps have been initialized with positive offsets.
|
||||
void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<corech::Algorithm> &facade,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
||||
int &weight,
|
||||
@@ -401,13 +403,14 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
// Requires the heaps for be empty
|
||||
// If heaps should be adjusted to be initialized outside of this function,
|
||||
// the addition of force_loop parameters might be required
|
||||
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<corech::Algorithm> &facade,
|
||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
||||
double
|
||||
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
|
||||
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
int duration_upper_bound = INVALID_EDGE_WEIGHT);
|
||||
|
||||
template <typename RandomIter, typename FacadeT>
|
||||
void unpackPath(const FacadeT &facade,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define OSRM_ENGINE_ROUTING_BASE_MLD_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/routing_algorithms/routing_base.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
|
||||
@@ -30,8 +30,7 @@ namespace
|
||||
// Unrestricted search (Args is const PhantomNodes &):
|
||||
// * use partition.GetQueryLevel to find the node query level based on source and target phantoms
|
||||
// * allow to traverse all cells
|
||||
template <typename MultiLevelPartition>
|
||||
inline LevelID getNodeQueryLevel(const MultiLevelPartition &partition,
|
||||
inline LevelID getNodeQueryLevel(const partition::MultiLevelPartitionView &partition,
|
||||
NodeID node,
|
||||
const PhantomNodes &phantom_nodes)
|
||||
{
|
||||
@@ -55,8 +54,8 @@ inline bool checkParentCellRestriction(CellID, const PhantomNodes &) { return tr
|
||||
// Restricted search (Args is LevelID, CellID):
|
||||
// * use the fixed level for queries
|
||||
// * check if the node cell is the same as the specified parent onr
|
||||
template <typename MultiLevelPartition>
|
||||
inline LevelID getNodeQueryLevel(const MultiLevelPartition &, NodeID, LevelID level, CellID)
|
||||
inline LevelID
|
||||
getNodeQueryLevel(const partition::MultiLevelPartitionView &, NodeID, LevelID level, CellID)
|
||||
{
|
||||
return level;
|
||||
}
|
||||
@@ -131,10 +130,10 @@ retrievePackedPathFromHeap(const SearchEngineData<Algorithm>::QueryHeap &forward
|
||||
return packed_path;
|
||||
}
|
||||
|
||||
template <bool DIRECTION, typename Algorithm, typename... Args>
|
||||
void routingStep(const DataFacade<Algorithm> &facade,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
template <bool DIRECTION, typename... Args>
|
||||
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
NodeID &middle_node,
|
||||
EdgeWeight &path_upper_bound,
|
||||
const bool force_loop_forward,
|
||||
@@ -261,11 +260,11 @@ using UnpackedNodes = std::vector<NodeID>;
|
||||
using UnpackedEdges = std::vector<EdgeID>;
|
||||
using UnpackedPath = std::tuple<EdgeWeight, UnpackedNodes, UnpackedEdges>;
|
||||
|
||||
template <typename Algorithm, typename... Args>
|
||||
template <typename... Args>
|
||||
UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const bool force_loop_forward,
|
||||
const bool force_loop_reverse,
|
||||
EdgeWeight weight_upper_bound,
|
||||
@@ -390,11 +389,10 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
}
|
||||
|
||||
// Alias to be compatible with the CH-based search
|
||||
template <typename Algorithm>
|
||||
inline void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
EdgeWeight &weight,
|
||||
std::vector<NodeID> &unpacked_nodes,
|
||||
const bool force_loop_forward,
|
||||
@@ -444,14 +442,14 @@ void unpackPath(const FacadeT &facade,
|
||||
annotatePath(facade, phantom_nodes, unpacked_nodes, unpacked_edges, unpacked_path);
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT)
|
||||
inline double
|
||||
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT)
|
||||
{
|
||||
forward_heap.Clear();
|
||||
reverse_heap.Clear();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef OSRM_SHORTEST_PATH_HPP
|
||||
#define OSRM_SHORTEST_PATH_HPP
|
||||
#ifndef SHORTEST_PATH_HPP
|
||||
#define SHORTEST_PATH_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/routing_algorithms/routing_base.hpp"
|
||||
@@ -14,13 +14,14 @@ namespace routing_algorithms
|
||||
{
|
||||
|
||||
template <typename Algorithm>
|
||||
InternalRouteResult shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
||||
const boost::optional<bool> continue_straight_at_waypoint);
|
||||
InternalRouteResult
|
||||
shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
|
||||
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
||||
const boost::optional<bool> continue_straight_at_waypoint);
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif /* OSRM_SHORTEST_PATH_HPP */
|
||||
#endif /* SHORTEST_PATH_HPP */
|
||||
|
||||
@@ -1,463 +0,0 @@
|
||||
#ifndef OSRM_SHORTEST_PATH_IMPL_HPP
|
||||
#define OSRM_SHORTEST_PATH_IMPL_HPP
|
||||
|
||||
#include "engine/routing_algorithms/shortest_path.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace routing_algorithms
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
const static constexpr bool DO_NOT_FORCE_LOOP = false;
|
||||
|
||||
// allows a uturn at the target_phantom
|
||||
// searches source forward/reverse -> target forward/reverse
|
||||
template <typename Algorithm>
|
||||
void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const bool search_from_forward_node,
|
||||
const bool search_from_reverse_node,
|
||||
const bool search_to_forward_node,
|
||||
const bool search_to_reverse_node,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
const int total_weight_to_forward,
|
||||
const int total_weight_to_reverse,
|
||||
int &new_total_weight,
|
||||
std::vector<NodeID> &leg_packed_path)
|
||||
{
|
||||
forward_heap.Clear();
|
||||
reverse_heap.Clear();
|
||||
if (search_from_forward_node)
|
||||
{
|
||||
forward_heap.Insert(source_phantom.forward_segment_id.id,
|
||||
-source_phantom.GetForwardWeightPlusOffset(),
|
||||
source_phantom.forward_segment_id.id);
|
||||
}
|
||||
if (search_from_reverse_node)
|
||||
{
|
||||
forward_heap.Insert(source_phantom.reverse_segment_id.id,
|
||||
-source_phantom.GetReverseWeightPlusOffset(),
|
||||
source_phantom.reverse_segment_id.id);
|
||||
}
|
||||
if (search_to_forward_node)
|
||||
{
|
||||
reverse_heap.Insert(target_phantom.forward_segment_id.id,
|
||||
target_phantom.GetForwardWeightPlusOffset(),
|
||||
target_phantom.forward_segment_id.id);
|
||||
}
|
||||
if (search_to_reverse_node)
|
||||
{
|
||||
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
|
||||
target_phantom.GetReverseWeightPlusOffset(),
|
||||
target_phantom.reverse_segment_id.id);
|
||||
}
|
||||
|
||||
// this is only relevent if source and target are on the same compressed edge
|
||||
auto is_oneway_source = !(search_from_forward_node && search_from_reverse_node);
|
||||
auto is_oneway_target = !(search_to_forward_node && search_to_reverse_node);
|
||||
// we only enable loops here if we can't search from forward to backward node
|
||||
auto needs_loop_forwards = is_oneway_source && needsLoopForward(source_phantom, target_phantom);
|
||||
auto needs_loop_backwards =
|
||||
is_oneway_target && needsLoopBackwards(source_phantom, target_phantom);
|
||||
|
||||
search(engine_working_data,
|
||||
facade,
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
new_total_weight,
|
||||
leg_packed_path,
|
||||
needs_loop_forwards,
|
||||
needs_loop_backwards,
|
||||
{source_phantom, target_phantom});
|
||||
|
||||
// if no route is found between two parts of the via-route, the entire route becomes
|
||||
// invalid. Adding to invalid edge weight sadly doesn't return an invalid edge weight. Here
|
||||
// we prevent the possible overflow, faking the addition of infinity + x == infinity
|
||||
if (new_total_weight != INVALID_EDGE_WEIGHT)
|
||||
new_total_weight += std::min(total_weight_to_forward, total_weight_to_reverse);
|
||||
}
|
||||
|
||||
// searches shortest path between:
|
||||
// source forward/reverse -> target forward
|
||||
// source forward/reverse -> target reverse
|
||||
template <typename Algorithm>
|
||||
void search(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
|
||||
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
|
||||
const bool search_from_forward_node,
|
||||
const bool search_from_reverse_node,
|
||||
const bool search_to_forward_node,
|
||||
const bool search_to_reverse_node,
|
||||
const PhantomNode &source_phantom,
|
||||
const PhantomNode &target_phantom,
|
||||
const int total_weight_to_forward,
|
||||
const int total_weight_to_reverse,
|
||||
int &new_total_weight_to_forward,
|
||||
int &new_total_weight_to_reverse,
|
||||
std::vector<NodeID> &leg_packed_path_forward,
|
||||
std::vector<NodeID> &leg_packed_path_reverse)
|
||||
{
|
||||
if (search_to_forward_node)
|
||||
{
|
||||
forward_heap.Clear();
|
||||
reverse_heap.Clear();
|
||||
reverse_heap.Insert(target_phantom.forward_segment_id.id,
|
||||
target_phantom.GetForwardWeightPlusOffset(),
|
||||
target_phantom.forward_segment_id.id);
|
||||
|
||||
if (search_from_forward_node)
|
||||
{
|
||||
forward_heap.Insert(source_phantom.forward_segment_id.id,
|
||||
total_weight_to_forward -
|
||||
source_phantom.GetForwardWeightPlusOffset(),
|
||||
source_phantom.forward_segment_id.id);
|
||||
}
|
||||
if (search_from_reverse_node)
|
||||
{
|
||||
forward_heap.Insert(source_phantom.reverse_segment_id.id,
|
||||
total_weight_to_reverse -
|
||||
source_phantom.GetReverseWeightPlusOffset(),
|
||||
source_phantom.reverse_segment_id.id);
|
||||
}
|
||||
|
||||
search(engine_working_data,
|
||||
facade,
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
new_total_weight_to_forward,
|
||||
leg_packed_path_forward,
|
||||
needsLoopForward(source_phantom, target_phantom),
|
||||
routing_algorithms::DO_NOT_FORCE_LOOP,
|
||||
{source_phantom, target_phantom});
|
||||
}
|
||||
|
||||
if (search_to_reverse_node)
|
||||
{
|
||||
forward_heap.Clear();
|
||||
reverse_heap.Clear();
|
||||
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
|
||||
target_phantom.GetReverseWeightPlusOffset(),
|
||||
target_phantom.reverse_segment_id.id);
|
||||
if (search_from_forward_node)
|
||||
{
|
||||
forward_heap.Insert(source_phantom.forward_segment_id.id,
|
||||
total_weight_to_forward -
|
||||
source_phantom.GetForwardWeightPlusOffset(),
|
||||
source_phantom.forward_segment_id.id);
|
||||
}
|
||||
if (search_from_reverse_node)
|
||||
{
|
||||
forward_heap.Insert(source_phantom.reverse_segment_id.id,
|
||||
total_weight_to_reverse -
|
||||
source_phantom.GetReverseWeightPlusOffset(),
|
||||
source_phantom.reverse_segment_id.id);
|
||||
}
|
||||
|
||||
search(engine_working_data,
|
||||
facade,
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
new_total_weight_to_reverse,
|
||||
leg_packed_path_reverse,
|
||||
routing_algorithms::DO_NOT_FORCE_LOOP,
|
||||
needsLoopBackwards(source_phantom, target_phantom),
|
||||
{source_phantom, target_phantom});
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
void unpackLegs(const DataFacade<Algorithm> &facade,
|
||||
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
||||
const std::vector<NodeID> &total_packed_path,
|
||||
const std::vector<std::size_t> &packed_leg_begin,
|
||||
const EdgeWeight shortest_path_weight,
|
||||
InternalRouteResult &raw_route_data)
|
||||
{
|
||||
raw_route_data.unpacked_path_segments.resize(packed_leg_begin.size() - 1);
|
||||
|
||||
raw_route_data.shortest_path_weight = shortest_path_weight;
|
||||
|
||||
for (const auto current_leg : util::irange<std::size_t>(0UL, packed_leg_begin.size() - 1))
|
||||
{
|
||||
auto leg_begin = total_packed_path.begin() + packed_leg_begin[current_leg];
|
||||
auto leg_end = total_packed_path.begin() + packed_leg_begin[current_leg + 1];
|
||||
const auto &unpack_phantom_node_pair = phantom_nodes_vector[current_leg];
|
||||
unpackPath(facade,
|
||||
leg_begin,
|
||||
leg_end,
|
||||
unpack_phantom_node_pair,
|
||||
raw_route_data.unpacked_path_segments[current_leg]);
|
||||
|
||||
raw_route_data.source_traversed_in_reverse.push_back(
|
||||
(*leg_begin != phantom_nodes_vector[current_leg].source_phantom.forward_segment_id.id));
|
||||
raw_route_data.target_traversed_in_reverse.push_back(
|
||||
(*std::prev(leg_end) !=
|
||||
phantom_nodes_vector[current_leg].target_phantom.forward_segment_id.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
InternalRouteResult shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade,
|
||||
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
||||
const boost::optional<bool> continue_straight_at_waypoint)
|
||||
{
|
||||
InternalRouteResult raw_route_data;
|
||||
raw_route_data.segment_end_coordinates = phantom_nodes_vector;
|
||||
const bool allow_uturn_at_waypoint =
|
||||
!(continue_straight_at_waypoint ? *continue_straight_at_waypoint
|
||||
: facade.GetContinueStraightDefault());
|
||||
|
||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
|
||||
|
||||
auto &forward_heap = *engine_working_data.forward_heap_1;
|
||||
auto &reverse_heap = *engine_working_data.reverse_heap_1;
|
||||
|
||||
int total_weight_to_forward = 0;
|
||||
int total_weight_to_reverse = 0;
|
||||
bool search_from_forward_node =
|
||||
phantom_nodes_vector.front().source_phantom.IsValidForwardSource();
|
||||
bool search_from_reverse_node =
|
||||
phantom_nodes_vector.front().source_phantom.IsValidReverseSource();
|
||||
|
||||
std::vector<NodeID> prev_packed_leg_to_forward;
|
||||
std::vector<NodeID> prev_packed_leg_to_reverse;
|
||||
|
||||
std::vector<NodeID> total_packed_path_to_forward;
|
||||
std::vector<std::size_t> packed_leg_to_forward_begin;
|
||||
std::vector<NodeID> total_packed_path_to_reverse;
|
||||
std::vector<std::size_t> packed_leg_to_reverse_begin;
|
||||
|
||||
std::size_t current_leg = 0;
|
||||
// this implements a dynamic program that finds the shortest route through
|
||||
// a list of vias
|
||||
for (const auto &phantom_node_pair : phantom_nodes_vector)
|
||||
{
|
||||
int new_total_weight_to_forward = INVALID_EDGE_WEIGHT;
|
||||
int new_total_weight_to_reverse = INVALID_EDGE_WEIGHT;
|
||||
|
||||
std::vector<NodeID> packed_leg_to_forward;
|
||||
std::vector<NodeID> packed_leg_to_reverse;
|
||||
|
||||
const auto &source_phantom = phantom_node_pair.source_phantom;
|
||||
const auto &target_phantom = phantom_node_pair.target_phantom;
|
||||
|
||||
bool search_to_forward_node = target_phantom.IsValidForwardTarget();
|
||||
bool search_to_reverse_node = target_phantom.IsValidReverseTarget();
|
||||
|
||||
BOOST_ASSERT(!search_from_forward_node || source_phantom.IsValidForwardSource());
|
||||
BOOST_ASSERT(!search_from_reverse_node || source_phantom.IsValidReverseSource());
|
||||
|
||||
if (search_to_reverse_node || search_to_forward_node)
|
||||
{
|
||||
if (allow_uturn_at_waypoint)
|
||||
{
|
||||
searchWithUTurn(engine_working_data,
|
||||
facade,
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
search_from_forward_node,
|
||||
search_from_reverse_node,
|
||||
search_to_forward_node,
|
||||
search_to_reverse_node,
|
||||
source_phantom,
|
||||
target_phantom,
|
||||
total_weight_to_forward,
|
||||
total_weight_to_reverse,
|
||||
new_total_weight_to_forward,
|
||||
packed_leg_to_forward);
|
||||
// if only the reverse node is valid (e.g. when using the match plugin) we
|
||||
// actually need to move
|
||||
if (!target_phantom.IsValidForwardTarget())
|
||||
{
|
||||
BOOST_ASSERT(target_phantom.IsValidReverseTarget());
|
||||
new_total_weight_to_reverse = new_total_weight_to_forward;
|
||||
packed_leg_to_reverse = std::move(packed_leg_to_forward);
|
||||
new_total_weight_to_forward = INVALID_EDGE_WEIGHT;
|
||||
|
||||
// (*)
|
||||
//
|
||||
// Below we have to check if new_total_weight_to_forward is invalid.
|
||||
// This prevents use-after-move on packed_leg_to_forward.
|
||||
}
|
||||
else if (target_phantom.IsValidReverseTarget())
|
||||
{
|
||||
new_total_weight_to_reverse = new_total_weight_to_forward;
|
||||
packed_leg_to_reverse = packed_leg_to_forward;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
search(engine_working_data,
|
||||
facade,
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
search_from_forward_node,
|
||||
search_from_reverse_node,
|
||||
search_to_forward_node,
|
||||
search_to_reverse_node,
|
||||
source_phantom,
|
||||
target_phantom,
|
||||
total_weight_to_forward,
|
||||
total_weight_to_reverse,
|
||||
new_total_weight_to_forward,
|
||||
new_total_weight_to_reverse,
|
||||
packed_leg_to_forward,
|
||||
packed_leg_to_reverse);
|
||||
}
|
||||
}
|
||||
|
||||
// Note: To make sure we do not access the moved-from packed_leg_to_forward
|
||||
// we guard its access by a check for invalid edge weight. See (*) above.
|
||||
|
||||
// No path found for both target nodes?
|
||||
if ((INVALID_EDGE_WEIGHT == new_total_weight_to_forward) &&
|
||||
(INVALID_EDGE_WEIGHT == new_total_weight_to_reverse))
|
||||
{
|
||||
return raw_route_data;
|
||||
}
|
||||
|
||||
// we need to figure out how the new legs connect to the previous ones
|
||||
if (current_leg > 0)
|
||||
{
|
||||
bool forward_to_forward =
|
||||
(new_total_weight_to_forward != INVALID_EDGE_WEIGHT) &&
|
||||
packed_leg_to_forward.front() == source_phantom.forward_segment_id.id;
|
||||
bool reverse_to_forward =
|
||||
(new_total_weight_to_forward != INVALID_EDGE_WEIGHT) &&
|
||||
packed_leg_to_forward.front() == source_phantom.reverse_segment_id.id;
|
||||
bool forward_to_reverse =
|
||||
(new_total_weight_to_reverse != INVALID_EDGE_WEIGHT) &&
|
||||
packed_leg_to_reverse.front() == source_phantom.forward_segment_id.id;
|
||||
bool reverse_to_reverse =
|
||||
(new_total_weight_to_reverse != INVALID_EDGE_WEIGHT) &&
|
||||
packed_leg_to_reverse.front() == source_phantom.reverse_segment_id.id;
|
||||
|
||||
BOOST_ASSERT(!forward_to_forward || !reverse_to_forward);
|
||||
BOOST_ASSERT(!forward_to_reverse || !reverse_to_reverse);
|
||||
|
||||
// in this case we always need to copy
|
||||
if (forward_to_forward && forward_to_reverse)
|
||||
{
|
||||
// in this case we copy the path leading to the source forward node
|
||||
// and change the case
|
||||
total_packed_path_to_reverse = total_packed_path_to_forward;
|
||||
packed_leg_to_reverse_begin = packed_leg_to_forward_begin;
|
||||
forward_to_reverse = false;
|
||||
reverse_to_reverse = true;
|
||||
}
|
||||
else if (reverse_to_forward && reverse_to_reverse)
|
||||
{
|
||||
total_packed_path_to_forward = total_packed_path_to_reverse;
|
||||
packed_leg_to_forward_begin = packed_leg_to_reverse_begin;
|
||||
reverse_to_forward = false;
|
||||
forward_to_forward = true;
|
||||
}
|
||||
BOOST_ASSERT(!forward_to_forward || !forward_to_reverse);
|
||||
BOOST_ASSERT(!reverse_to_forward || !reverse_to_reverse);
|
||||
|
||||
// in this case we just need to swap to regain the correct mapping
|
||||
if (reverse_to_forward || forward_to_reverse)
|
||||
{
|
||||
total_packed_path_to_forward.swap(total_packed_path_to_reverse);
|
||||
packed_leg_to_forward_begin.swap(packed_leg_to_reverse_begin);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_total_weight_to_forward != INVALID_EDGE_WEIGHT)
|
||||
{
|
||||
BOOST_ASSERT(target_phantom.IsValidForwardTarget());
|
||||
|
||||
packed_leg_to_forward_begin.push_back(total_packed_path_to_forward.size());
|
||||
total_packed_path_to_forward.insert(total_packed_path_to_forward.end(),
|
||||
packed_leg_to_forward.begin(),
|
||||
packed_leg_to_forward.end());
|
||||
search_from_forward_node = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
total_packed_path_to_forward.clear();
|
||||
packed_leg_to_forward_begin.clear();
|
||||
search_from_forward_node = false;
|
||||
}
|
||||
|
||||
if (new_total_weight_to_reverse != INVALID_EDGE_WEIGHT)
|
||||
{
|
||||
BOOST_ASSERT(target_phantom.IsValidReverseTarget());
|
||||
|
||||
packed_leg_to_reverse_begin.push_back(total_packed_path_to_reverse.size());
|
||||
total_packed_path_to_reverse.insert(total_packed_path_to_reverse.end(),
|
||||
packed_leg_to_reverse.begin(),
|
||||
packed_leg_to_reverse.end());
|
||||
search_from_reverse_node = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
total_packed_path_to_reverse.clear();
|
||||
packed_leg_to_reverse_begin.clear();
|
||||
search_from_reverse_node = false;
|
||||
}
|
||||
|
||||
prev_packed_leg_to_forward = std::move(packed_leg_to_forward);
|
||||
prev_packed_leg_to_reverse = std::move(packed_leg_to_reverse);
|
||||
|
||||
total_weight_to_forward = new_total_weight_to_forward;
|
||||
total_weight_to_reverse = new_total_weight_to_reverse;
|
||||
|
||||
++current_leg;
|
||||
}
|
||||
|
||||
BOOST_ASSERT(total_weight_to_forward != INVALID_EDGE_WEIGHT ||
|
||||
total_weight_to_reverse != INVALID_EDGE_WEIGHT);
|
||||
|
||||
// We make sure the fastest route is always in packed_legs_to_forward
|
||||
if (total_weight_to_forward < total_weight_to_reverse ||
|
||||
(total_weight_to_forward == total_weight_to_reverse &&
|
||||
total_packed_path_to_forward.size() < total_packed_path_to_reverse.size()))
|
||||
{
|
||||
// insert sentinel
|
||||
packed_leg_to_forward_begin.push_back(total_packed_path_to_forward.size());
|
||||
BOOST_ASSERT(packed_leg_to_forward_begin.size() == phantom_nodes_vector.size() + 1);
|
||||
|
||||
unpackLegs(facade,
|
||||
phantom_nodes_vector,
|
||||
total_packed_path_to_forward,
|
||||
packed_leg_to_forward_begin,
|
||||
total_weight_to_forward,
|
||||
raw_route_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert sentinel
|
||||
packed_leg_to_reverse_begin.push_back(total_packed_path_to_reverse.size());
|
||||
BOOST_ASSERT(packed_leg_to_reverse_begin.size() == phantom_nodes_vector.size() + 1);
|
||||
|
||||
unpackLegs(facade,
|
||||
phantom_nodes_vector,
|
||||
total_packed_path_to_reverse,
|
||||
packed_leg_to_reverse_begin,
|
||||
total_weight_to_reverse,
|
||||
raw_route_data);
|
||||
}
|
||||
|
||||
return raw_route_data;
|
||||
}
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif /* OSRM_SHORTEST_PATH_IMPL_HPP */
|
||||
@@ -2,7 +2,7 @@
|
||||
#define OSRM_ENGINE_ROUTING_ALGORITHMS_TILE_TURNS_HPP
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "engine/datafacade.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
@@ -28,13 +28,15 @@ struct TurnData final
|
||||
|
||||
using RTreeLeaf = datafacade::BaseDataFacade::RTreeLeaf;
|
||||
|
||||
std::vector<TurnData> getTileTurns(const DataFacade<ch::Algorithm> &facade,
|
||||
const std::vector<RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes);
|
||||
std::vector<TurnData>
|
||||
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
|
||||
const std::vector<RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes);
|
||||
|
||||
std::vector<TurnData> getTileTurns(const DataFacade<mld::Algorithm> &facade,
|
||||
const std::vector<RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes);
|
||||
std::vector<TurnData>
|
||||
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
|
||||
const std::vector<RTreeLeaf> &edges,
|
||||
const std::vector<std::size_t> &sorted_edge_indexes);
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef SEARCH_ENGINE_DATA_HPP
|
||||
#define SEARCH_ENGINE_DATA_HPP
|
||||
|
||||
#include <boost/thread/tss.hpp>
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "util/query_heap.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <boost/thread/tss.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
@@ -37,6 +37,7 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||
{
|
||||
using QueryHeap = util::
|
||||
QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
|
||||
using ManyToManyQueryHeap = util::QueryHeap<NodeID,
|
||||
NodeID,
|
||||
@@ -44,7 +45,6 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||
ManyToManyHeapData,
|
||||
util::UnorderedMapStorage<NodeID, int>>;
|
||||
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||
|
||||
static SearchEngineHeapPtr forward_heap_1;
|
||||
@@ -106,6 +106,7 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
||||
util::UnorderedMapStorage<NodeID, int>>;
|
||||
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
|
||||
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||
|
||||
static SearchEngineHeapPtr forward_heap_1;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@@ -38,11 +36,7 @@ class CompressedEdgeContainer
|
||||
const EdgeWeight weight1,
|
||||
const EdgeWeight weight2,
|
||||
const EdgeDuration duration1,
|
||||
const EdgeDuration duration2,
|
||||
// node-penalties can be added before/or after the traversal of an edge which
|
||||
// depends on whether we traverse the link forwards or backwards.
|
||||
const boost::optional<EdgeWeight> node_weight_penalty = boost::none,
|
||||
const boost::optional<EdgeDuration> node_duration_penalty = boost::none);
|
||||
const EdgeDuration duration2);
|
||||
|
||||
void AddUncompressedEdge(const EdgeID edge_id,
|
||||
const NodeID target_node,
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef OSRM_EXTRACTOR_CONDITIONAL_TURN_PENALTY_HPP_
|
||||
#define OSRM_EXTRACTOR_CONDITIONAL_TURN_PENALTY_HPP_
|
||||
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/opening_hours.hpp"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace osrm
|
||||
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
struct ConditionalTurnPenalty
|
||||
{
|
||||
// offset into the sequential list of turn penalties (see TurnIndexBlock for reference);
|
||||
std::uint64_t turn_offset;
|
||||
util::Coordinate location;
|
||||
std::vector<util::OpeningHours> conditions;
|
||||
};
|
||||
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
|
||||
#endif // OSRM_EXTRACTOR_CONDITIONAL_TURN_PENALTY_HPP_
|
||||
@@ -4,7 +4,6 @@
|
||||
#define EDGE_BASED_GRAPH_FACTORY_HPP_
|
||||
|
||||
#include "extractor/compressed_edge_container.hpp"
|
||||
#include "extractor/conditional_turn_penalty.hpp"
|
||||
#include "extractor/edge_based_edge.hpp"
|
||||
#include "extractor/edge_based_node_segment.hpp"
|
||||
#include "extractor/extraction_turn.hpp"
|
||||
@@ -17,8 +16,7 @@
|
||||
#include "extractor/packed_osm_ids.hpp"
|
||||
#include "extractor/profile_properties.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction_index.hpp"
|
||||
#include "extractor/way_restriction_map.hpp"
|
||||
#include "extractor/restriction_map.hpp"
|
||||
|
||||
#include "util/concurrent_id_map.hpp"
|
||||
#include "util/deallocating_vector.hpp"
|
||||
@@ -42,6 +40,11 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
#include <tbb/concurrent_unordered_map.h>
|
||||
#include <tbb/concurrent_vector.h>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@@ -75,6 +78,7 @@ class EdgeBasedGraphFactory
|
||||
CompressedEdgeContainer &compressed_edge_container,
|
||||
const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const std::unordered_set<NodeID> &traffic_lights,
|
||||
std::shared_ptr<const RestrictionMap> restriction_map,
|
||||
const std::vector<util::Coordinate> &coordinates,
|
||||
const extractor::PackedOSMIDs &osm_node_ids,
|
||||
ProfileProperties profile_properties,
|
||||
@@ -87,11 +91,7 @@ class EdgeBasedGraphFactory
|
||||
const std::string &turn_weight_penalties_filename,
|
||||
const std::string &turn_duration_penalties_filename,
|
||||
const std::string &turn_penalties_index_filename,
|
||||
const std::string &cnbg_ebg_mapping_path,
|
||||
const std::string &conditional_penalties_filename,
|
||||
const RestrictionMap &node_restriction_map,
|
||||
const ConditionalRestrictionMap &conditional_restriction_map,
|
||||
const WayRestrictionMap &way_restriction_map);
|
||||
const std::string &cnbg_ebg_mapping_path);
|
||||
|
||||
// The following get access functions destroy the content in the factory
|
||||
void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges);
|
||||
@@ -106,7 +106,7 @@ class EdgeBasedGraphFactory
|
||||
std::vector<util::guidance::BearingClass> GetBearingClasses() const;
|
||||
std::vector<util::guidance::EntryClass> GetEntryClasses() const;
|
||||
|
||||
std::uint64_t GetNumberOfEdgeBasedNodes() const;
|
||||
unsigned GetHighestEdgeID();
|
||||
|
||||
// Basic analysis of a turn (u --(e1)-- v --(e2)-- w)
|
||||
// with known angle.
|
||||
@@ -122,18 +122,6 @@ class EdgeBasedGraphFactory
|
||||
private:
|
||||
using EdgeData = util::NodeBasedDynamicGraph::EdgeData;
|
||||
|
||||
struct Conditional
|
||||
{
|
||||
// the edge based nodes allow for a unique identification of conditionals
|
||||
NodeID from_node;
|
||||
NodeID to_node;
|
||||
ConditionalTurnPenalty penalty;
|
||||
};
|
||||
|
||||
// assign the correct index to the penalty value stored in the conditional
|
||||
std::vector<ConditionalTurnPenalty>
|
||||
IndexConditionals(std::vector<Conditional> &&conditionals) const;
|
||||
|
||||
//! maps index from m_edge_based_node_list to ture/false if the node is an entry point to the
|
||||
//! graph
|
||||
std::vector<bool> m_edge_based_node_is_startpoint;
|
||||
@@ -146,17 +134,12 @@ class EdgeBasedGraphFactory
|
||||
std::vector<EdgeBasedNodeSegment> m_edge_based_node_segments;
|
||||
EdgeBasedNodeDataContainer m_edge_based_node_container;
|
||||
util::DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
|
||||
|
||||
// The number of edge-based nodes is mostly made up out of the edges in the node-based graph.
|
||||
// Any edge in the node-based graph represents a node in the edge-based graph. In addition, we
|
||||
// add a set of artificial edge-based nodes into the mix to model via-way turn restrictions.
|
||||
// See https://github.com/Project-OSRM/osrm-backend/issues/2681#issuecomment-313080353 for
|
||||
// reference
|
||||
std::uint64_t m_number_of_edge_based_nodes;
|
||||
EdgeID m_max_edge_id;
|
||||
|
||||
const std::vector<util::Coordinate> &m_coordinates;
|
||||
const extractor::PackedOSMIDs &m_osm_node_ids;
|
||||
std::shared_ptr<util::NodeBasedDynamicGraph> m_node_based_graph;
|
||||
std::shared_ptr<RestrictionMap const> m_restriction_map;
|
||||
|
||||
const std::unordered_set<NodeID> &m_barrier_nodes;
|
||||
const std::unordered_set<NodeID> &m_traffic_lights;
|
||||
@@ -169,24 +152,14 @@ class EdgeBasedGraphFactory
|
||||
|
||||
unsigned RenumberEdges();
|
||||
|
||||
// During the generation of the edge-expanded nodes, we need to also generate duplicates that
|
||||
// represent state during via-way restrictions (see
|
||||
// https://github.com/Project-OSRM/osrm-backend/issues/2681#issuecomment-313080353). Access to
|
||||
// the information on what to duplicate and how is provided via the way_restriction_map
|
||||
std::vector<NBGToEBG> GenerateEdgeExpandedNodes(const WayRestrictionMap &way_restriction_map);
|
||||
std::vector<NBGToEBG> GenerateEdgeExpandedNodes();
|
||||
|
||||
// Edge-expanded edges are generate for all valid turns. The validity can be checked via the
|
||||
// restriction maps
|
||||
void GenerateEdgeExpandedEdges(ScriptingEnvironment &scripting_environment,
|
||||
const std::string &original_edge_data_filename,
|
||||
const std::string &turn_lane_data_filename,
|
||||
const std::string &turn_weight_penalties_filename,
|
||||
const std::string &turn_duration_penalties_filename,
|
||||
const std::string &turn_penalties_index_filename,
|
||||
const std::string &conditional_turn_penalties_filename,
|
||||
const RestrictionMap &node_restriction_map,
|
||||
const ConditionalRestrictionMap &conditional_restriction_map,
|
||||
const WayRestrictionMap &way_restriction_map);
|
||||
const std::string &turn_penalties_index_filename);
|
||||
|
||||
NBGToEBG InsertEdgeBasedNode(const NodeID u, const NodeID v);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EXTRACTION_CONTAINERS_HPP
|
||||
|
||||
#include "extractor/first_and_last_segment_of_way.hpp"
|
||||
#include "extractor/guidance/turn_lane_types.hpp"
|
||||
#include "extractor/internal_extractor_edge.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction.hpp"
|
||||
@@ -27,6 +28,7 @@ class ExtractionContainers
|
||||
void PrepareEdges(ScriptingEnvironment &scripting_environment);
|
||||
|
||||
void WriteNodes(storage::io::FileWriter &file_out) const;
|
||||
void WriteRestrictions(const std::string &restrictions_file_name);
|
||||
void WriteEdges(storage::io::FileWriter &file_out) const;
|
||||
void WriteCharData(const std::string &file_name);
|
||||
|
||||
@@ -34,37 +36,30 @@ class ExtractionContainers
|
||||
using NodeIDVector = std::vector<OSMNodeID>;
|
||||
using NodeVector = std::vector<QueryNode>;
|
||||
using EdgeVector = std::vector<InternalExtractorEdge>;
|
||||
using RestrictionsVector = std::vector<InputRestrictionContainer>;
|
||||
using WayIDStartEndVector = std::vector<FirstAndLastSegmentOfWay>;
|
||||
using NameCharData = std::vector<unsigned char>;
|
||||
using NameOffsets = std::vector<unsigned>;
|
||||
|
||||
std::vector<OSMNodeID> barrier_nodes;
|
||||
std::vector<OSMNodeID> traffic_signals;
|
||||
std::vector<OSMNodeID> traffic_lights;
|
||||
NodeIDVector used_node_id_list;
|
||||
NodeVector all_nodes_list;
|
||||
EdgeVector all_edges_list;
|
||||
NameCharData name_char_data;
|
||||
NameOffsets name_offsets;
|
||||
// an adjacency array containing all turn lane masks
|
||||
RestrictionsVector restrictions_list;
|
||||
WayIDStartEndVector way_start_end_id_list;
|
||||
|
||||
unsigned max_internal_node_id;
|
||||
|
||||
// list of restrictions before we transform them into the output types. Input containers
|
||||
// reference OSMNodeIDs. We can only transform them to the correct internal IDs after we've read
|
||||
// everything. Without a multi-parse approach, we have to remember the output restrictions
|
||||
// before converting them to the internal formats
|
||||
std::vector<InputConditionalTurnRestriction> restrictions_list;
|
||||
|
||||
// turn restrictions split into conditional and unconditional turn restrictions
|
||||
std::vector<ConditionalTurnRestriction> conditional_turn_restrictions;
|
||||
std::vector<TurnRestriction> unconditional_turn_restrictions;
|
||||
|
||||
ExtractionContainers();
|
||||
|
||||
void PrepareData(ScriptingEnvironment &scripting_environment,
|
||||
const std::string &osrm_path,
|
||||
const std::string &names_data_path);
|
||||
const std::string &output_file_name,
|
||||
const std::string &restrictions_file_name,
|
||||
const std::string &names_file_name);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,6 @@ struct ExtractionTurn
|
||||
{
|
||||
}
|
||||
|
||||
ExtractionTurn(const bool has_traffic_light = false)
|
||||
: angle(0), turn_type(guidance::TurnType::NoTurn),
|
||||
direction_modifier(guidance::DirectionModifier::Straight),
|
||||
has_traffic_light(has_traffic_light), weight(0.), duration(0.), source_restricted(false),
|
||||
target_restricted(false)
|
||||
{
|
||||
}
|
||||
|
||||
const double angle;
|
||||
const guidance::TurnType::Enum turn_type;
|
||||
const guidance::DirectionModifier::Enum direction_modifier;
|
||||
|
||||
@@ -56,9 +56,7 @@ class Extractor
|
||||
private:
|
||||
ExtractorConfig config;
|
||||
|
||||
std::tuple<guidance::LaneDescriptionMap,
|
||||
std::vector<TurnRestriction>,
|
||||
std::vector<ConditionalTurnRestriction>>
|
||||
std::tuple<guidance::LaneDescriptionMap, std::vector<TurnRestriction>>
|
||||
ParseOSMData(ScriptingEnvironment &scripting_environment, const unsigned number_of_threads);
|
||||
|
||||
std::pair<std::size_t, EdgeID>
|
||||
@@ -72,7 +70,6 @@ class Extractor
|
||||
util::DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
|
||||
const std::string &intersection_class_output_file,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
||||
guidance::LaneDescriptionMap &turn_lane_map);
|
||||
void FindComponents(unsigned max_edge_id,
|
||||
const util::DeallocatingVector<EdgeBasedEdge> &input_edge_list,
|
||||
@@ -88,14 +85,16 @@ class Extractor
|
||||
std::vector<util::Coordinate> &coordinates,
|
||||
extractor::PackedOSMIDs &osm_node_ids);
|
||||
|
||||
void WriteIntersectionClassificationData(
|
||||
const std::string &output_file_name,
|
||||
const std::vector<std::uint32_t> &node_based_intersection_classes,
|
||||
const std::vector<util::guidance::BearingClass> &bearing_classes,
|
||||
const std::vector<util::guidance::EntryClass> &entry_classes) const;
|
||||
|
||||
// Writes compressed node based graph and its embedding into a file for osrm-partition to use.
|
||||
static void WriteCompressedNodeBasedGraph(const std::string &path,
|
||||
const util::NodeBasedDynamicGraph &graph,
|
||||
const std::vector<util::Coordinate> &coordiantes);
|
||||
|
||||
void WriteConditionalRestrictions(
|
||||
const std::string &path,
|
||||
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ namespace extractor
|
||||
{
|
||||
|
||||
class ExtractionContainers;
|
||||
struct InputRestrictionContainer;
|
||||
struct ExtractionNode;
|
||||
struct ExtractionWay;
|
||||
struct ProfileProperties;
|
||||
struct InputConditionalTurnRestriction;
|
||||
|
||||
/**
|
||||
* This class is used by the extractor with the results of the
|
||||
@@ -83,7 +83,7 @@ class ExtractorCallbacks
|
||||
void ProcessNode(const osmium::Node ¤t_node, const ExtractionNode &result_node);
|
||||
|
||||
// warning: caller needs to take care of synchronization!
|
||||
void ProcessRestriction(const InputConditionalTurnRestriction &restriction);
|
||||
void ProcessRestriction(const boost::optional<InputRestrictionContainer> &restriction);
|
||||
|
||||
// warning: caller needs to take care of synchronization!
|
||||
void ProcessWay(const osmium::Way ¤t_way, const ExtractionWay &result_way);
|
||||
|
||||
@@ -33,57 +33,83 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "storage/io_config.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
struct ExtractorConfig final : storage::IOConfig
|
||||
struct ExtractorConfig
|
||||
{
|
||||
ExtractorConfig() noexcept : IOConfig(
|
||||
{
|
||||
"",
|
||||
},
|
||||
{},
|
||||
{".osrm",
|
||||
".osrm.restrictions",
|
||||
".osrm.names",
|
||||
".osrm.tls",
|
||||
".osrm.tld",
|
||||
".osrm.timestamp",
|
||||
".osrm.geometry",
|
||||
".osrm.nbg_nodes",
|
||||
".osrm.ebg_nodes",
|
||||
".osrm.edges",
|
||||
".osrm.ebg",
|
||||
".osrm.ramIndex",
|
||||
".osrm.fileIndex",
|
||||
".osrm.turn_duration_penalties",
|
||||
".osrm.turn_weight_penalties",
|
||||
".osrm.turn_penalties_index",
|
||||
".osrm.enw",
|
||||
".osrm.properties",
|
||||
".osrm.icd",
|
||||
".osrm.cnbg",
|
||||
".osrm.cnbg_to_ebg"}),
|
||||
requested_num_threads(0)
|
||||
ExtractorConfig() noexcept : requested_num_threads(0) {}
|
||||
void UseDefaultOutputNames()
|
||||
{
|
||||
}
|
||||
std::string basepath = input_path.string();
|
||||
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
{
|
||||
IOConfig::UseDefaultOutputNames(base);
|
||||
auto pos = std::string::npos;
|
||||
std::array<std::string, 5> known_extensions{
|
||||
{".osm.bz2", ".osm.pbf", ".osm.xml", ".pbf", ".osm"}};
|
||||
for (auto ext : known_extensions)
|
||||
{
|
||||
pos = basepath.find(ext);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
basepath.replace(pos, ext.size(), "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
output_file_name = basepath + ".osrm";
|
||||
restriction_file_name = basepath + ".osrm.restrictions";
|
||||
names_file_name = basepath + ".osrm.names";
|
||||
turn_lane_descriptions_file_name = basepath + ".osrm.tls";
|
||||
turn_lane_data_file_name = basepath + ".osrm.tld";
|
||||
timestamp_file_name = basepath + ".osrm.timestamp";
|
||||
geometry_output_path = basepath + ".osrm.geometry";
|
||||
node_based_nodes_data_path = basepath + ".osrm.nbg_nodes";
|
||||
edge_based_nodes_data_path = basepath + ".osrm.ebg_nodes";
|
||||
edge_output_path = basepath + ".osrm.edges";
|
||||
edge_graph_output_path = basepath + ".osrm.ebg";
|
||||
rtree_nodes_output_path = basepath + ".osrm.ramIndex";
|
||||
rtree_leafs_output_path = basepath + ".osrm.fileIndex";
|
||||
turn_duration_penalties_path = basepath + ".osrm.turn_duration_penalties";
|
||||
turn_weight_penalties_path = basepath + ".osrm.turn_weight_penalties";
|
||||
turn_penalties_index_path = basepath + ".osrm.turn_penalties_index";
|
||||
edge_based_node_weights_output_path = basepath + ".osrm.enw";
|
||||
profile_properties_output_path = basepath + ".osrm.properties";
|
||||
intersection_class_data_output_path = basepath + ".osrm.icd";
|
||||
compressed_node_based_graph_output_path = basepath + ".osrm.cnbg";
|
||||
cnbg_ebg_graph_mapping_output_path = basepath + ".osrm.cnbg_to_ebg";
|
||||
}
|
||||
|
||||
boost::filesystem::path input_path;
|
||||
boost::filesystem::path profile_path;
|
||||
|
||||
std::string output_file_name;
|
||||
std::string restriction_file_name;
|
||||
std::string names_file_name;
|
||||
std::string turn_lane_data_file_name;
|
||||
std::string turn_lane_descriptions_file_name;
|
||||
std::string timestamp_file_name;
|
||||
std::string geometry_output_path;
|
||||
std::string edge_output_path;
|
||||
std::string edge_graph_output_path;
|
||||
std::string node_based_nodes_data_path;
|
||||
std::string edge_based_nodes_data_path;
|
||||
std::string edge_based_node_weights_output_path;
|
||||
std::string rtree_nodes_output_path;
|
||||
std::string rtree_leafs_output_path;
|
||||
std::string profile_properties_output_path;
|
||||
std::string intersection_class_data_output_path;
|
||||
std::string turn_weight_penalties_path;
|
||||
std::string turn_duration_penalties_path;
|
||||
std::string compressed_node_based_graph_output_path;
|
||||
std::string cnbg_ebg_graph_mapping_output_path;
|
||||
|
||||
unsigned requested_num_threads;
|
||||
unsigned small_component_size;
|
||||
|
||||
bool generate_edge_lookup;
|
||||
std::string turn_penalties_index_path;
|
||||
|
||||
bool use_metadata;
|
||||
bool parse_conditionals;
|
||||
|
||||
@@ -225,7 +225,7 @@ inline void writeTurnData(const boost::filesystem::path &path, const TurnDataT &
|
||||
serialization::write(writer, turn_data);
|
||||
}
|
||||
|
||||
// reads .osrm.ebg_nodes
|
||||
// reads .osrm.nodes_data
|
||||
template <typename NodeDataT>
|
||||
inline void readNodeData(const boost::filesystem::path &path, NodeDataT &node_data)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ inline void readNodeData(const boost::filesystem::path &path, NodeDataT &node_da
|
||||
serialization::read(reader, node_data);
|
||||
}
|
||||
|
||||
// writes .osrm.ebg_nodes
|
||||
// writes .osrm.nodes_data
|
||||
template <typename NodeDataT>
|
||||
inline void writeNodeData(const boost::filesystem::path &path, const NodeDataT &node_data)
|
||||
{
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#ifndef GEOMETRY_COMPRESSOR_HPP
|
||||
#define GEOMETRY_COMPRESSOR_HPP
|
||||
|
||||
#include "extractor/scripting_environment.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "util/node_based_graph.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -16,7 +14,7 @@ namespace extractor
|
||||
{
|
||||
|
||||
class CompressedEdgeContainer;
|
||||
struct TurnRestriction;
|
||||
class RestrictionMap;
|
||||
|
||||
class GraphCompressor
|
||||
{
|
||||
@@ -25,9 +23,7 @@ class GraphCompressor
|
||||
public:
|
||||
void Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const std::unordered_set<NodeID> &traffic_lights,
|
||||
ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<ConditionalTurnRestriction> &conditional_turn_restrictions,
|
||||
RestrictionMap &restriction_map,
|
||||
util::NodeBasedDynamicGraph &graph,
|
||||
CompressedEdgeContainer &geometry_compressor);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "extractor/guidance/intersection.hpp"
|
||||
#include "extractor/guidance/intersection_normalization_operation.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction_index.hpp"
|
||||
#include "extractor/restriction_map.hpp"
|
||||
#include "util/attributes.hpp"
|
||||
#include "util/node_based_graph.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
@@ -116,6 +116,14 @@ class IntersectionGenerator
|
||||
|
||||
// own state, used to find the correct coordinates along a road
|
||||
const CoordinateExtractor coordinate_extractor;
|
||||
|
||||
// check turn restrictions to find a node that is the only allowed target when coming from a
|
||||
// node to an intersection
|
||||
// d
|
||||
// |
|
||||
// a - b - c and `only_straight_on ab | bc would return `c` for `a,b`
|
||||
boost::optional<NodeID> GetOnlyAllowedTurnIfExistent(const NodeID coming_from_node,
|
||||
const NodeID node_at_intersection) const;
|
||||
};
|
||||
|
||||
} // namespace guidance
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "extractor/guidance/turn_classification.hpp"
|
||||
#include "extractor/guidance/turn_handler.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction_index.hpp"
|
||||
#include "extractor/restriction_map.hpp"
|
||||
#include "extractor/suffix_table.hpp"
|
||||
|
||||
#include "util/attributes.hpp"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "extractor/guidance/intersection.hpp"
|
||||
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/guidance/bearing_class.hpp"
|
||||
#include "util/guidance/entry_class.hpp"
|
||||
|
||||
@@ -17,7 +16,7 @@ namespace guidance
|
||||
{
|
||||
|
||||
std::pair<util::guidance::EntryClass, util::guidance::BearingClass>
|
||||
classifyIntersection(Intersection intersection, const osrm::util::Coordinate &location);
|
||||
classifyIntersection(Intersection intersection);
|
||||
|
||||
} // namespace guidance
|
||||
} // namespace extractor
|
||||
|
||||
@@ -104,16 +104,6 @@ template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl
|
||||
util::inplacePermutation(classes.begin(), classes.end(), permutation);
|
||||
}
|
||||
|
||||
// all containers have the exact same size
|
||||
std::size_t Size() const
|
||||
{
|
||||
BOOST_ASSERT(geometry_ids.size() == name_ids.size());
|
||||
BOOST_ASSERT(geometry_ids.size() == component_ids.size());
|
||||
BOOST_ASSERT(geometry_ids.size() == travel_modes.size());
|
||||
BOOST_ASSERT(geometry_ids.size() == classes.size());
|
||||
return geometry_ids.size();
|
||||
}
|
||||
|
||||
private:
|
||||
Vector<GeometryID> geometry_ids;
|
||||
Vector<NameID> name_ids;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user