Compare commits

...

41 Commits

Author SHA1 Message Date
Daniel Patterson
49c4df0617
Bumps version to 5.9.2 2017-07-25 15:06:04 -07:00
Daniel Patterson
db869786a4
Update CHANGELOG. 2017-07-25 14:17:53 -07:00
Daniel Patterson
a3a46c20c4
Don't include turn costs when calculation weight/duration/speed annotations. 2017-07-25 14:16:48 -07:00
Daniel J. Hofmann
9500facd9c Bumps version to 5.9.1 2017-07-24 14:30:34 +02:00
Daniel J. Hofmann
615e015700 Merges Changelog entries into 5.9.1 section 2017-07-24 13:09:32 +02:00
Michael Krasnyk
02922ecf5e Don't use STXXL library by default 2017-07-24 13:08:41 +02:00
Daniel J. Hofmann
bae1b9c5e2 Documents system-wide limit constructor parameters in node bindings, resolves #4317 2017-07-24 13:04:20 +02:00
Emil Tin
4c35352707 fix profile debugging related to way classes 2017-07-24 13:02:10 +02:00
Daniel J. Hofmann
c362a3d46d Fixes line endings, related to #4235 2017-07-24 12:48:33 +02:00
Daniel J. Hofmann
293a7177d0 Updates changelog 2017-07-24 12:37:30 +02:00
Daniel J. Hofmann
8af54ffe83 Handles distinction of no-route vs invalid-route in mld alternatives
The viaroute plugin always expects a route to be there potentially
with invalid edge weight to represent no-route-found. By switching
to the many-route-result for the mld alternatives algorithm we might
return an empty many-route-result invalidating the post-condition.
2017-07-24 12:27:06 +02:00
Daniel J. Hofmann
253c2dc570 Trigger lane anticipation based on distance, see discussion in #4260 2017-07-22 17:30:48 +02:00
Moritz Kobitzsch
0c6bb534fd changelog, consistent deprecated documentation
Conflicts:
	CHANGELOG.md
2017-07-22 17:30:33 +02:00
Moritz Kobitzsch
2d02fad09b remove usage of use-lane completely 2017-07-22 17:28:44 +02:00
Moritz Kobitzsch
361e6b998f deprecate use-lane -- the information can be found in the intersections array 2017-07-22 17:28:36 +02:00
Patrick Niklaus
210fa9d545 Update changelog and version 2017-07-19 16:34:49 +00:00
Daniel J. Hofmann
7eafb48d20 Introduces a construction whitelist in profiles 2017-07-19 16:32:42 +00:00
Daniel J. Hofmann
df0f407591 Makes construction=minor ways routable again, see #4258 2017-07-19 16:27:31 +00:00
Patrick Niklaus
f9a8bcc75c Bump version to v5.9.0-rc.3 2017-07-18 16:50:51 +00:00
Patrick Niklaus
f815daf026 Update the changelog 2017-07-18 16:50:24 +00:00
Patrick Niklaus
f393f47d43 Move classes to intersection object and don't emit notifications 2017-07-18 16:48:59 +00:00
Daniel J. Hofmann
1e258ed3fa Changelog entry for openmp 2017-07-17 19:24:27 +02:00
Daniel J. Hofmann
de084f201c Only enables -fopenmp in case the user wants stxxl 2017-07-17 19:20:35 +02:00
Patrick Niklaus
e34a74d4ac Add changelog entry 2017-07-13 21:50:01 +00:00
Daniel J. Hofmann
bd1391f6f7 Exposes EngineConfig system-wide limits in Node.js bindings, resolves #4226 2017-07-13 21:49:27 +00:00
Patrick Niklaus
f54631619a Add bug fix to changelog 2017-07-13 09:01:08 +00:00
Moritz Kobitzsch
070fa1a24c only consider allowed entries when continuing on motorways 2017-07-13 09:00:00 +00:00
Moritz Kobitzsch
f15285e9ee add test indicating missdetection of continuing on motorways 2017-07-13 09:00:00 +00:00
Patrick Niklaus
bae21f0d5d Bump version to RC2 2017-07-12 22:13:56 +00:00
Daniel Patterson
305df1fb6e Include osrm-customize when doing 'make install' 2017-07-12 22:12:14 +00:00
Daniel J. Hofmann
9ab0fca31c Canonicalizes all OSM string list handling in the profiles 2017-07-12 22:09:28 +00:00
Michael Krasnyk
e2e398edc5 Remove STXXL from OSM parsing and enable in CMake by default 2017-07-11 08:24:29 +00:00
Michael Krasnyk
b87366132b Updated ChangeLog 2017-07-11 08:24:29 +00:00
Michael Krasnyk
f4ef4b022e Added STXXL configuration 2017-07-11 08:24:29 +00:00
Michael Krasnyk
81d479304e Don't use stxxl vector in contractor 2017-07-11 08:24:29 +00:00
Michael Krasnyk
92b53e5be0 Switch from stxxl::vector to std::vector in extractor 2017-07-11 08:24:29 +00:00
Michael Krasnyk
cc73e753bd Removed external_to_internal_node_id_map container 2017-07-11 08:24:28 +00:00
Daniel J. Hofmann
725dc396c7 Fixes Node.js bindings always enabling alternatives when using boolean overload 2017-07-10 10:45:56 +02:00
Daniel J. Hofmann
890f0d8d7e Discards construction and proposed ways, resolves #4230 2017-07-10 10:38:30 +02:00
Patrick Niklaus
c9017090a2 Bump verison to 5.9.0-rc.1 2017-07-07 17:07:52 +00:00
Patrick Niklaus
e7061591e3 Enable travis on 5.9 2017-07-07 17:06:47 +00:00
63 changed files with 1377 additions and 1145 deletions

View File

@ -19,6 +19,7 @@ branches:
- master
# enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
- "5.9"
cache:
yarn: true
@ -72,7 +73,7 @@ matrix:
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
after_success:
- bash <(curl -s https://codecov.io/bash)
@ -82,7 +83,7 @@ matrix:
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000
- os: linux
@ -90,7 +91,7 @@ matrix:
addons: &clang40
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
- os: linux
@ -115,7 +116,7 @@ matrix:
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: linux
@ -124,12 +125,20 @@ matrix:
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
- os: linux
compiler: "gcc-6-stxxl"
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' ENABLE_STXXL=On
- os: linux
compiler: "gcc-4.9-release"
addons: &gcc49
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
packages: ['g++-4.9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release'
- os: osx
@ -146,7 +155,7 @@ matrix:
#- addons: &clang40
#- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
# Shared Library
@ -155,7 +164,7 @@ matrix:
addons: &gcc6
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Disabled because CI slowness
@ -164,7 +173,7 @@ matrix:
#- addons: &clang40
#- apt:
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests.
@ -323,6 +332,7 @@ install:
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
-DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}

View File

@ -1,3 +1,13 @@
# 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
- 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:
- Algorithm:
@ -7,15 +17,22 @@
- API:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag.
- Support for exits numbers and names. New member `exits` in `RouteStep`, based on `junction:ref` on ways
- `RouteStep` now has new parameter `classes` that can be set in the profile on each way.
- `Intersection` now has new parameter `classes` that can be set in the profile on each way.
- Profiles:
- `result.exits` allows you to set a way's exit numbers and names, see [`junction:ref`](http://wiki.openstreetmap.org/wiki/Proposed_features/junction_details)
- `ExtractionWay` now as new property `forward_classes` and `backward_classes` that can set in the `way_function`.
The maximum number of classes is 8.
- We now respect the `construction` tag. If the `construction` tag value is not on our whitelist (`minor`, `widening`, `no`) we will exclude the road.
- Node.js Bindings:
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag
- Expose `EngineConfig` options in the node bindings
- Tools:
- Exposes engine limit on number of alternatives to generate `--max-alternatives` in `osrm-routed` (3 by default)
- Infrastructure
- STXXL is not required to build OSRM and is an optional dependency for back-compatibility (ENABLE_STXXL=On)
- OpenMP is only required when the optional STXXL dependency is used
- Bug fixes:
- #4278: Remove superflous continious instruction on a motorway.
# 5.8.0
- Changes from 5.7

View File

@ -21,6 +21,7 @@ option(BUILD_PACKAGE "Build OSRM package" OFF)
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
option(ENABLE_STXXL "Use STXXL library" OFF)
option(ENABLE_LTO "Use LTO if available" OFF)
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
@ -55,7 +56,7 @@ endif()
project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 9)
set(OSRM_VERSION_PATCH 0)
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}")
@ -428,9 +429,12 @@ if(ENABLE_MASON)
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
if (ENABLE_STXXL)
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
set(STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
add_definitions(-DUSE_STXXL_LIBRARY)
endif()
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
@ -493,8 +497,16 @@ else()
find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
find_package(STXXL REQUIRED)
if (ENABLE_STXXL)
find_package(STXXL)
if (STXXL_FOUND)
add_dependency_includes(${STXXL_INCLUDE_DIR})
set(MAYBE_STXXL_LIBRARY ${STXXL_LIBRARY})
add_definitions(-DUSE_STXXL_LIBRARY)
else()
MESSAGE(STATUS "STXXL was requested but not found, default STL will be used")
endif()
endif()
find_package(BZip2 REQUIRED)
add_dependency_includes(${BZIP2_INCLUDE_DIR})
@ -578,11 +590,13 @@ add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
set(OpenMP_FIND_QUIETLY ON)
find_package(OpenMP)
if(OPENMP_FOUND)
if (ENABLE_STXXL)
set(OpenMP_FIND_QUIETLY ON)
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "OpenMP support found. Linking just in case for stxxl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()
add_definitions(${OSRM_DEFINES})
@ -617,7 +631,7 @@ set(EXTRACTOR_LIBRARIES
${EXPAT_LIBRARIES}
${USED_LUA_LIBRARIES}
${OSMIUM_LIBRARIES}
${STXXL_LIBRARY}
${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES}
${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
@ -645,7 +659,7 @@ set(CONTRACTOR_LIBRARIES
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES}
${STXXL_LIBRARY}
${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
@ -665,7 +679,7 @@ set(STORAGE_LIBRARIES
set(UTIL_LIBRARIES
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${STXXL_LIBRARY}
${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES})
@ -734,12 +748,14 @@ install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
install(FILES ${VariantGlob} DESTINATION include/mapbox)
install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-partition DESTINATION bin)
install(TARGETS osrm-customize DESTINATION bin)
install(TARGETS osrm-contract DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin)
install(TARGETS osrm DESTINATION lib)
install(TARGETS osrm_extract DESTINATION lib)
install(TARGETS osrm_partition DESTINATION lib)
install(TARGETS osrm_customize DESTINATION lib)
install(TARGETS osrm_update DESTINATION lib)
install(TARGETS osrm_contract DESTINATION lib)
install(TARGETS osrm_store DESTINATION lib)

View File

@ -539,10 +539,10 @@ Annotation of the whole route leg with fine-grained information about each segme
**Properties**
- `distance`: The distance, in metres, between each pair of coordinates
- `duration`: The duration between each pair of coordinates, in seconds
- `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns.
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract`
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
- `weight`: The weights between each pair of coordinates
- `weight`: The weights between each pair of coordinates. Does not include any turn costs.
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
#### Example
@ -583,7 +583,6 @@ step.
- `destinations`: The destinations of the way. Will be `undefined` if there are no destinations.
- `exits`: The exit numbers or names of the way. Will be `undefined` if there are no exit numbers or names.
- `mode`: A string signifying the mode of transportation.
- `classes`: An array of strings signifying the classes of the road as specified in the profile.
- `maneuver`: A `StepManeuver` object representing the maneuver.
- `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver
- `rotary_name`: The name for the rotary. Optionally included, if the step is a rotary and a rotary name is available.
@ -597,7 +596,6 @@ step.
"mode" : "driving",
"duration" : 15.6,
"weight" : 15.6,
"classes": ["toll", "restricted"],
"intersections" : [
{ "bearings" : [ 10, 92, 184, 270 ],
"lanes" : [
@ -657,7 +655,7 @@ step.
| `off ramp` | take a ramp to exit a highway (direction given my `modifier`) |
| `fork` | take the left/right side at a fork depending on `modifier` |
| `end of road` | road ends in a T intersection turn in direction of `modifier`|
| `use lane` | going straight on a specific lane |
| `use lane` | **Deprecated** replaced by lanes on all intersection entries |
| `continue` | Turn in direction of `modifier` to stay on the same road |
| `roundabout` | traverse roundabout, has additional property `exit` with NR if the roundabout is left. The modifier specifies the direction of entering the roundabout. |
| `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
@ -735,6 +733,7 @@ location of the StepManeuver. Further intersections are listed for every cross-w
- `location`: A `[longitude, latitude]` pair describing the location of the turn.
- `bearings`: A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection. Values are between 0-359 (0=true north)
- `classes`: An array of strings signifying the classes (as specified in the profile) of the road exiting the intersection.
- `entry`: A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route.
`false` indicates that the turn onto the respective road would violate a restriction.
- `in`: index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the
@ -753,6 +752,7 @@ location of the StepManeuver. Further intersections are listed for every cross-w
"out":2,
"bearings":[60,150,240,330],
"entry":["false","true","true","true"],
"classes": ["toll", "restricted"],
"lanes":{
"indications": ["left", "straight"],
"valid": "false"

View File

@ -26,6 +26,12 @@ var osrm = new OSRM('network.osrm');
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
- `options.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 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_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 alternative routes supported (default: 3).
### route

View File

@ -18,12 +18,12 @@ Feature: Car - Mode flag
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,notification right,notification left,arrive | ,ferry,, |
| d | a | cd,bc,ab,ab | depart,notification right,notification left,arrive | ,ferry,, |
| c | a | bc,ab,ab | depart,notification left,arrive | ferry,, |
| d | b | cd,bc,bc | depart,notification right,arrive | ,ferry,ferry |
| a | c | ab,bc,bc | depart,notification right,arrive | ,ferry,ferry |
| b | d | bc,cd,cd | depart,notification left,arrive | ferry,, |
| a | d | ab,bc,cd,cd | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| d | a | cd,bc,ab,ab | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| c | a | bc,ab,ab | depart,notification left,arrive | [(ferry)],[()],[()] |
| d | b | cd,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| a | c | ab,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| b | d | bc,cd,cd | depart,notification left,arrive | [(ferry)],[()],[()] |
Scenario: Car - We tag motorways with a class
@ -40,10 +40,10 @@ Feature: Car - Mode flag
| cd | primary |
When I route I should get
| from | to | route | turns | classes | # |
| a | d | ab,bc,cd | depart,notification right,arrive | ,motorway, | |
| a | c | ab,bc,bc | depart,notification right,arrive | ,motorway,motorway | |
| b | d | bc,cd | depart,arrive | motorway, | we don't announce when we leave the highway |
| from | to | route | turns | classes |
| a | d | ab,cd | depart,arrive | [(),(motorway),()],[()] |
| a | c | ab,bc | depart,arrive | [(),(motorway)],[()] |
| b | d | bc,cd | depart,arrive | [(motorway),()],[()] |
Scenario: Car - We tag motorway_link with a class
Given the node map
@ -60,9 +60,9 @@ Feature: Car - Mode flag
When I route I should get
| from | to | route | turns | classes | # |
| a | d | ab,bc,cd | depart,on ramp right,arrive | ,motorway, | notification replaced by on-ramp |
| a | c | ab,bc,bc | depart,on ramp right,arrive | ,motorway,motorway | " " |
| b | d | bc,cd | depart,arrive | motorway, | no announcement |
| a | d | ab,bc,cd | depart,on ramp right,arrive | [()],[(motorway),()],[()] | on-ramp at class change |
| a | c | ab,bc,bc | depart,on ramp right,arrive | [()],[(motorway)],[()] | " " |
| b | d | bc,cd | depart,arrive | [(motorway),()],[()] | no announcement |
Scenario: Car - We tag restricted with a class
@ -80,7 +80,7 @@ Feature: Car - Mode flag
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd | depart,notification right,arrive| restricted,motorway;restricted, |
| a | d | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] |
Scenario: Car - We toll restricted with a class
Given the node map
@ -97,5 +97,31 @@ Feature: Car - Mode flag
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd | depart,notification right,arrive | toll,motorway;toll, |
| a | d | ab,cd | depart,arrive | [(toll),(motorway,toll),()],[()] |
Scenario: Car - From roundabout on toll road
Given the node map
"""
c
/ \
a---b d---f
\ /
e
|
g
"""
And the ways
| nodes | oneway | highway | junction | toll |
| ab | yes | primary | | |
| cb | yes | primary | roundabout | |
| dc | yes | primary | roundabout | |
| be | yes | primary | roundabout | |
| ed | yes | motorway| roundabout | |
| eg | yes | primary | | |
| df | yes | motorway| | yes |
When I route I should get
| from | to | route | turns | classes |
| a | f | ab,df,df | depart,roundabout-exit-2,arrive | [()],[(),(motorway),(toll,motorway)],[()] |

View File

@ -0,0 +1,17 @@
@routing @car @construction
Feature: Car - all construction tags the OpenStreetMap community could think of and then some
Background:
Given the profile "car"
Scenario: Various ways to tag construction and proposed roads
Then routability should be
| highway | construction | proposed | bothw |
| primary | | | x |
| construction | | | |
| proposed | | | |
| primary | yes | | |
| primary | | yes | |
| primary | no | | x |
| primary | widening | | x |
| primary | minor | | x |

View File

@ -23,11 +23,11 @@ Feature: Car - Destination only, no passing through
When I route I should get
| from | to | route |
| a | b | ab,ab |
| a | c | ab,bcd,bcd |
| a | c | ab,bcd |
| a | d | ab,bcd,bcd |
| a | e | axye,axye |
| e | d | de,de |
| e | c | de,bcd,bcd |
| e | c | de,bcd |
| e | b | de,bcd,bcd |
| e | a | axye,axye |
@ -51,12 +51,12 @@ Feature: Car - Destination only, no passing through
When I route I should get
| from | to | route |
| a | b | ab,ab |
| a | c | ab,bc,bc |
| a | d | ab,bc,cd |
| a | c | ab,bc |
| a | d | ab,cd |
| a | e | axye,axye |
| e | d | de,de |
| e | c | de,cd,cd |
| e | b | de,cd,bc |
| e | c | de,cd |
| e | b | de,bc |
| e | a | axye,axye |
Scenario: Car - Routing inside a destination only area

View File

@ -36,9 +36,9 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true, |
| a,f | in,cross,cross | depart,continue right,arrive | ,, |
| a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true, |
| a,f | in,cross,cross | depart,continue right,arrive | ,;right:true, |
@sliproads
Scenario: Separate Turn Lanes
@ -69,9 +69,9 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
| a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true;left:false straight:false right:true, |
@sliproads
@ -110,9 +110,9 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,e | in,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true, |
| a,e | in,cross,cross | depart,turn left,arrive | ;,left:true straight:false right:false, |
| a,g | in,straight,straight | depart,new name straight,arrive | ;,left:false straight:true right:false, |
| a,f | in,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true;left:false straight:false right:true, |
| a,j | in,turn,other,other | depart,turn right,turn left,arrive | ,,left:true right:false, |
| a,i | in,turn,other,other | depart,turn right,turn right,arrive | ,,left:false right:true, |

View File

@ -3,7 +3,7 @@ Feature: Turn Lane Guidance
Background:
Given the profile "car"
Given a grid size of 20 meters
Given a grid size of 100 meters
@anticipate
Scenario: Anticipate Lane Change for subsequent multi-lane intersections
@ -152,8 +152,8 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,i | ab,ci,ci | depart,turn slight right,arrive | ,none:false slight right:true, |
| a,j | ab,xbcj | depart,arrive | , |
| a,i | ab,ci,ci | depart,turn slight right,arrive | ;,none:false slight right:true, |
| a,j | ab,xbcj | depart,arrive | ;;none:true slight right:false, |
@anticipate
@ -308,8 +308,8 @@ Feature: Turn Lane Guidance
| di | | off | | yes |
When I route I should get
| waypoints | route | turns | destinations | lanes | locations |
| a,e | main,main,main | depart,use lane straight,arrive | One,Two,Three | ,left:false straight:false straight:true straight:false right:false, | a,c,e |
| waypoints | route | turns | destinations | locations | lanes |
| a,e | main,main | depart,arrive | One,Three | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, |
@anticipate
Scenario: Anticipate Lanes for through and collapse multiple use lanes
@ -336,8 +336,8 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,c | main,main | depart,arrive | , |
| a,d | main,main | depart,arrive | , |
| a,c | main,main | depart,arrive | ;left:false straight:true straight:true right:false, |
| a,d | main,main | depart,arrive | ;left:false straight:true straight:true right:false;left:false straight:true straight:true right:false, |
@anticipate
Scenario: Anticipate Lanes for through followed by left/right
@ -364,15 +364,15 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | main,main,main,left,left | depart,use lane straight,use lane straight,turn left,arrive | ,left:false straight:false straight:true straight:false straight:false right:false,left:false straight:true straight:false right:false,left:true right:false, |
| a,e | main,main,main,right,right | depart,use lane straight,use lane straight,turn right,arrive | ,left:false straight:false straight:false straight:true straight:false right:false,left:false straight:false straight:true right:false,left:false right:true, |
| a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:false straight:true straight:false straight:false right:false;left:false straight:true straight:false right:false,left:true right:false, |
| a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:false straight:false straight:true straight:false right:false;left:false straight:false straight:true right:false,left:false right:true, |
@anticipate
Scenario: Anticipate Lanes for through with turn before / after
Given the node map
"""
c g l
b d e h - i
b d e h i
a f j
"""
@ -393,12 +393,12 @@ Feature: Turn Lane Guidance
| waypoints | route | turns | lanes | # |
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| a,j | ab,bdehi,bdehi,ij,ij | depart,turn right,use lane straight,turn right,arrive | ,right:true right:true right:false right:false,left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
| a,l | ab,bdehi,bdehi,il,il | depart,turn right,use lane straight,turn left,arrive | ,right:false right:false right:true right:true,left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
| a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:false right:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
| a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:false right:false right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| c,l | cb,bdehi,bdehi,il,il | depart,turn left,use lane straight,turn left,arrive | ,left:false left:false left:true left:true,left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
| c,j | cb,bdehi,bdehi,ij,ij | depart,turn left,use lane straight,turn right,arrive | ,left:true left:true left:false left:false,left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
| c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:false left:false left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
| c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:false left:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
@anticipate
Scenario: Anticipate Lanes for turns with through before and after
@ -432,10 +432,10 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,i | top,main,main,top,top | depart,turn right,use lane straight,turn left,arrive | ,straight:false right:false right:true right:true,left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| a,k | top,main,main,bot,bot | depart,turn right,use lane straight,turn right,arrive | ,straight:false right:true right:true right:false,left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
| c,i | bot,main,main,top,top | depart,turn left,use lane straight,turn left,arrive | ,left:false left:true left:true straight:false,left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| c,k | bot,main,main,bot,bot | depart,turn left,use lane straight,turn right,arrive | ,left:true left:true left:false straight:false,left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
| a,i | top,main,top,top | depart,turn right,turn left,arrive | ,straight:false right:true right:true right:true;;left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| a,k | top,main,bot,bot | depart,turn right,turn right,arrive | ,straight:false right:true right:true right:true;;left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
| c,i | bot,main,top,top | depart,turn left,turn left,arrive | ,left:true left:true left:true straight:false;;left:false straight:true straight:true straight:false straight:false right:false,left:true left:true right:false right:false, |
| c,k | bot,main,bot,bot | depart,turn left,turn right,arrive | ,left:true left:true left:true straight:false;;left:false straight:false straight:false straight:true straight:true right:false,left:false left:false right:true right:true, |
@anticipate
Scenario: Anticipate Lanes for turn between throughs
@ -463,7 +463,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,e | main,main,main,main | depart,use lane straight,continue right,arrive | ,left:false straight:false straight:false straight:false straight:true straight:true right:false,straight:false straight:false right:false right:true right:true, |
| a,e | main,main,main | depart,continue right,arrive | ;left:false straight:false straight:false straight:false straight:true straight:true right:false,straight:false straight:false right:false right:true right:true;left:false straight:true straight:true, |
@anticipate @todo @2661
Scenario: Anticipate with lanes in roundabout: roundabouts as the unit of anticipation
@ -520,8 +520,8 @@ Feature: Turn Lane Guidance
| df | | primary | |
When I route I should get
| waypoints | route | turns | lanes |
| a,f | ab,df,df | depart,roundabout-exit-1,use lane slight right,arrive | ,,slight left:false slight left:false slight right:true, |
| waypoints | route | turns | lanes | intersection_lanes |
| a,f | ab,df,df | depart,roundabout-exit-1,arrive | ,, | |
@anticipate
Scenario: No Lanes for Roundabouts, see #2626
@ -554,7 +554,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,h | ab,gh,gh | depart,roundabout-exit-5,arrive | ,, |
| a,h | ab,gh,gh | depart,roundabout-exit-5,arrive | ,;;;;;, |
@anticipate
Scenario: No Lanes for Roundabouts, see #2626
@ -576,9 +576,9 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,, |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,;, |
| x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,;, |
@anticipate
Scenario: No Lanes for Roundabouts, see #2626
@ -615,7 +615,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,h | ab,ch,ch | depart,roundabout-exit-5,arrive | ,, |
| a,h | ab,ch,ch | depart,roundabout-exit-5,arrive | ,;;;;;, |
@anticipate
Scenario: No Lanes for Roundabouts, see #2626
@ -627,36 +627,7 @@ Feature: Turn Lane Guidance
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
|
|
|
|
|
|
|
|
\ /
c
"""
@ -671,9 +642,9 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,, |
| x,y | xb,dy,dy | depart,roundabout-exit-1,arrive | ,;, |
| x,c | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,, |
| x,a | xb,roundabout,roundabout | depart,roundabout-exit-undefined,arrive | ,;, |
@anticipate @todo @2032
Scenario: No Lanes for Roundabouts, see #2626
@ -789,13 +760,6 @@ Feature: Turn Lane Guidance
Given the node map
"""
a b x
|
|
|
|
|
|
|
|
|
|
@ -824,9 +788,7 @@ Feature: Turn Lane Guidance
Given the node map
"""
q r s t u v
| | | | | |
a - - - - - - - - - - b - - - - - - - - - - c - - - - - - - - - - d - - - - - - - - - - e - - - - - - - - - - f - - - - - - - - - - g - h - i
| | | | | | |
a - - b - - c - - d - - e - - f - g - h - i
p o n m l k j
"""
@ -850,5 +812,5 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | locations | lanes |
| a,i | road,road,road | depart,use lane straight,arrive | a,g,i | ,left:false none:true none:true none:false, |
| a,j | road,road,7th,7th | depart,use lane straight,turn right,arrive | a,f,h,j | ,left:false none:false none:false none:true,none:false none:false right:true, |
| 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, |

View File

@ -807,8 +807,8 @@ Feature: Collapse
| di | | off |
When I route I should get
| waypoints | route | turns | locations |
| a,e | main,main,main | depart,use lane straight,arrive | a,c,e |
| waypoints | route | turns | locations | lanes |
| a,e | main,main | depart,arrive | a,e | ;left:false straight:false straight:true straight:false right:false;left:false straight:true right:false, |
Scenario: But _do_ collapse UseLane step when lanes stay the same
Given the node map

View File

@ -42,7 +42,7 @@ Feature: Exit Numbers and Names
When I route I should get
| waypoints | route | turns | exits |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10;12, |
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10; 12, |
Scenario: Exit number on the ways after the motorway junction, multiple exits

View File

@ -261,3 +261,23 @@ Feature: Motorway Guidance
When I route I should get
| waypoints | route | turns |
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive |
#http://0.0.0.0:9966/?z=18&center=38.893323%2C-77.055117&loc=38.893551%2C-77.054833&loc=38.893112%2C-77.055536&hl=en&alt=0
Scenario: Merging with same name
Given the node map
"""
a - - -
> c - d
b
"""
And the ways
| nodes | name | ref | highway | oneway |
| ac | | US 50 | motorway | yes |
| bc | | I 66 | motorway | yes |
| cd | | US 50; I 66 | motorway | yes |
When I route I should get
| waypoints | route | turns |
| a,d | , | depart,arrive |
| b,d | , | depart,arrive |

View File

@ -606,11 +606,11 @@ Feature: Basic Roundabout
| ob | trunk | yes | roundabout | Europaplatz | |
When I route I should get
| waypoints | route | turns | lanes |
| a,d | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-1,arrive | ,, |
| a,h | ,Allee Cite,Allee Cite | depart,Europaplatz-exit-2,arrive | ,, |
| a,l | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-3,arrive | ,, |
| a,p | ,, | depart,Europaplatz-exit-4,arrive | ,, |
| waypoints | route | turns |
| a,d | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-1,arrive |
| a,h | ,Allee Cite,Allee Cite | depart,Europaplatz-exit-2,arrive |
| a,l | ,Europastrasse,Europastrasse | depart,Europaplatz-exit-3,arrive |
| a,p | ,, | depart,Europaplatz-exit-4,arrive |
@turboroundabout
# http://www.openstreetmap.org/?mlat=50.180039&mlon=8.474939&zoom=16#map=19/50.17999/8.47506
@ -658,14 +658,14 @@ Feature: Basic Roundabout
| wb | primary | yes | roundabout | | through\|through;right |
When I route I should get
| waypoints | route | turns | lanes |
| a,w | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-undefined,arrive | ,, |
| a,r | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-4,arrive | ,, |
| a,f | Le-Cannet-Rocheville-Strasse,Frankfurter Strasse,Frankfurter Strasse | depart,roundabout-exit-1,arrive | ,, |
| a,h | Le-Cannet-Rocheville-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-2,arrive | ,, |
| u,r | ,, | depart,roundabout-exit-5,arrive | ,, |
| j,h | Bischof-Kaller-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-5,arrive | ,, |
| n,m | , | depart,arrive | , |
| waypoints | route | turns |
| a,w | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-undefined,arrive |
| a,r | Le-Cannet-Rocheville-Strasse,, | depart,roundabout-exit-4,arrive |
| a,f | Le-Cannet-Rocheville-Strasse,Frankfurter Strasse,Frankfurter Strasse | depart,roundabout-exit-1,arrive |
| a,h | Le-Cannet-Rocheville-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-2,arrive |
| u,r | ,, | depart,roundabout-exit-5,arrive |
| j,h | Bischof-Kaller-Strasse,Bischof-Kaller-Strasse,Bischof-Kaller-Strasse | depart,roundabout-exit-5,arrive |
| n,m | , | depart,arrive |
@turboroundabout
# http://www.openstreetmap.org/?mlat=47.57723&mlon=7.796765&zoom=16#map=19/47.57720/7.79711

View File

@ -156,7 +156,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, |
| a,c | road,road | depart,arrive | , |
| a,c | road,road | depart,arrive | ;straight:true right:false, |
Scenario: Turn with Bus-Lane Left
Given the node map
@ -178,7 +178,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, |
| a,c | road,road | depart,arrive | , |
| a,c | road,road | depart,arrive | ;left:false straight:true, |
# This tests whether empty/invalid PSV tags cause osrm-extract to crash
Scenario: Turn with Bus-Lane
@ -248,23 +248,23 @@ Feature: Turn Lane Guidance
| fl | cross | | yes |
When I route I should get
| waypoints | route | turns | lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true |
| a,d | road,road,road | depart,use lane straight,arrive | ,left:false straight:true right:false, |
| a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, |
| a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, |
| k,l | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight;right:true, |
| k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, |
| k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, |
| e,h | road,road | depart,arrive | ,none:false straight:true straight;right:true |
| e,j | road,cross,cross | depart,turn left,arrive | ,none:true straight:false straight;right:false, |
| e,d | road,road,road | depart,continue uturn,arrive | ,none:true straight:false straight;right:false, |
| i,h | cross,road,road | depart,turn right,arrive | ,, |
| i,j | cross,cross,cross | depart,use lane straight,arrive | ,left:false straight:true, |
| i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, |
| waypoints | route | turns | lanes | intersection_lanes |
| a,j | road,cross,cross | depart,turn right,arrive | ,left:false straight:false right:true | ,left:false straight:false right:true |
| a,d | road,road | depart,arrive | , | left:false straight:true right:false, |
| a,l | road,cross,cross | depart,turn left,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false, |
| a,h | road,road,road | depart,continue uturn,arrive | ,left:true straight:false right:false, | ,left:true straight:false right:false |
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, | ,left:false straight;right:true, |
| k,l | cross,cross | depart,arrive | , | left:false straight;right:true, |
| k,h | cross,road,road | depart,turn left,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, |
| k,j | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight;right:false, | ,left:true straight;right:false, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, | ,none:false straight:false straight;right:true, |
| e,h | road,road | depart,arrive | , | none:false straight:true straight;right:true, |
| e,j | road,cross,cross | depart,turn left,arrive | ,none:true straight:false straight;right:false, | ,none:true straight:false straight;right:false, |
| e,d | road,road,road | depart,continue uturn,arrive | ,none:true straight:false straight;right:false, | ,none:true straight:false straight;right:false, |
| i,h | cross,road,road | depart,turn right,arrive | ,, | |
| i,j | cross,cross | depart,arrive | | left:false straight:true, |
| i,d | cross,road,road | depart,turn left,arrive | ,left:true straight:false, | ,left:true straight:false, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, | ,left:true straight:false, |
#copy of former case to prevent further regression
@collapse @partition-lanes
@ -300,8 +300,8 @@ Feature: Turn Lane Guidance
| k,d | cross,road,road | depart,turn right,arrive | ,left:false straight;right:true, |
| e,l | road,cross,cross | depart,turn right,arrive | ,none:false straight:false straight;right:true, |
| i,h | cross,road,road | depart,turn right,arrive | ,, |
| i,j | cross,cross | depart,arrive | , |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ,left:true straight:false, |
| i,j | cross,cross | depart,arrive | ;;left:false straight:true, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | ;,left:true straight:false;left:true straight:false;left:false straight:true, |
@partition-lanes
Scenario: Turn Lanes at Segregated Road
@ -347,7 +347,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,e | road,turn,turn | depart,turn right,arrive | ,none:false right:true, |
| a,d | road,road | depart,arrive | , |
| a,d | road,road | depart,arrive | ;none:true right:false, |
@2654 @previous-lanes
Scenario: Turn Lanes Given earlier than actual turn
@ -369,10 +369,10 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,k | road,second-turn,second-turn | depart,turn right,arrive | ,none:false right:true, |
| a,i | road,road | depart,arrive | , |
| i,j | road,first-turn,first-turn | depart,turn left,arrive | ,left:true none:false, |
| i,a | road,road | depart,arrive | , |
| a,k | road,second-turn,second-turn | depart,turn right,arrive | ;,none:false right:true, |
| a,i | road,road | depart,arrive | ;;none:true right:false, |
| i,j | road,first-turn,first-turn | depart,turn left,arrive | ;,left:true none:false, |
| i,a | road,road | depart,arrive | ;;left:false none:true, |
@previous-lanes
Scenario: Passing a one-way street
@ -391,7 +391,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight:false, |
| a,f | road,turn,turn | depart,turn left,arrive | ;left:true straight:false,left:true straight:false, |
@partition-lanes
Scenario: Passing a one-way street, partly pulled back lanes
@ -412,8 +412,8 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true straight;right:false, |
| a,d | road,road | depart,arrive | , |
| a,f | road,turn,turn | depart,turn left,arrive | ;left:true straight;right:false,left:true straight;right:false, |
| a,d | road,road | depart,arrive | ;left:false straight;right:true;left:false straight;right:true, |
| a,g | road,right,right | depart,turn right,arrive | ,left:false straight;right:true, |
@partition-lanes @previous-lanes
@ -435,7 +435,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true right:false, |
| a,f | road,turn,turn | depart,turn left,arrive | ,left:true right:false;left:true right:false, |
| a,g | road,right,right | depart,turn right,arrive | ,left:false right:true, |
@todo @partition-lanes @previous-lanes
@ -484,7 +484,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | road,road | depart,arrive | , |
| a,d | road,road | depart,arrive | ;straight:true right:false, |
| a,e | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, |
@todo @roundabout
@ -555,8 +555,8 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,g | road,cross,cross | depart,turn left,arrive | ,left:true left:true straight:false straight:false right:false, |
| a,e | road,road | depart,arrive | , |
| a,g | road,cross,cross | depart,turn left,arrive | ,left:true left:true straight:false straight:false right:false;left:true left:true straight:false straight:false right:false, |
| a,e | road,road | depart,arrive | ;left:false left:false straight:true straight:true right:false;left:false left:false straight:true straight:true right:false, |
#NEEDS TO BE INVESTIGATED. Turn restriction shouldn't be here. See #2867
@reverse @previous-lanes
@ -590,10 +590,10 @@ Feature: Turn Lane Guidance
When I route I should get
| from | to | bearings | route | turns | lanes |
| a | g | 180,180 180,180 | road,cross,cross | depart,turn right,arrive | ,none:false straight:false right:true, |
| a | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ,none:true straight:false right:false, |
| a | i | 180,180 180,180 | road,road | depart,arrive | , |
| b | a | 90,2 270,2 | road,road,road | depart,continue uturn,arrive | ,none:true straight:false right:false, |
| a | g | 180,180 180,180 | road,cross,cross | depart,turn right,arrive | ;none:false straight:false right:true,none:false straight:false right:true, |
| a | h | 180,180 180,180 | road,cross,cross | depart,turn left,arrive | ;none:true straight:false right:false,none:true straight:false right:false;, |
| a | i | 180,180 180,180 | road,road | depart,arrive | ;none:true straight:true right:false;none:true straight:true right:false, |
| b | a | 90,2 270,2 | road,road,road | depart,continue uturn,arrive | ,none:true straight:false right:false;, |
@reverse
Scenario: Segregated Intersection Merges With Lanes
@ -681,7 +681,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | road,road | depart,arrive | , |
| a,d | road,road | depart,arrive | ;straight:true straight:true straight;slight right:true slight right:false, |
| a,e | road,cross,cross | depart,turn slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, |
@ramp
@ -700,7 +700,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | hwy,hwy | depart,arrive | , |
| a,d | hwy,hwy | depart,arrive | ;straight:true straight:true straight;slight right:true slight right:false, |
| a,e | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false straight;slight right:true slight right:true, |
@todo
@ -745,7 +745,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,c | hwy,hwy | depart,arrive | , |
| a,c | hwy,hwy | depart,arrive | ;straight:true straight:true slight right:false, |
| a,d | hwy,ramp,ramp | depart,off ramp slight right,arrive | ,straight:false straight:false slight right:true, |
@reverse
@ -767,7 +767,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false straight:false,|
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false straight:false;,|
@reverse
Scenario: Reverse Lane in Segregated Road with none
@ -788,7 +788,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false, |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false;, |
@reverse
Scenario: Reverse Lane in Segregated Road with none, Service Turn Prior
@ -811,7 +811,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false, |
| a,h | road,road,road | depart,continue uturn,arrive | ,uturn:true straight:false none:false;, |
@simple
Scenario: Don't collapse everything to u-turn / too wide
@ -874,8 +874,8 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,j | on,xbcj | depart,arrive | , |
| a,i | on,off,off | depart,turn right,arrive | ,none:false slight right:true, |
| a,j | on,xbcj | depart,arrive | ;;none:true slight right:false, |
| a,i | on,off,off | depart,turn right,arrive | ;,none:false slight right:true, |
#http://www.openstreetmap.org/#map=17/52.47414/13.35712
@todo @ramp @2645
@ -930,7 +930,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| x,d | road,road | depart,arrive | , |
| x,d | road,road | depart,arrive | ;straight;right:true;straight;right:true, |
@partition-lanes
Scenario: Partitioned turn, Slight Curve - maxspeed
@ -954,7 +954,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes | locations |
| a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g |
| a,e | road,cross,cross | depart,end of road left,arrive | ,left:true right:false, | a,c,e |
| a,e | road,cross,cross | depart,end of road left,arrive | ;left:true right:false,left:true right:false, | a,c,e |
Scenario: Partitioned turn, Slight Curve
Given the node map
@ -977,7 +977,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes | locations |
| a,g | road,cross,cross | depart,turn right,arrive | ,left:false right:true, | a,b,g |
| a,e | road,cross,cross | depart,end of road left,arrive | ,left:true right:false, | a,c,e |
| a,e | road,cross,cross | depart,end of road left,arrive | ;left:true right:false,left:true right:false, | a,c,e |
Scenario: Lane Parsing Issue #2694
Given the node map
@ -1193,7 +1193,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,e | road,cross,cross | depart,turn right,arrive | ,left:false none:false none:true, |
| a,c | road,road | depart,arrive | , |
| a,c | road,road | depart,arrive | ;left:false none:true none:true, |
@3379
Scenario: Don't Turn through potential through lanes
@ -1214,7 +1214,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | road,cross,cross | depart,turn left,arrive | ,none:true none:false right:false, |
| a,c | road,road | depart,arrive | , |
| a,c | road,road | depart,arrive | ;none:true none:true right:false, |
@4189
Scenario: U-turn after a traffic light
@ -1243,4 +1243,4 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes | locations |
| a,f | road1,road1,road1 | depart,continue uturn,arrive | ,left:true straight:false straight;right:false, | a,d,f |
| a,f | road1,road1,road1 | depart,continue uturn,arrive | ;left:false straight:true straight;right:false,left:true straight:false straight;right:false;;, | a,d,f |

View File

@ -171,6 +171,24 @@ module.exports = function () {
('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0));
};
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, s => {
return s.intersections.map( i => {
if(i.lanes)
{
return i.lanes.map( l => {
let indications = l.indications.join(';');
return indications + ':' + (l.valid ? 'true' : 'false');
}).join(' ');
}
else
{
return '';
}
}).join(';');
});
};
this.approachList = (instructions) => {
return this.extractInstructionList(instructions, s => s.approaches || '');
};
@ -197,17 +215,6 @@ module.exports = function () {
return instructions.tracepoints.map(t => t.alternatives_count.toString()).join(',');
};
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, instruction => {
if( 'lanes' in instruction.intersections[0] )
{
return instruction.intersections[0].lanes.map( p => { return (p.indications).join(';') + ':' + p.valid; } ).join(' ');
} else
{
return '';
}});
};
this.turnList = (instructions) => {
return instructions.legs.reduce((m, v) => m.concat(v.steps), [])
.map(v => {
@ -261,7 +268,7 @@ module.exports = function () {
};
this.classesList = (instructions) => {
return this.extractInstructionList(instructions, s => s.classes ? s.classes.join(';') : '');
return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']');
};
this.timeList = (instructions) => {

View File

@ -0,0 +1,30 @@
@routing @speed @annotations @turn_penalty
Feature: 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
j k l m
"""
And the query options
| annotations | duration,speed,weight |
And the ways
| nodes | highway |
| hk | residential |
| il | residential |
| jk | residential |
| lk | residential |
| lm | residential |
When I route I should get
| 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 |

View File

@ -14,8 +14,6 @@
#include <boost/assert.hpp>
#include <stxxl/vector>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h>
@ -25,6 +23,10 @@
#include <memory>
#include <vector>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm
{
namespace contractor
@ -33,6 +35,12 @@ namespace contractor
class GraphContractor
{
private:
#if USE_STXXL_LIBRARY
template <typename T> using ExternalVector = stxxl::vector<T>;
#else
template <typename T> using ExternalVector = std::vector<T>;
#endif
struct ContractorThreadData
{
ContractorDijkstra dijkstra;
@ -401,7 +409,7 @@ class GraphContractor
bool Bias(const NodeID a, const NodeID b) const;
std::shared_ptr<ContractorGraph> contractor_graph;
stxxl::vector<QueryEdge> external_edge_list;
ExternalVector<QueryEdge> external_edge_list;
std::vector<NodeID> orig_node_id_from_new_node_id_map;
std::vector<float> node_levels;

View File

@ -174,14 +174,13 @@ class RouteAPI : public BaseAPI
guidance::trimShortSegments(steps, leg_geometry);
leg.steps = guidance::postProcess(std::move(steps));
leg.steps = guidance::collapseTurnInstructions(std::move(leg.steps));
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
leg.steps = guidance::buildIntersections(std::move(leg.steps));
leg.steps = guidance::suppressShortNameSegments(std::move(leg.steps));
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps),
leg_geometry,
phantoms.source_phantom,
phantoms.target_phantom);
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
leg.steps = guidance::collapseUseLane(std::move(leg.steps));
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
}

View File

@ -78,10 +78,18 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
}
prev_coordinate = coordinate;
geometry.annotations.emplace_back(
LegGeometry::Annotation{current_distance,
path_point.duration_until_turn / 10.,
path_point.weight_until_turn / facade.GetWeightMultiplier(),
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));

View File

@ -63,7 +63,6 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
: target_node.forward_segment_id.id;
const auto target_name_id = facade.GetNameIndex(target_node_id);
const auto target_mode = facade.GetTravelMode(target_node_id);
auto target_classes = facade.GetClasses(facade.GetClassData(target_node_id));
const auto number_of_segments = leg_geometry.GetNumberOfSegments();
@ -88,7 +87,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
IntermediateIntersection::NO_INDEX,
0,
util::guidance::LaneTuple(),
{}};
{},
source_classes};
if (leg_data.size() > 0)
{
@ -118,7 +118,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const auto destinations = facade.GetDestinationsForID(step_name_id);
const auto exits = facade.GetExitsForID(step_name_id);
const auto distance = leg_geometry.segment_distances[segment_index];
auto classes = facade.GetClasses(path_point.classes);
// intersections contain the classes of exiting road
intersection.classes = facade.GetClasses(path_point.classes);
steps.push_back(RouteStep{step_name_id,
name.to_string(),
@ -135,8 +136,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
maneuver,
leg_geometry.FrontIndex(segment_index),
leg_geometry.BackIndex(segment_index) + 1,
{intersection},
std::move(classes)});
{intersection}});
if (leg_data_index + 1 < leg_data.size())
{
@ -196,6 +196,8 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const auto distance = leg_geometry.segment_distances[segment_index];
const EdgeWeight duration = segment_duration + target_duration;
const EdgeWeight weight = segment_weight + target_weight;
// intersections contain the classes of exiting road
intersection.classes = facade.GetClasses(facade.GetClassData(target_node_id));
BOOST_ASSERT(duration >= 0);
steps.push_back(RouteStep{step_name_id,
facade.GetNameForID(step_name_id).to_string(),
@ -212,8 +214,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
maneuver,
leg_geometry.FrontIndex(segment_index),
leg_geometry.BackIndex(segment_index) + 1,
{intersection},
std::move(target_classes)});
{intersection}});
}
// In this case the source + target are on the same edge segment
else
@ -255,8 +256,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
std::move(maneuver),
leg_geometry.FrontIndex(segment_index),
leg_geometry.BackIndex(segment_index) + 1,
{intersection},
std::move(source_classes)});
{intersection}});
}
BOOST_ASSERT(segment_index == number_of_segments - 1);
@ -269,6 +269,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
0,
IntermediateIntersection::NO_INDEX,
util::guidance::LaneTuple(),
{},
{}};
// This step has length zero, the only reason we need it is the target location
@ -295,8 +296,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
std::move(maneuver),
leg_geometry.locations.size() - 1,
leg_geometry.locations.size(),
{intersection},
std::move(target_classes)});
{intersection}});
BOOST_ASSERT(steps.front().intersections.size() == 1);
BOOST_ASSERT(steps.front().intersections.front().bearings.size() == 1);

View File

@ -20,7 +20,7 @@ namespace guidance
// as separate maneuvers.
OSRM_ATTR_WARN_UNUSED
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
const double min_duration_needed_for_lane_change = 10);
const double min_distance_needed_for_lane_change = 200);
} // namespace guidance
} // namespace engine

View File

@ -38,8 +38,12 @@ struct LegGeometry
struct Annotation
{
double distance; // distance in meters
double duration; // duration in seconds
double weight; // weight value
// Total duration of a segment, in seconds, NOT including
// the turn penalty if the segment preceeds a turn
double duration;
double weight; // weight value, NOT including the turn weight
DatasourceID datasource;
};
std::vector<Annotation> annotations;

View File

@ -42,6 +42,7 @@ struct IntermediateIntersection
// turn lane information
util::guidance::LaneTuple lanes;
extractor::guidance::TurnLaneDescription lane_description;
std::vector<std::string> classes;
};
inline IntermediateIntersection getInvalidIntersection()
@ -52,6 +53,7 @@ inline IntermediateIntersection getInvalidIntersection()
IntermediateIntersection::NO_INDEX,
IntermediateIntersection::NO_INDEX,
util::guidance::LaneTuple(),
{},
{}};
}
@ -74,7 +76,6 @@ struct RouteStep
std::size_t geometry_begin;
std::size_t geometry_end;
std::vector<IntermediateIntersection> intersections;
std::vector<std::string> classes;
// remove all information from the route step, marking it as invalid (used to indicate empty
// steps to be removed).
@ -128,7 +129,6 @@ inline void RouteStep::Invalidate()
geometry_end = 0;
intersections.clear();
intersections.push_back(getInvalidIntersection());
classes.clear();
}
// Elongate by another step in front

View File

@ -20,16 +20,6 @@ namespace guidance
OSRM_ATTR_WARN_UNUSED
std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps);
// remove use lane information that is not actually a turn. For post-processing, we need to
// associate lanes with every turn. Some of these use-lane instructions are not required after lane
// anticipation anymore. This function removes all use lane instructions that are not actually used
// anymore since all lanes going straight are used anyhow.
// FIXME this is currently only a heuristic. We need knowledge on which lanes actually might become
// turn lanes. If a straight lane becomes a turn lane, this might be something to consider. Right
// now we bet on lane-anticipation to catch this.
OSRM_ATTR_WARN_UNUSED
std::vector<RouteStep> collapseUseLane(std::vector<RouteStep> steps);
} // namespace guidance
} // namespace engine
} // namespace osrm

View File

@ -24,9 +24,17 @@ struct PathData
// name of the street that leads to the turn
unsigned name_id;
// weight that is traveled on the segment until the turn is reached
// including the turn weight, if one exists
EdgeWeight weight_until_turn;
// duration that is traveled on the segment until the turn is reached
// If this segment immediately preceeds a turn, then duration_of_turn
// will contain the weight of the turn. Otherwise it will be 0.
EdgeWeight weight_of_turn;
// duration that is traveled on the segment until the turn is reached,
// including a turn if the segment preceeds one.
EdgeWeight duration_until_turn;
// If this segment immediately preceeds a turn, then duration_of_turn
// will contain the duration of the turn. Otherwise it will be 0.
EdgeWeight duration_of_turn;
// instruction to execute at the turn
extractor::guidance::TurnInstruction turn_instruction;
// turn lane data

View File

@ -186,7 +186,9 @@ void annotatePath(const FacadeT &facade,
unpacked_path.push_back(PathData{id_vector[segment_idx + 1],
name_index,
weight_vector[segment_idx],
0,
duration_vector[segment_idx],
0,
extractor::guidance::TurnInstruction::NO_TURN(),
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
travel_mode,
@ -200,10 +202,15 @@ void annotatePath(const FacadeT &facade,
if (facade.HasLaneData(turn_id))
unpacked_path.back().lane_data = facade.GetLaneData(turn_id);
const auto turn_duration = facade.GetDurationPenaltyForEdgeID(turn_id);
const auto turn_weight = facade.GetWeightPenaltyForEdgeID(turn_id);
unpacked_path.back().entry_class = facade.GetEntryClass(turn_id);
unpacked_path.back().turn_instruction = turn_instruction;
unpacked_path.back().duration_until_turn += facade.GetDurationPenaltyForEdgeID(turn_id);
unpacked_path.back().weight_until_turn += facade.GetWeightPenaltyForEdgeID(turn_id);
unpacked_path.back().duration_until_turn += turn_duration;
unpacked_path.back().duration_of_turn = turn_duration;
unpacked_path.back().weight_until_turn += turn_weight;
unpacked_path.back().weight_of_turn = turn_weight;
unpacked_path.back().pre_turn_bearing = facade.PreTurnBearing(turn_id);
unpacked_path.back().post_turn_bearing = facade.PostTurnBearing(turn_id);
}
@ -262,7 +269,9 @@ void annotatePath(const FacadeT &facade,
PathData{id_vector[start_index < end_index ? segment_idx + 1 : segment_idx - 1],
facade.GetNameIndex(target_node_id),
weight_vector[segment_idx],
0,
duration_vector[segment_idx],
0,
extractor::guidance::TurnInstruction::NO_TURN(),
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
facade.GetTravelMode(target_node_id),

View File

@ -10,31 +10,19 @@
#include "storage/io.hpp"
#include <cstdint>
#include <stxxl/vector>
#include <unordered_map>
namespace osrm
{
namespace extractor
{
/**
* Uses external memory containers from stxxl to store all the data that
* Uses memory containers to store all the data that
* is collected by the extractor callbacks.
*
* The data is the filtered, aggregated and finally written to disk.
*/
class ExtractionContainers
{
#ifndef _MSC_VER
constexpr static unsigned stxxl_memory =
((sizeof(std::size_t) == 4) ? std::numeric_limits<int>::max()
: std::numeric_limits<unsigned>::max());
#else
const static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? INT_MAX : UINT_MAX);
#endif
void FlushVectors();
void PrepareNodes();
void PrepareRestrictions();
void PrepareEdges(ScriptingEnvironment &scripting_environment);
@ -45,25 +33,24 @@ class ExtractionContainers
void WriteCharData(const std::string &file_name);
public:
using STXXLNodeIDVector = stxxl::vector<OSMNodeID>;
using STXXLNodeVector = stxxl::vector<QueryNode>;
using STXXLEdgeVector = stxxl::vector<InternalExtractorEdge>;
using NodeIDVector = std::vector<OSMNodeID>;
using NodeVector = std::vector<QueryNode>;
using EdgeVector = std::vector<InternalExtractorEdge>;
using RestrictionsVector = std::vector<InputRestrictionContainer>;
using STXXLWayIDStartEndVector = stxxl::vector<FirstAndLastSegmentOfWay>;
using STXXLNameCharData = stxxl::vector<unsigned char>;
using STXXLNameOffsets = stxxl::vector<unsigned>;
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_lights;
STXXLNodeIDVector used_node_id_list;
STXXLNodeVector all_nodes_list;
STXXLEdgeVector all_edges_list;
STXXLNameCharData name_char_data;
STXXLNameOffsets name_offsets;
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;
STXXLWayIDStartEndVector way_start_end_id_list;
std::unordered_map<OSMNodeID, NodeID> external_to_internal_node_id_map;
WayIDStartEndVector way_start_end_id_list;
unsigned max_internal_node_id;
std::vector<TurnRestriction> unconditional_turn_restrictions;

View File

@ -43,7 +43,7 @@ struct FirstAndLastSegmentOfWay
}
};
struct FirstAndLastSegmentOfWayStxxlCompare
struct FirstAndLastSegmentOfWayCompare
{
using value_type = FirstAndLastSegmentOfWay;
bool operator()(const FirstAndLastSegmentOfWay &a, const FirstAndLastSegmentOfWay &b) const

View File

@ -49,7 +49,7 @@ const constexpr Enum EnterRotary = 12; // Enter a rotary
const constexpr Enum EnterAndExitRotary = 13; // Touching a rotary
const constexpr Enum EnterRoundaboutIntersection = 14; // Entering a small Roundabout
const constexpr Enum EnterAndExitRoundaboutIntersection = 15; // Touching a roundabout
const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane!
// depreacted: const constexpr Enum UseLane = 16; // No Turn, but you need to stay on a given lane!
// Values below here are silent instructions
const constexpr Enum NoTurn = 17; // end of segment without turn/middle of a segment

View File

@ -24,7 +24,6 @@ struct TurnLaneData
// a temporary data entry that does not need to be assigned to an entry.
// This is the case in situations that use partition and require the entry to perform the
// one-to-one mapping.
bool suppress_assignment;
bool operator<(const TurnLaneData &other) const;
};
typedef std::vector<TurnLaneData> LaneDataVector;

View File

@ -176,6 +176,64 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
return engine_config_ptr();
}
// Set EngineConfig system-wide limits on construction, if requested
auto max_locations_trip = params->Get(Nan::New("max_locations_trip").ToLocalChecked());
auto max_locations_viaroute = params->Get(Nan::New("max_locations_viaroute").ToLocalChecked());
auto max_locations_distance_table =
params->Get(Nan::New("max_locations_distance_table").ToLocalChecked());
auto max_locations_map_matching =
params->Get(Nan::New("max_locations_map_matching").ToLocalChecked());
auto max_results_nearest = params->Get(Nan::New("max_results_nearest").ToLocalChecked());
auto max_alternatives = params->Get(Nan::New("max_alternatives").ToLocalChecked());
if (!max_locations_trip->IsUndefined() && !max_locations_trip->IsNumber())
{
Nan::ThrowError("max_locations_trip must be an integral number");
return engine_config_ptr();
}
if (!max_locations_viaroute->IsUndefined() && !max_locations_viaroute->IsNumber())
{
Nan::ThrowError("max_locations_viaroute must be an integral number");
return engine_config_ptr();
}
if (!max_locations_distance_table->IsUndefined() && !max_locations_distance_table->IsNumber())
{
Nan::ThrowError("max_locations_distance_table must be an integral number");
return engine_config_ptr();
}
if (!max_locations_map_matching->IsUndefined() && !max_locations_map_matching->IsNumber())
{
Nan::ThrowError("max_locations_map_matching must be an integral number");
return engine_config_ptr();
}
if (!max_results_nearest->IsUndefined() && !max_results_nearest->IsNumber())
{
Nan::ThrowError("max_results_nearest must be an integral number");
return engine_config_ptr();
}
if (!max_alternatives->IsUndefined() && !max_alternatives->IsNumber())
{
Nan::ThrowError("max_alternatives must be an integral number");
return engine_config_ptr();
}
if (max_locations_trip->IsNumber())
engine_config->max_locations_trip = static_cast<int>(max_locations_trip->NumberValue());
if (max_locations_viaroute->IsNumber())
engine_config->max_locations_viaroute =
static_cast<int>(max_locations_viaroute->NumberValue());
if (max_locations_distance_table->IsNumber())
engine_config->max_locations_distance_table =
static_cast<int>(max_locations_distance_table->NumberValue());
if (max_locations_map_matching->IsNumber())
engine_config->max_locations_map_matching =
static_cast<int>(max_locations_map_matching->NumberValue());
if (max_results_nearest->IsNumber())
engine_config->max_results_nearest = static_cast<int>(max_results_nearest->NumberValue());
if (max_alternatives->IsNumber())
engine_config->max_alternatives = static_cast<int>(max_alternatives->NumberValue());
return engine_config;
}
@ -721,7 +779,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
if (value->IsBoolean())
{
params->alternatives = value->BooleanValue();
params->number_of_alternatives = 1u;
params->number_of_alternatives = value->BooleanValue() ? 1u : 0u;
}
else if (value->IsNumber())
{

View File

@ -7,8 +7,13 @@
#include "storage/io.hpp"
#include <cmath>
#include <cstdint>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm
{
namespace storage
@ -58,6 +63,7 @@ inline void write(storage::io::FileWriter &writer, const util::DeallocatingVecto
writer.WriteFrom(vec.bucket_list.back(), last_block_size);
}
#if USE_STXXL_LIBRARY
template <typename T> inline void read(storage::io::FileReader &reader, stxxl::vector<T> &vec)
{
auto size = reader.ReadOne<std::uint64_t>();
@ -78,6 +84,7 @@ inline void write(storage::io::FileWriter &writer, const stxxl::vector<T> &vec)
writer.WriteOne<T>(vec[idx]);
}
}
#endif
template <typename T> void read(io::FileReader &reader, std::vector<T> &data)
{

View File

@ -90,9 +90,7 @@ inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_da
std::cout << "\t" << entry.tag << "("
<< extractor::guidance::TurnLaneType::toString(entry.tag)
<< ") from: " << static_cast<int>(entry.from)
<< " to: " << static_cast<int>(entry.to)
<< " Can Be Suppresssed: " << (entry.suppress_assignment ? "true" : "false")
<< "\n";
<< " to: " << static_cast<int>(entry.to) << "\n";
std::cout << std::flush;
}

View File

@ -3,11 +3,14 @@
#include "util/log.hpp"
#include <stxxl/mng>
#ifndef _WIN32
#include <sys/resource.h>
#endif
#if USE_STXXL_LIBRARY
#include <stxxl/mng>
#endif
namespace osrm
{
namespace util
@ -15,6 +18,7 @@ namespace util
inline void DumpSTXXLStats()
{
#if USE_STXXL_LIBRARY
#if STXXL_VERSION_MAJOR > 1 || (STXXL_VERSION_MAJOR == 1 && STXXL_VERSION_MINOR >= 4)
auto manager = stxxl::block_manager::get_instance();
util::Log() << "STXXL: peak bytes used: " << manager->get_maximum_allocation();
@ -23,6 +27,7 @@ inline void DumpSTXXLStats()
#warning STXXL 1.4+ recommended - STXXL memory summary will not be available
util::Log() << "STXXL: memory summary not available, needs STXXL 1.4 or higher";
#endif
#endif
}
inline void DumpMemoryStats()

View File

@ -6,8 +6,6 @@
#include "storage/shared_memory_ownership.hpp"
#include <stxxl/vector>
#include <boost/assert.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/reverse_iterator.hpp>
@ -21,6 +19,10 @@
#include <utility>
#include <vector>
#if USE_STXXL_LIBRARY
#include <stxxl/vector>
#endif
namespace osrm
{
namespace util
@ -209,10 +211,16 @@ template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT>
std::swap(lhs.m_size, rhs.m_size);
}
#if USE_STXXL_LIBRARY
template <typename T> using ExternalVector = stxxl::vector<T>;
#else
template <typename T> using ExternalVector = std::vector<T>;
#endif
template <typename DataT, storage::Ownership Ownership>
using InternalOrExternalVector =
typename std::conditional<Ownership == storage::Ownership::External,
stxxl::vector<DataT>,
ExternalVector<DataT>,
std::vector<DataT>>::type;
template <typename DataT, storage::Ownership Ownership>

View File

@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.9.0-latest.1",
"version": "5.9.2",
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {

View File

@ -72,6 +72,12 @@ local profile = {
restricted_highway_whitelist = Set { },
construction_whitelist = Set {
'no',
'widening',
'minor',
},
access_tags_hierarchy = Sequence {
'bicycle',
'vehicle',
@ -189,7 +195,8 @@ local profile = {
avoid = Set {
'impassable',
'construction'
'construction',
'proposed'
}
}

View File

@ -94,6 +94,13 @@ local profile = {
'access'
},
construction_whitelist = Set {
'no',
'widening',
'minor',
},
service_tag_forbidden = Set {
'emergency_access'
},
@ -110,7 +117,9 @@ local profile = {
'reversible',
'impassable',
'hov_lanes',
'steps'
'steps',
'construction',
'proposed'
},
speeds = Sequence {

View File

@ -61,6 +61,8 @@ local profile = {
restricted_highway_whitelist = Set { },
construction_whitelist = Set {},
access_tags_hierarchy = Sequence {
'foot',
'access'
@ -76,7 +78,9 @@ local profile = {
},
avoid = Set {
'impassable'
'impassable',
'construction',
'proposed'
},
speeds = Sequence {

View File

@ -48,7 +48,7 @@ function Handlers.handle_names(way,result,data,profile)
end
if exits then
result.exits = exits
result.exits = canonicalizeStringList(exits, ";")
end
end
@ -513,6 +513,25 @@ function Handlers.handle_blocked_ways(way,result,data,profile)
return false
end
-- In addition to the highway=construction tag above handle the construction=* tag
-- http://wiki.openstreetmap.org/wiki/Key:construction
-- https://taginfo.openstreetmap.org/keys/construction#values
if profile.avoid.construction then
local construction = way:get_value_by_key('construction')
-- Of course there are negative tags to handle, too
if construction and not profile.construction_whitelist[construction] then
return false
end
end
-- Not only are there multiple construction tags there is also a proposed=* tag.
-- http://wiki.openstreetmap.org/wiki/Key:proposed
-- https://taginfo.openstreetmap.org/keys/proposed#values
if profile.avoid.proposed and way:get_value_by_key('proposed') then
return false
end
-- Reversible oneways change direction with low frequency (think twice a day):
-- do not route over these at all at the moment because of time dependence.
-- Note: alternating (high frequency) oneways are handled below with penalty.

View File

@ -10,9 +10,6 @@ local pprint = require('lib/pprint')
-- globals that are normally set from C++
-- profiles code modifies this table
properties = {}
-- should match values defined in include/extractor/guidance/road_classification.hpp
road_priority_class = {
motorway = 0,
@ -122,6 +119,8 @@ function Debug.way_function(way,result)
result.forward_speed = -1
result.backward_speed = -1
result.duration = 0
result.forward_classes = {}
result.backward_classes = {}
-- intercept tag function normally provided via C++
function way:get_value_by_key(k)

View File

@ -234,6 +234,18 @@ util::json::Object makeIntersection(const guidance::IntermediateIntersection &in
if (detail::hasValidLanes(intersection))
result.values["lanes"] = detail::lanesFromIntersection(intersection);
if (!intersection.classes.empty())
{
util::json::Array classes;
classes.values.reserve(intersection.classes.size());
std::transform(
intersection.classes.begin(),
intersection.classes.end(),
std::back_inserter(classes.values),
[](const std::string &class_name) { return util::json::String{class_name}; });
result.values["classes"] = std::move(classes);
}
return result;
}
@ -265,18 +277,6 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver));
route_step.values["geometry"] = std::move(geometry);
if (!step.classes.empty())
{
util::json::Array classes;
classes.values.reserve(step.classes.size());
std::transform(
step.classes.begin(),
step.classes.end(),
std::back_inserter(classes.values),
[](const std::string &class_name) { return util::json::String{class_name}; });
route_step.values["classes"] = std::move(classes);
}
util::json::Array intersections;
intersections.values.reserve(step.intersections.size());
std::transform(step.intersections.begin(),

View File

@ -21,10 +21,10 @@ namespace guidance
{
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
const double min_duration_needed_for_lane_change)
const double min_distance_needed_for_lane_change)
{
// Lane anticipation works on contiguous ranges of quick steps that have lane information
const auto is_quick_has_lanes = [&](const RouteStep &step) {
// Lane anticipation works on contiguous ranges of short steps that have lane information
const auto is_short_has_lanes = [&](const RouteStep &step) {
const auto has_lanes = step.intersections.front().lanes.lanes_in_turn > 0;
if (!has_lanes)
@ -41,10 +41,10 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// We do not have a source-target lane mapping, assume worst case for lanes to cross.
const auto to_cross = std::max(step.NumLanesToTheRight(), step.NumLanesToTheLeft());
const auto scale = 1 + to_cross;
const auto threshold = scale * min_duration_needed_for_lane_change;
const auto threshold = scale * min_distance_needed_for_lane_change;
const auto is_quick = step.duration < threshold;
return is_quick;
const auto is_short = step.distance < threshold;
return is_short;
};
using StepIter = decltype(steps)::iterator;
@ -57,7 +57,7 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
quick_lanes_ranges.push_back(std::move(range));
};
util::group_by(begin(steps), end(steps), is_quick_has_lanes, range_back_inserter);
util::group_by(begin(steps), end(steps), is_short_has_lanes, range_back_inserter);
// The lanes for a keep straight depend on the next left/right turn. Tag them in advance.
std::unordered_set<const RouteStep *> is_straight_left;
@ -75,10 +75,11 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// state for the lamda
// the number of lanes we have to change depends on the number of lanes that are allowed for
// a turn (in general) and the set of lanes which would allow for us to do the turn without
// a problem. In a sequence of turns, we have to look at how much time we need to switch the
// a problem. In a sequence of turns, we have to look at how much distance we need to switch
// the
// sequence. Given the turns in between, we would expect a bit longer than on a straight
// segment for a lane switch, but the total time shouldn't be unlimited.
double time_to_constrained = 0.0;
// segment for a lane switch, but the total distance shouldn't be unlimited.
double distance_to_constrained = 0.0;
util::for_each_pair(rev_first, rev_last, [&](RouteStep &current, RouteStep &previous) {
const auto current_inst = current.maneuver.instruction;
@ -96,14 +97,14 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
// only prevent use lanes due to making all turns. don't make turns during curvy
// segments
if (previous_inst.type == TurnType::UseLane)
time_to_constrained += previous.duration;
if (previous_inst.type == TurnType::Suppressed)
distance_to_constrained += previous.distance;
else
time_to_constrained = 0;
distance_to_constrained = 0.;
const auto lane_delta = previous_lanes.lanes_in_turn - current_lanes.lanes_in_turn;
const auto can_make_all_turns =
time_to_constrained > lane_delta * min_duration_needed_for_lane_change;
distance_to_constrained > lane_delta * min_distance_needed_for_lane_change;
if (!lanes_to_constrain || !lanes_fan_in || can_make_all_turns)
return;
@ -193,8 +194,9 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
anticipate_for_right_turn();
}
if (previous_inst.type == TurnType::UseLane && current_inst.type == TurnType::UseLane &&
previous.mode == current.mode && previous_lanes == current_lanes)
if (previous_inst.type == TurnType::Suppressed &&
current_inst.type == TurnType::Suppressed && previous.mode == current.mode &&
previous_lanes == current_lanes)
{
previous.ElongateBy(current);
current.Invalidate();

View File

@ -133,8 +133,7 @@ void closeOffRoundabout(const bool on_roundabout,
BOOST_ASSERT(leavesRoundabout(steps[1].maneuver.instruction) ||
steps[1].maneuver.instruction.type == TurnType::StayOnRoundabout ||
steps[1].maneuver.instruction.type == TurnType::Suppressed ||
steps[1].maneuver.instruction.type == TurnType::NoTurn ||
steps[1].maneuver.instruction.type == TurnType::UseLane);
steps[1].maneuver.instruction.type == TurnType::NoTurn);
steps[0].geometry_end = 1;
steps[1].geometry_begin = 0;
steps[1].AddInFront(steps[0]);
@ -486,7 +485,6 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
auto &new_next_to_last = *(steps.end() - 2);
next_to_last_step.AdaptStepSignage(new_next_to_last);
next_to_last_step.mode = new_next_to_last.mode;
next_to_last_step.classes = new_next_to_last.classes;
// the geometry indices of the last step are already correct;
}
else if (util::coordinate_calculation::haversineDistance(

View File

@ -82,52 +82,6 @@ std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps)
return removeNoTurnInstructions(std::move(steps));
}
// `useLane` steps are only returned on `straight` maneuvers when there
// are surrounding lanes also tagged as `straight`. If there are no other `straight`
// lanes, it is not an ambiguous maneuver, and we can collapse the `useLane` step.
std::vector<RouteStep> collapseUseLane(std::vector<RouteStep> steps)
{
const auto containsTag = [](const extractor::guidance::TurnLaneType::Mask mask,
const extractor::guidance::TurnLaneType::Mask tag) {
return (mask & tag) != extractor::guidance::TurnLaneType::empty;
};
const auto canCollapseUseLane = [containsTag](const RouteStep &step) {
// the lane description is given left to right, lanes are counted from the right.
// Therefore we access the lane description using the reverse iterator
auto right_most_lanes = step.LanesToTheRight();
if (!right_most_lanes.empty() && containsTag(right_most_lanes.front(),
(extractor::guidance::TurnLaneType::straight |
extractor::guidance::TurnLaneType::none)))
return false;
auto left_most_lanes = step.LanesToTheLeft();
if (!left_most_lanes.empty() && containsTag(left_most_lanes.back(),
(extractor::guidance::TurnLaneType::straight |
extractor::guidance::TurnLaneType::none)))
return false;
return true;
};
BOOST_ASSERT(steps.size() > 1);
for (auto step_itr = steps.begin() + 1; step_itr != steps.end(); ++step_itr)
{
if (step_itr->maneuver.instruction.type == TurnType::UseLane &&
canCollapseUseLane(*step_itr))
{
auto previous_turn_itr = findPreviousTurn(step_itr);
if (haveSameMode(*previous_turn_itr, *step_itr))
{
previous_turn_itr->ElongateBy(*step_itr);
step_itr->Invalidate();
}
}
}
return removeNoTurnInstructions(std::move(steps));
}
} // namespace guidance
} // namespace engine
} // namespace osrm

View File

@ -121,9 +121,12 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
routes = algorithms.ShortestPathSearch(start_end_nodes, route_parameters.continue_straight);
}
// The post condition for all path searches is we have at least one route in our result.
// This route might be invalid by means of INVALID_EDGE_WEIGHT as shortest path weight.
BOOST_ASSERT(!routes.routes.empty());
// we can only know this after the fact, different SCC ids still
// allow for connection in one direction.
BOOST_ASSERT(!routes.routes.empty());
if (routes.routes[0].is_valid())
{

View File

@ -792,8 +792,15 @@ InternalManyRoutesResult alternativePathSearch(SearchEngineData<Algorithm> &sear
shortest_path_via_it->node != SPECIAL_NODEID &&
shortest_path_via_it->weight != INVALID_EDGE_WEIGHT;
// Care needs to be taken to meet the call sites post condition.
// We must return at least one route, even if it's an invalid one.
if (!has_shortest_path)
return InternalManyRoutesResult{};
{
InternalRouteResult invalid;
invalid.shortest_path_weight = INVALID_EDGE_WEIGHT;
invalid.segment_end_coordinates = {phantom_node_pair};
return invalid;
}
NodeID shortest_path_via = shortest_path_via_it->node;
EdgeWeight shortest_path_weight = shortest_path_via_it->weight;

View File

@ -21,7 +21,7 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/ref.hpp>
#include <stxxl/sort>
#include <tbb/parallel_sort.h>
#include <chrono>
#include <limits>
@ -32,16 +32,6 @@ namespace
{
namespace oe = osrm::extractor;
// Needed for STXXL comparison - STXXL requires max_value(), min_value(), so we can not use
// std::less<OSMNodeId>{}. Anonymous namespace to keep translation unit local.
struct OSMNodeIDSTXXLLess
{
using value_type = OSMNodeID;
bool operator()(const value_type left, const value_type right) const { return left < right; }
value_type max_value() { return MAX_OSM_NODEID; }
value_type min_value() { return MIN_OSM_NODEID; }
};
struct CmpEdgeByOSMStartID
{
using value_type = oe::InternalExtractorEdge;
@ -49,9 +39,6 @@ struct CmpEdgeByOSMStartID
{
return lhs.result.osm_source_id < rhs.result.osm_source_id;
}
value_type max_value() { return value_type::max_osm_value(); }
value_type min_value() { return value_type::min_osm_value(); }
};
struct CmpEdgeByOSMTargetID
@ -61,9 +48,6 @@ struct CmpEdgeByOSMTargetID
{
return lhs.result.osm_target_id < rhs.result.osm_target_id;
}
value_type max_value() { return value_type::max_osm_value(); }
value_type min_value() { return value_type::min_osm_value(); }
};
struct CmpEdgeByInternalSourceTargetAndName
@ -92,22 +76,25 @@ struct CmpEdgeByInternalSourceTargetAndName
if (rhs.result.name_id == EMPTY_NAMEID)
return true;
std::lock_guard<std::mutex> lock(mutex);
BOOST_ASSERT(!name_offsets.empty() && name_offsets.back() == name_data.size());
const oe::ExtractionContainers::STXXLNameCharData::const_iterator data = name_data.begin();
const oe::ExtractionContainers::NameCharData::const_iterator data = name_data.begin();
return std::lexicographical_compare(data + name_offsets[lhs.result.name_id],
data + name_offsets[lhs.result.name_id + 1],
data + name_offsets[rhs.result.name_id],
data + name_offsets[rhs.result.name_id + 1]);
}
value_type max_value() { return value_type::max_internal_value(); }
value_type min_value() { return value_type::min_internal_value(); }
std::mutex &mutex;
const oe::ExtractionContainers::STXXLNameCharData &name_data;
const oe::ExtractionContainers::STXXLNameOffsets &name_offsets;
const oe::ExtractionContainers::NameCharData &name_data;
const oe::ExtractionContainers::NameOffsets &name_offsets;
};
template <typename Iter>
inline NodeID mapExternalToInternalNodeID(Iter first, Iter last, const OSMNodeID value)
{
const auto it = std::lower_bound(first, last, value);
return (it == last || value < *it) ? SPECIAL_NODEID
: static_cast<NodeID>(std::distance(first, it));
}
}
namespace osrm
@ -117,9 +104,6 @@ namespace extractor
ExtractionContainers::ExtractionContainers()
{
// Check if stxxl can be instantiated
stxxl::vector<unsigned> dummy_vector;
// Insert four empty strings offsets for name, ref, destination, pronunciation, and exits
name_offsets.push_back(0);
name_offsets.push_back(0);
@ -130,16 +114,6 @@ ExtractionContainers::ExtractionContainers()
name_offsets.push_back(0);
}
void ExtractionContainers::FlushVectors()
{
used_node_id_list.flush();
all_nodes_list.flush();
all_edges_list.flush();
name_char_data.flush();
name_offsets.flush();
way_start_end_id_list.flush();
}
/**
* Processes the collected data and serializes it.
* At this point nodes are still referenced by their OSM id.
@ -158,11 +132,11 @@ void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environme
storage::io::FileWriter file_out(output_file_name,
storage::io::FileWriter::GenerateFingerprint);
FlushVectors();
PrepareNodes();
WriteNodes(file_out);
PrepareEdges(scripting_environment);
all_nodes_list.clear(); // free all_nodes_list before allocation of normal_edges
all_nodes_list.shrink_to_fit();
WriteEdges(file_out);
PrepareRestrictions();
@ -190,8 +164,7 @@ void ExtractionContainers::PrepareNodes()
util::UnbufferedLog log;
log << "Sorting used nodes ... " << std::flush;
TIMER_START(sorting_used_nodes);
stxxl::sort(
used_node_id_list.begin(), used_node_id_list.end(), OSMNodeIDSTXXLLess(), stxxl_memory);
tbb::parallel_sort(used_node_id_list.begin(), used_node_id_list.end());
TIMER_STOP(sorting_used_nodes);
log << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s";
}
@ -207,23 +180,13 @@ void ExtractionContainers::PrepareNodes()
}
{
struct QueryNodeSTXXLCompare
{
using value_type = QueryNode;
value_type max_value() { return value_type::max_value(); }
value_type min_value() { return value_type::min_value(); }
bool operator()(const value_type &left, const value_type &right) const
{
return left.node_id < right.node_id;
}
};
util::UnbufferedLog log;
log << "Sorting all nodes ... " << std::flush;
TIMER_START(sorting_nodes);
stxxl::sort(
all_nodes_list.begin(), all_nodes_list.end(), QueryNodeSTXXLCompare(), stxxl_memory);
tbb::parallel_sort(
all_nodes_list.begin(), all_nodes_list.end(), [](const auto &left, const auto &right) {
return left.node_id < right.node_id;
});
TIMER_STOP(sorting_nodes);
log << "ok, after " << TIMER_SEC(sorting_nodes) << "s";
}
@ -232,16 +195,11 @@ void ExtractionContainers::PrepareNodes()
util::UnbufferedLog log;
log << "Building node id map ... " << std::flush;
TIMER_START(id_map);
external_to_internal_node_id_map.reserve(used_node_id_list.size());
auto node_iter = all_nodes_list.begin();
auto ref_iter = used_node_id_list.begin();
auto used_nodes_iter = used_node_id_list.begin();
const auto all_nodes_list_end = all_nodes_list.end();
const auto used_node_id_list_end = used_node_id_list.end();
// Note: despite being able to handle 64 bit OSM node ids, we can't
// handle > uint32_t actual usable nodes. This should be OK for a while
// because we usually route on a *lot* less than 2^32 of the OSM
// graph nodes.
std::uint64_t internal_id = 0;
// compute the intersection of nodes that were referenced and nodes we actually have
while (node_iter != all_nodes_list_end && ref_iter != used_node_id_list_end)
@ -257,17 +215,21 @@ void ExtractionContainers::PrepareNodes()
continue;
}
BOOST_ASSERT(node_iter->node_id == *ref_iter);
external_to_internal_node_id_map[*ref_iter] = static_cast<NodeID>(internal_id++);
*used_nodes_iter = std::move(*ref_iter);
used_nodes_iter++;
node_iter++;
ref_iter++;
}
if (internal_id > std::numeric_limits<NodeID>::max())
// Remove unused nodes and check maximal internal node id
used_node_id_list.resize(std::distance(used_node_id_list.begin(), used_nodes_iter));
if (used_node_id_list.size() > std::numeric_limits<NodeID>::max())
{
throw util::exception("There are too many nodes remaining after filtering, OSRM only "
"supports 2^32 unique nodes, but there were " +
std::to_string(internal_id) + SOURCE_REF);
std::to_string(used_node_id_list.size()) + SOURCE_REF);
}
max_internal_node_id = boost::numeric_cast<std::uint64_t>(internal_id);
max_internal_node_id = boost::numeric_cast<std::uint64_t>(used_node_id_list.size());
TIMER_STOP(id_map);
log << "ok, after " << TIMER_SEC(id_map) << "s";
}
@ -280,8 +242,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
util::UnbufferedLog log;
log << "Sorting edges by start ... " << std::flush;
TIMER_START(sort_edges_by_start);
stxxl::sort(
all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMStartID(), stxxl_memory);
tbb::parallel_sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMStartID());
TIMER_STOP(sort_edges_by_start);
log << "ok, after " << TIMER_SEC(sort_edges_by_start) << "s";
}
@ -325,9 +286,10 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
BOOST_ASSERT(edge_iterator->result.osm_source_id == node_iterator->node_id);
// assign new node id
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id);
BOOST_ASSERT(id_iter != external_to_internal_node_id_map.end());
edge_iterator->result.source = id_iter->second;
const auto node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(), used_node_id_list.end(), node_iterator->node_id);
BOOST_ASSERT(node_id != SPECIAL_NODEID);
edge_iterator->result.source = node_id;
edge_iterator->source_coordinate.lat = node_iterator->lat;
edge_iterator->source_coordinate.lon = node_iterator->lon;
@ -351,8 +313,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
util::UnbufferedLog log;
log << "Sorting edges by target ... " << std::flush;
TIMER_START(sort_edges_by_target);
stxxl::sort(
all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMTargetID(), stxxl_memory);
tbb::parallel_sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMTargetID());
TIMER_STOP(sort_edges_by_target);
log << "ok, after " << TIMER_SEC(sort_edges_by_target) << "s";
}
@ -419,9 +380,10 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
edge.duration = std::max<EdgeWeight>(1, std::round(segment.duration * 10.));
// assign new node id
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id);
BOOST_ASSERT(id_iter != external_to_internal_node_id_map.end());
edge.target = id_iter->second;
const auto node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(), used_node_id_list.end(), node_iterator->node_id);
BOOST_ASSERT(node_id != SPECIAL_NODEID);
edge.target = node_id;
// orient edges consistently: source id < target id
// important for multi-edge removal
@ -454,11 +416,9 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
log << "Sorting edges by renumbered start ... ";
TIMER_START(sort_edges_by_renumbered_start);
std::mutex name_data_mutex;
stxxl::sort(
all_edges_list.begin(),
tbb::parallel_sort(all_edges_list.begin(),
all_edges_list.end(),
CmpEdgeByInternalSourceTargetAndName{name_data_mutex, name_char_data, name_offsets},
stxxl_memory);
CmpEdgeByInternalSourceTargetAndName{name_char_data, name_offsets});
TIMER_STOP(sort_edges_by_renumbered_start);
log << "ok, after " << TIMER_SEC(sort_edges_by_renumbered_start) << "s";
}
@ -640,12 +600,13 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
log << "Writing barrier nodes ... ";
TIMER_START(write_nodes);
std::vector<NodeID> internal_barrier_nodes;
for (const auto id : barrier_nodes)
for (const auto osm_id : barrier_nodes)
{
auto iter = external_to_internal_node_id_map.find(id);
if (iter != external_to_internal_node_id_map.end())
const auto node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(), used_node_id_list.end(), osm_id);
if (node_id != SPECIAL_NODEID)
{
internal_barrier_nodes.push_back(iter->second);
internal_barrier_nodes.push_back(node_id);
}
}
storage::serialization::write(file_out, internal_barrier_nodes);
@ -657,12 +618,13 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
log << "Writing traffic light nodes ... ";
TIMER_START(write_nodes);
std::vector<NodeID> internal_traffic_lights;
for (const auto id : traffic_lights)
for (const auto osm_id : traffic_lights)
{
auto iter = external_to_internal_node_id_map.find(id);
if (iter != external_to_internal_node_id_map.end())
const auto node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(), used_node_id_list.end(), osm_id);
if (node_id != SPECIAL_NODEID)
{
internal_traffic_lights.push_back(iter->second);
internal_traffic_lights.push_back(node_id);
}
}
storage::serialization::write(file_out, internal_traffic_lights);
@ -716,10 +678,9 @@ void ExtractionContainers::PrepareRestrictions()
util::UnbufferedLog log;
log << "Sorting used ways ... ";
TIMER_START(sort_ways);
stxxl::sort(way_start_end_id_list.begin(),
tbb::parallel_sort(way_start_end_id_list.begin(),
way_start_end_id_list.end(),
FirstAndLastSegmentOfWayStxxlCompare(),
stxxl_memory);
FirstAndLastSegmentOfWayCompare());
TIMER_STOP(sort_ways);
log << "ok, after " << TIMER_SEC(sort_ways) << "s";
}
@ -728,7 +689,7 @@ void ExtractionContainers::PrepareRestrictions()
util::UnbufferedLog log;
log << "Sorting " << restrictions_list.size() << " restriction. by from... ";
TIMER_START(sort_restrictions);
std::sort(
tbb::parallel_sort(
restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByFrom());
TIMER_STOP(sort_restrictions);
log << "ok, after " << TIMER_SEC(sort_restrictions) << "s";
@ -766,26 +727,30 @@ void ExtractionContainers::PrepareRestrictions()
BOOST_ASSERT(
way_start_and_end_iterator->way_id ==
OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.from.way)});
// we do not remap the via id yet, since we will need it for the to node as well
const OSMNodeID via_node_id = OSMNodeID{restrictions_iterator->restriction.via.node};
const OSMNodeID via_osm_node_id =
OSMNodeID{restrictions_iterator->restriction.via.node};
// check if via is actually valid, if not invalidate
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id);
if (via_id_iter == external_to_internal_node_id_map.end())
auto via_node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(), used_node_id_list.end(), via_osm_node_id);
if (via_node_id == SPECIAL_NODEID)
{
util::Log(logDEBUG) << "Restriction references invalid node: "
<< restrictions_iterator->restriction.via.node;
util::Log(logDEBUG) << "Restriction references invalid node: " << via_osm_node_id;
restrictions_iterator->restriction.via.node = SPECIAL_NODEID;
++restrictions_iterator;
continue;
}
if (way_start_and_end_iterator->first_segment_source_id == via_node_id)
if (way_start_and_end_iterator->first_segment_source_id == via_osm_node_id)
{
// assign new from node id
auto id_iter = external_to_internal_node_id_map.find(
const auto from_node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(),
used_node_id_list.end(),
way_start_and_end_iterator->first_segment_target_id);
if (id_iter == external_to_internal_node_id_map.end())
if (from_node_id == SPECIAL_NODEID)
{
util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->first_segment_target_id;
@ -794,14 +759,16 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator;
continue;
}
restrictions_iterator->restriction.from.node = id_iter->second;
restrictions_iterator->restriction.from.node = from_node_id;
}
else if (way_start_and_end_iterator->last_segment_target_id == via_node_id)
else if (way_start_and_end_iterator->last_segment_target_id == via_osm_node_id)
{
// assign new from node id
auto id_iter = external_to_internal_node_id_map.find(
const auto from_node_id =
mapExternalToInternalNodeID(used_node_id_list.begin(),
used_node_id_list.end(),
way_start_and_end_iterator->last_segment_source_id);
if (id_iter == external_to_internal_node_id_map.end())
if (from_node_id == SPECIAL_NODEID)
{
util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->last_segment_target_id;
@ -810,7 +777,7 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator;
continue;
}
restrictions_iterator->restriction.from.node = id_iter->second;
restrictions_iterator->restriction.from.node = from_node_id;
}
else
{
@ -828,7 +795,7 @@ void ExtractionContainers::PrepareRestrictions()
util::UnbufferedLog log;
log << "Sorting restrictions. by to ... " << std::flush;
TIMER_START(sort_restrictions_to);
std::sort(
tbb::parallel_sort(
restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByTo());
TIMER_STOP(sort_restrictions_to);
log << "ok, after " << TIMER_SEC(sort_restrictions_to) << "s";
@ -870,18 +837,22 @@ void ExtractionContainers::PrepareRestrictions()
BOOST_ASSERT(
way_start_and_end_iterator->way_id ==
OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.to.way)});
const OSMNodeID via_node_id = OSMNodeID{restrictions_iterator->restriction.via.node};
const OSMNodeID via_osm_node_id =
OSMNodeID{restrictions_iterator->restriction.via.node};
// assign new via node id
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id);
BOOST_ASSERT(via_id_iter != external_to_internal_node_id_map.end());
restrictions_iterator->restriction.via.node = via_id_iter->second;
const auto via_node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(), used_node_id_list.end(), via_osm_node_id);
BOOST_ASSERT(via_node_id != SPECIAL_NODEID);
restrictions_iterator->restriction.via.node = via_node_id;
if (way_start_and_end_iterator->first_segment_source_id == via_node_id)
if (way_start_and_end_iterator->first_segment_source_id == via_osm_node_id)
{
auto to_id_iter = external_to_internal_node_id_map.find(
const auto to_node_id = mapExternalToInternalNodeID(
used_node_id_list.begin(),
used_node_id_list.end(),
way_start_and_end_iterator->first_segment_target_id);
if (to_id_iter == external_to_internal_node_id_map.end())
if (to_node_id == SPECIAL_NODEID)
{
util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->first_segment_source_id;
@ -890,13 +861,15 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator;
continue;
}
restrictions_iterator->restriction.to.node = to_id_iter->second;
restrictions_iterator->restriction.to.node = to_node_id;
}
else if (way_start_and_end_iterator->last_segment_target_id == via_node_id)
else if (way_start_and_end_iterator->last_segment_target_id == via_osm_node_id)
{
auto to_id_iter = external_to_internal_node_id_map.find(
const auto to_node_id =
mapExternalToInternalNodeID(used_node_id_list.begin(),
used_node_id_list.end(),
way_start_and_end_iterator->last_segment_source_id);
if (to_id_iter == external_to_internal_node_id_map.end())
if (to_node_id == SPECIAL_NODEID)
{
util::Log(logDEBUG) << "Way references invalid node: "
<< way_start_and_end_iterator->last_segment_source_id;
@ -905,7 +878,7 @@ void ExtractionContainers::PrepareRestrictions()
++way_start_and_end_iterator;
continue;
}
restrictions_iterator->restriction.to.node = to_id_iter->second;
restrictions_iterator->restriction.to.node = to_node_id;
}
else
{

View File

@ -88,10 +88,7 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
// handle travel modes:
const auto in_mode = node_based_graph.GetEdgeData(via_edge).travel_mode;
const auto out_mode = node_based_graph.GetEdgeData(road.eid).travel_mode;
const auto in_classes = node_based_graph.GetEdgeData(via_edge).classes;
const auto out_classes = node_based_graph.GetEdgeData(road.eid).classes;
// if we just lose class flags we don't want to notify
const auto needs_notification = in_mode != out_mode || !isSubset(out_classes, in_classes);
const auto needs_notification = in_mode != out_mode;
if (type == TurnType::Turn)
{

View File

@ -118,6 +118,9 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
const auto getContinueAngle = [this, in_data](const Intersection &intersection) {
for (const auto &road : intersection)
{
if (!road.entry_allowed)
continue;
const auto &out_data = node_based_graph.GetEdgeData(road.eid);
const auto same_name = !util::guidance::requiresNameAnnounced(

View File

@ -129,19 +129,16 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
{
lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier],
lane_data[none_index].from,
lane_data[none_index].from,
false});
lane_data[none_index].from});
}
lane_data.push_back({tag_by_modifier[straight_itr->instruction.direction_modifier],
lane_data[none_index].from,
lane_data[none_index].to,
false});
lane_data[none_index].to});
for (auto itr = straight_itr + 1; itr != intersection_range_end; ++itr)
{
lane_data.push_back({tag_by_modifier[itr->instruction.direction_modifier],
lane_data[none_index].to,
lane_data[none_index].to,
false});
lane_data[none_index].to});
}
lane_data.erase(lane_data.begin() + none_index);
@ -158,8 +155,7 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
lane_data.push_back({tag_by_modifier[intersection[intersection_index]
.instruction.direction_modifier],
lane_data[none_index].from,
lane_data[none_index].to,
false});
lane_data[none_index].to});
}
}
lane_data.erase(lane_data.begin() + none_index);

View File

@ -107,7 +107,7 @@ LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description
LaneDataVector lane_data;
lane_data.reserve(lane_map.size());
for (const auto &tag : lane_map)
lane_data.push_back({tag.first, tag.second.first, tag.second.second, false});
lane_data.push_back({tag.first, tag.second.first, tag.second.second});
std::sort(lane_data.begin(), lane_data.end());

View File

@ -279,7 +279,7 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
// FIXME the lane to add depends on the side of driving/u-turn rules in the country
if (!lane_data.empty() && canMatchTrivially(intersection, lane_data) &&
is_missing_valid_u_turn && !hasTag(TurnLaneType::none, lane_data))
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to, false});
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to});
bool is_simple = isSimpleIntersection(lane_data, intersection);
@ -644,8 +644,6 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
if (lane == straightmost_tag_index)
{
augmentEntry(turn_lane_data[straightmost_tag_index]);
// disable this turn for assignment if it is a -use lane only
turn_lane_data[straightmost_tag_index].suppress_assignment = true;
}
if (matched_at_first[lane])
@ -657,7 +655,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
std::count(matched_at_second.begin(), matched_at_second.end(), true)) ==
getNumberOfTurns(next_intersection))
{
TurnLaneData data = {TurnLaneType::straight, 255, 0, true};
TurnLaneData data = {TurnLaneType::straight, 255, 0};
augmentEntry(data);
first.push_back(data);
std::sort(first.begin(), first.end());

View File

@ -87,7 +87,7 @@ bool isValidMatch(const TurnLaneType::Mask tag, const TurnInstruction instructio
TurnType::Continue && // Forks can be experienced, even for straight segments
(instruction.direction_modifier == DirectionModifier::SlightLeft ||
instruction.direction_modifier == DirectionModifier::SlightRight)) ||
instruction.type == TurnType::UseLane;
instruction.type == TurnType::Suppressed;
}
else if (tag == TurnLaneType::slight_left || tag == TurnLaneType::left ||
tag == TurnLaneType::sharp_left)
@ -250,10 +250,6 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
BOOST_ASSERT(findBestMatch(lane_data[lane].tag, intersection) ==
intersection.begin() + road_index);
if (TurnType::Suppressed == intersection[road_index].instruction.type &&
!lane_data[lane].suppress_assignment)
intersection[road_index].instruction.type = TurnType::UseLane;
matchRoad(intersection[road_index], lane_data[lane]);
++lane;
}

View File

@ -176,7 +176,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"enter_and_exit_roundabout_intersection",
extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection,
"use_lane",
extractor::guidance::TurnType::UseLane,
extractor::guidance::TurnType::Suppressed,
"no_turn",
extractor::guidance::TurnType::NoTurn,
"suppressed",

View File

@ -366,6 +366,16 @@
"value": "circular",
"description": "A Roundabout where the traffic on the roundabout not always has right of way."
},
{
"key": "proposed",
"object_types": [ "way" ],
"description": "Proposed ways. Discarded for routing"
},
{
"key": "construction",
"object_types": [ "way" ],
"description": "Ways under construction. Discarded for routing except construction=no, construction=widening"
},
{
"key": "type",
"value": "restriction",

View File

@ -98,6 +98,37 @@ test('constructor: throws if data doesn\'t match algorithm', function(assert) {
assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); });
});
test('constructor: parses custom limits', function(assert) {
assert.plan(1);
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_locations_trip: 1,
max_locations_viaroute: 1,
max_locations_distance_table: 1,
max_locations_map_matching: 1,
max_results_nearest: 1,
max_alternatives: 1,
});
assert.ok(osrm);
});
test('constructor: throws on invalid custom limits', function(assert) {
assert.plan(1);
assert.throws(function() {
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_locations_trip: 'unlimited',
max_locations_viaroute: true,
max_locations_distance_table: false,
max_locations_map_matching: 'a lot',
max_results_nearest: null,
max_alternatives: '10'
})
});
});
require('./route.js');
require('./trip.js');
require('./match.js');

View File

@ -549,3 +549,30 @@ test('route: throws on bad approaches', function(assert) {
}, function(err, route) {}) },
/Approach must be a string: \[curb, unrestricted\] or null/);
});
test('route: routes Monaco with custom limits on MLD', function(assert) {
assert.plan(2);
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_alternatives: 10,
});
osrm.route({coordinates: two_test_coordinates, alternatives: 10}, function(err, route) {
assert.ifError(err);
assert.ok(Array.isArray(route.routes));
});
});
test('route: in Monaco with custom limits on MLD', function(assert) {
assert.plan(1);
var osrm = new OSRM({
path: monaco_mld_path,
algorithm: 'MLD',
max_alternatives: 10,
});
osrm.route({coordinates: two_test_coordinates, alternatives: 11}, function(err, route) {
console.log(err)
assert.equal(err.message, 'TooBig');
});
});

View File

@ -23,6 +23,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
IntermediateIntersection::NO_INDEX,
0,
{0, 255},
{},
{}};
IntermediateIntersection intersection2{{FloatLongitude{-73.981495}, FloatLatitude{40.768275}},
{180},
@ -30,6 +31,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0,
IntermediateIntersection::NO_INDEX,
{0, 255},
{},
{}};
// Check that duplicated coordinate in the end is removed
@ -53,8 +55,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0},
0,
3,
{intersection1},
{}},
{intersection1}},
{324,
"Central Park West",
"",
@ -75,8 +76,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0},
2,
3,
{intersection2},
{}}};
{intersection2}}};
LegGeometry geometry;
geometry.locations = {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},

View File

@ -5,7 +5,7 @@
#include <boost/test/unit_test.hpp>
#include <numeric>
#include <stxxl/vector>
#include <vector>
BOOST_AUTO_TEST_SUITE(range_table)
@ -15,7 +15,7 @@ using namespace osrm::util;
constexpr unsigned BLOCK_SIZE = 16;
typedef RangeTable<BLOCK_SIZE, osrm::storage::Ownership::Container> TestRangeTable;
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets)
void ConstructionTest(std::vector<unsigned> lengths, std::vector<unsigned> offsets)
{
BOOST_ASSERT(lengths.size() == offsets.size() - 1);
@ -29,7 +29,7 @@ void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> off
}
}
void ComputeLengthsOffsets(stxxl::vector<unsigned> &lengths,
void ComputeLengthsOffsets(std::vector<unsigned> &lengths,
std::vector<unsigned> &offsets,
unsigned num)
{
@ -54,12 +54,12 @@ void ComputeLengthsOffsets(stxxl::vector<unsigned> &lengths,
BOOST_AUTO_TEST_CASE(construction_test)
{
// only offset empty block
stxxl::vector<unsigned> empty_lengths;
std::vector<unsigned> empty_lengths;
empty_lengths.push_back(1);
ConstructionTest(empty_lengths, {0, 1});
// first block almost full => sentinel is last element of block
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, (16)}
stxxl::vector<unsigned> almost_full_lengths;
std::vector<unsigned> almost_full_lengths;
std::vector<unsigned> almost_full_offsets;
ComputeLengthsOffsets(almost_full_lengths, almost_full_offsets, BLOCK_SIZE);
ConstructionTest(almost_full_lengths, almost_full_offsets);
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(construction_test)
// first block full => sentinel is offset of new block, next block empty
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
// [(153)] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
stxxl::vector<unsigned> full_lengths;
std::vector<unsigned> full_lengths;
std::vector<unsigned> full_offsets;
ComputeLengthsOffsets(full_lengths, full_offsets, BLOCK_SIZE + 1);
ConstructionTest(full_lengths, full_offsets);
@ -75,13 +75,13 @@ BOOST_AUTO_TEST_CASE(construction_test)
// first block full and offset of next block not sentinel, but the first differential value
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
// [153] {(17), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
stxxl::vector<unsigned> over_full_lengths;
std::vector<unsigned> over_full_lengths;
std::vector<unsigned> over_full_offsets;
ComputeLengthsOffsets(over_full_lengths, over_full_offsets, BLOCK_SIZE + 2);
ConstructionTest(over_full_lengths, over_full_offsets);
// test multiple blocks
stxxl::vector<unsigned> multiple_lengths;
std::vector<unsigned> multiple_lengths;
std::vector<unsigned> multiple_offsets;
ComputeLengthsOffsets(multiple_lengths, multiple_offsets, (BLOCK_SIZE + 1) * 10);
ConstructionTest(multiple_lengths, multiple_offsets);