Compare commits

..

333 Commits

Author SHA1 Message Date
Patrick Niklaus 71eae4137d [skip ci] Update changelog 2016-06-13 17:27:53 +02:00
Moritz Kobitzsch 47b19f209b prefer obvious turn assignment over forks 2016-06-13 15:00:18 +02:00
Moritz Kobitzsch 2b5355edca improve slipway handling to allow multiple styles of turn lanes / turn roads 2016-06-13 11:56:50 +02:00
Patrick Niklaus e9a0beb4e8 Fix shared memory encoding for node-ids 2016-06-12 20:50:57 +02:00
Vladimir Kurchatkin 6bdfe68897 Add feature name to vector tiles (#2488) 2016-06-10 11:15:14 -07:00
Daniel J. Hofmann cf2d2b6763 Boost.Test Testing Docs 2016-06-10 19:03:44 +02:00
Moritz Kobitzsch 95cd44f34f add directions guide 2016-06-10 19:03:44 +02:00
Moritz Kobitzsch d330e60d40 added a guide on writing good cucumber tests for osrm 2016-06-10 19:03:44 +02:00
Moritz Kobitzsch 99004bbec8 add testcase 2016-06-10 10:20:39 +02:00
Emil Tin bbcc728a07 Update http.md
clarify "new name" instruction
2016-06-10 09:42:13 +02:00
Daniel J. Hofmann 033dc0a72d Pre-allocate up-front whenever possible 2016-06-09 16:06:27 +02:00
Patrick Niklaus 1c140a112a Make sure we also reserve space for destination and pronunciation 2016-06-08 10:58:11 +02:00
Moritz Kobitzsch 312e86eb58 handle merge on collapsed instructions 2016-06-06 11:55:14 +02:00
Moritz Kobitzsch 1dfdb38d4a improve collapse-handling 2016-06-06 10:05:18 +02:00
Dane Springmeyer dfafe7dc5f Install clang-3.8 via mason binary 2016-06-04 12:15:29 +02:00
Dane Springmeyer 6ecc123d15 Fix various issues with pkg-config 2016-06-04 12:08:54 +02:00
Daniel J. Hofmann 6f322d2140 Silence multiline comment warning 2016-06-03 14:47:45 +02:00
Daniel J. Hofmann dfa762bccc Pronunciation.
Spelling is hard. Maybe this time. /cc @themarex @systemed
2016-06-02 16:35:21 +02:00
Daniel J. Hofmann 87f00d2c4c Restrict CMake version to 2.8.11+ for target_include_directories 2016-06-02 16:07:29 +02:00
Daniel J. Hofmann 6f94e0dfb8 Update the Changelog for v5.2.0-rc2 2016-06-02 15:22:56 +02:00
Daniel J. Hofmann ad70759f91 Revert "Handle small roundabouts, fixes #516."
This reverts commit 7641b12b08.

Conflicts:
	profiles/bicycle.lua
	profiles/car.lua
2016-06-02 15:08:24 +02:00
Daniel J. Hofmann 27c4e8ddd0 Revert "Adds tag to taginfo"
This reverts commit 14fdf861ca.
2016-06-02 15:00:50 +02:00
Daniel J. Hofmann 805d74b6ae Revert "Fixes roundabout spelling in existing cucumber test"
This reverts commit ef7b36da32.
2016-06-02 15:00:49 +02:00
Daniel J. Hofmann 4ad78309e2 Revert "Set speeds for mini roundabouts in car and bike profile"
This reverts commit a85f39c140.
2016-06-02 15:00:47 +02:00
Daniel J. Hofmann b78207ddd8 Revert "Add implied oneway cucumber tests for mini roundabouts"
This reverts commit bd707b0cfc.

Conflicts:
	features/bicycle/oneway.feature
	features/car/oneway.feature
2016-06-02 15:00:44 +02:00
Daniel J. Hofmann b6834da9a4 Revert "Test guidance instructions for entering and leaving mini roundabouts"
This reverts commit 9cdc9008aa.
2016-06-02 14:57:48 +02:00
Daniel J. Hofmann 801cc72691 Sync with Clang38 Format 2016-06-02 14:43:27 +02:00
Patrick Niklaus e198709643 Add documentation about nodes property 2016-06-02 14:28:33 +02:00
Patrick Niklaus ed8d5e0b0a Add missing semicolon 2016-06-02 14:27:25 +02:00
Lauren Budorick e8fb312703 Update OSM node IDs annotation cucumber code per d6de2ca71c 2016-06-02 14:27:25 +02:00
Lauren Budorick 058b8c3b31 Template vector 2016-06-02 14:27:25 +02:00
Lauren Budorick ae3ccb009e Formatting [ci skip] 2016-06-02 14:27:25 +02:00
Lauren Budorick 0c60a2aef8 Minor cleanups + comments 2016-06-02 14:27:25 +02:00
Lauren Budorick 44fdf86702 IT WORKS 2016-06-02 14:27:25 +02:00
Lauren Budorick 1659bbf7b1 Refining packed_vector.hpp
* Rename to std::vector-like APIs (push_back, at)
* Add size, reserve, capacity methods
2016-06-02 14:27:25 +02:00
Lauren Budorick 46b58fba83 Packed vector cleanups and unit test 2016-06-02 14:27:25 +02:00
Lauren Budorick 84da86ba4a Add packed vector sketch 2016-06-02 14:27:25 +02:00
Lauren Budorick 6777127497 Add cucumber tests for node IDs 2016-06-02 14:27:25 +02:00
Lauren Budorick a4ac07866a Recreate feature/expose_node_ids 2016-06-02 14:27:25 +02:00
Daniel J. Hofmann 448f8377fb Sync with Clang38 Format 2016-06-02 13:14:33 +02:00
Daniel J. Hofmann c490752ca7 highway=motorway_link does not imply oneway, fixes #1662
References:
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway_link#Tagging_oneway
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway_link
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway
2016-06-02 13:05:50 +02:00
Daniel J. Hofmann 6edc565c01 Add destinations API feature 2016-06-02 12:00:23 +02:00
Daniel J. Hofmann bb0c2754d3 With empty summaries no longer the case, update library tests accordingly 2016-06-02 00:26:04 +02:00
Moritz Kobitzsch 58d6e8f4d0 handle short summaries correctly 2016-06-02 00:26:04 +02:00
Moritz Kobitzsch bdc66049a5 fix INVALID_NAME_ID vs INVALID_NAMEID -> EMPTY_NAMEID 2016-06-01 23:19:26 +02:00
Patrick Niklaus 0a53775fb3 Expose pronunciation in RouteStep
Uses name:pronunciation by default for cars.
2016-06-01 23:17:57 +02:00
Daniel J. Hofmann 9cdc9008aa Test guidance instructions for entering and leaving mini roundabouts 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann bd707b0cfc Add implied oneway cucumber tests for mini roundabouts 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann a85f39c140 Set speeds for mini roundabouts in car and bike profile 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann ef7b36da32 Fixes roundabout spelling in existing cucumber test 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann 14fdf861ca Adds tag to taginfo 2016-06-01 20:17:48 +02:00
Daniel J. Hofmann 7641b12b08 Handle small roundabouts, fixes #516.
This gives us ~51k additional roundabout instructions.
Guidance handes sizes internally.

Note: it is highway=mini_roundabout but junction=roundabout

References:
- http://wiki.openstreetmap.org/wiki/Tag:highway%3Dmini_roundabout
- http://wiki.openstreetmap.org/wiki/Tag:junction=roundabout
- http://taginfo.openstreetmap.org/tags/highway=mini_roundabout
2016-06-01 20:17:48 +02:00
Daniel J. Hofmann e7159adf59 Switching off any LLVM APT references as servers are no longer available
References:
- http://lists.llvm.org/pipermail/llvm-foundation/2016-June/000025.html
2016-06-01 20:04:52 +02:00
Daniel J. Hofmann 51f08f2994 Let's still show the badge although we dropped support for Windows
This reverts commit a03eac8e48.
2016-06-01 19:22:31 +02:00
Daniel J. Hofmann a03eac8e48 Remove Windows Build Badge from Readme 2016-06-01 15:37:16 +02:00
Daniel J. Hofmann 503137221d Let osrm-routed log status code, fixes #512.
Disclaimer: osrm-routed is not recommended for production usage.
Use node-osrm instead: https://github.com/Project-OSRM/node-osrm
2016-05-31 14:44:50 +02:00
Patrick Niklaus fb9205bf81 Merge pull request #2476 from oxidase/refactor/2472
Refactor ramIndex #2472
2016-05-31 03:00:47 -04:00
Michael Krasnyk bfbb313088 Conditional hashing of osrm libraries 2016-05-29 07:39:49 +02:00
Michael Krasnyk 25d3c4b843 Updated change log and adjusted format 2016-05-29 07:39:49 +02:00
Michael Krasnyk 371c06d66d Change size of QueryCandidate from 32 to 24 bytes 2016-05-29 07:39:49 +02:00
Michael Krasnyk 3e5c978719 Reduce ramIndex file size
PR #2472: the bottom-most node of the r-tree contains
only a single index to a leaf node, so out of 532 bytes
only 4 are used.
2016-05-29 07:39:49 +02:00
Michael Krasnyk 843f1a6356 Set LeafNode alignment to LEAF_PAGE_SIZE bytes
References:
- https://github.com/Project-OSRM/osrm-backend/pull/2348#issuecomment-219804408
- http://stackoverflow.com/questions/15523537/alignas-specifier-vs-attribute-aligned-c11
- http://stackoverflow.com/questions/7895869/cross-platform-alignx-macro
2016-05-29 07:39:49 +02:00
Dane Springmeyer a5c5faa21d drop support for using DYLD_LIBRARY_PATH on OS X 2016-05-29 06:01:16 +02:00
Patrick Niklaus 6a1e17c6fa Print TBB version in FindTBB 2016-05-29 00:06:45 +02:00
Patrick Niklaus cd30f370b8 Remove the use of atomics and use thread-local accumulation instead 2016-05-29 00:06:18 +02:00
Dane Springmeyer 4ae8abe6a3 run clang-format [skip ci] 2016-05-27 22:35:17 +02:00
Dane Springmeyer 82bfd4ee40 fix compile with clang-3.5 2016-05-27 22:35:17 +02:00
Patrick Niklaus e08c4cff13 Make PRs fail if they don't adhere to our style format 2016-05-27 21:05:43 +02:00
Patrick Niklaus 6e16eab6ec Format with clang-format 3.8 2016-05-27 21:05:04 +02:00
Patrick Niklaus 21c47514da Update clang-format to 3.8 2016-05-27 17:45:00 +02:00
Patrick Niklaus d6de2ca71c Really place annotations in RouteLeg and not Route 2016-05-27 16:46:28 +02:00
Dane Springmeyer 451a0d9090 try caching test data on travis 2016-05-27 00:40:49 +02:00
Patrick Niklaus 262354f733 Rename annotate to annotations 2016-05-26 23:35:11 +02:00
Daniel J. Hofmann 498370330d String bulk insertion 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann 6865853776 Not everything is a NodeID! 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann 1418c0dbbc Move ExtractionWays and ExtractionNodes into container to avoid copying 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann bbc79dd49f ExtractionContainers already owns its data 2016-05-26 22:50:17 +02:00
Daniel J. Hofmann 8036320d94 Do not bind primitives per ref 2016-05-26 22:50:17 +02:00
Patrick Niklaus c30f69d6e9 Fix breaking test uncovered by this fix 2016-05-26 22:34:39 +02:00
Patrick Niklaus 2e2f34f241 Fix retry code launch classes 2016-05-26 22:34:39 +02:00
Lauren Budorick cbbeef5c46 Prune unnecessary cucumber code 2016-05-26 22:34:39 +02:00
Moritz Kobitzsch 823ee54f22 add turn restrictions to test-cases 2016-05-26 21:31:04 +02:00
Daniel Patterson 3d03797e53 Distinguish between offramps and sliproads. 2016-05-26 21:31:04 +02:00
Patrick Niklaus 089e60fa1e Remove obsolete timer code 2016-05-26 20:25:33 +02:00
Patrick Niklaus baf8e4784b Transfer match benchmark to own binary 2016-05-26 20:25:33 +02:00
Moritz Kobitzsch d53350b263 be more verbose on broken configs 2016-05-26 20:04:24 +02:00
Patrick Niklaus 824afdceca use 5 seconds as cucumber timeout 2016-05-26 20:02:21 +02:00
Patrick Niklaus a8230e976f Merge pull request #2454 from oxidase/reset-force-flags
Remove force flags and update extract/contract hashes with arguments
2016-05-26 13:16:29 -04:00
Michael Krasnyk 6af7e6866c Sort file extensions in rename lists 2016-05-26 17:05:11 +02:00
Michael Krasnyk aaa27333ba Remove force flags and update extractor/contractor hashes
with command line arguments and argument files data.
2016-05-26 16:36:26 +02:00
Moritz Kobitzsch 797f2a196b handle intersection-access for roundabout correctly 2016-05-26 16:25:26 +02:00
Moritz Kobitzsch 51066ff18f fix options in step-definitions 2016-05-26 15:38:55 +02:00
Dane Springmeyer 4de64a92cb fix zlib linking order 2016-05-25 09:32:27 -04:00
Freenerd a21fd2ea18 Contractor: log stats for loaded speed files 2016-05-24 14:35:16 -04:00
Patrick Niklaus 0df0b4305d Merge pull request #2453 from Project-OSRM/cmake-from-mason
[Travis] Install cmake from more reliable s3 endpoint
2016-05-24 14:32:45 -04:00
Dane Springmeyer a5ed53e7aa install cmake from mason / simplify install 2016-05-24 13:35:13 -04:00
Daniel Patterson 0587c5f5c4 Trim datasource names before writing to datafile. 2016-05-24 15:20:14 +02:00
Patrick Niklaus 57dbb18c4c Merge pull request #2451 from Project-OSRM/disable-osx-spotlight
[Travis] Disable spotlight indexing on osx to speed up 'npm test'
2016-05-24 09:10:35 -04:00
Dane Springmeyer 4d92f08424 disable spotlight indexing on osx to speed up 'npm test' 2016-05-23 19:35:22 -04:00
Patrick Niklaus 254ee07942 Add new sanity check assertions to UnpackPath 2016-05-23 23:15:15 +02:00
Patrick Niklaus 0bf8bd2230 Remove invalid assertion.
This ports the matching change from RoutingBase.
2016-05-23 23:15:15 +02:00
Michael Krasnyk b5225f07cb Fix #2413 by converting enums to unsigned char constants 2016-05-23 18:33:24 +02:00
Moritz Kobitzsch abed7690d0 fix continue on obvious 2016-05-23 17:55:30 +02:00
Patrick Niklaus f96174ddbe Merge pull request #2428 from zimathias/disable-access-logging-option
Disable access logging option
2016-05-23 10:12:42 -04:00
Mathias Gug e5b713841a Fix style. 2016-05-20 12:47:47 -07:00
Mathias Gug 3b1b12069f Add changelog entry. 2016-05-20 12:47:47 -07:00
Mathias Gug 1635f7351d Support environment variable to disable http requests logging. 2016-05-20 12:47:47 -07:00
Daniel J. Hofmann ce5ae411c1 Resurrect Flat Map + Binary Search commit from PR 2412 2016-05-20 20:43:45 +02:00
Patrick Niklaus d1bc32fb31 Add comments and debug code 2016-05-20 18:52:29 +02:00
Patrick Niklaus f9f87f25d4 Use elogate() to fixup geometry when merging steps, fixes #2424 2016-05-20 18:52:29 +02:00
Patrick Niklaus 89aa6b7881 Add regression test for #2424 2016-05-20 18:52:29 +02:00
Patrick Niklaus edf9e0c1ed [skip ci] Update changelog and OSRM version 2016-05-20 18:52:00 +02:00
Dane Springmeyer c2e520ad9d Fix linking of osrm-example to boost_iostreams
Fixes linking error seen on OS X:

```
[ 50%] Linking CXX executable osrm-example
/Users/dane/.homebrew/Cellar/cmake/3.5.0/bin/cmake -E cmake_link_script CMakeFiles/osrm-example.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -std=c++11  -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/osrm-example.dir/example.cpp.o  -o osrm-example  /Users/dane/projects/osrm-backend/here/lib/libOSRM.a /Users/dane/.homebrew/lib/libboost_filesystem-mt.dylib /Users/dane/.homebrew/lib/libboost_system-mt.dylib /Users/dane/.homebrew/lib/libboost_thread-mt.dylib /Users/dane/.homebrew/lib/libboost_chrono-mt.dylib /Users/dane/.homebrew/lib/libboost_date_time-mt.dylib /Users/dane/.homebrew/lib/libboost_atomic-mt.dylib 
undef: __ZN5boost9iostreams18mapped_file_source9open_implERKNS0_24basic_mapped_file_paramsINS0_6detail4pathEEE
undef: __ZN5boost9iostreams18mapped_file_sourceC1Ev
undef: __ZNK5boost9iostreams18mapped_file_source4sizeEv
undef: __ZNK5boost9iostreams18mapped_file_source4dataEv
Undefined symbols for architecture x86_64:
  "boost::iostreams::mapped_file_source::open_impl(boost::iostreams::basic_mapped_file_params<boost::iostreams::detail::path> const&)", referenced from:
      void boost::iostreams::mapped_file_source::open<boost::filesystem::path>(boost::filesystem::path const&, unsigned long, long) in libOSRM.a(engine.cpp.o)
  "boost::iostreams::mapped_file_source::mapped_file_source()", referenced from:
      osrm::engine::datafacade::SharedDataFacade::CheckAndReloadFacade() in libOSRM.a(engine.cpp.o)
      osrm::engine::datafacade::InternalDataFacade::InternalDataFacade(osrm::storage::StorageConfig const&) in libOSRM.a(engine.cpp.o)
  "boost::iostreams::mapped_file_source::size() const", referenced from:
      osrm::engine::datafacade::SharedDataFacade::CheckAndReloadFacade() in libOSRM.a(engine.cpp.o)
      osrm::engine::datafacade::InternalDataFacade::InternalDataFacade(osrm::storage::StorageConfig const&) in libOSRM.a(engine.cpp.o)
  "boost::iostreams::mapped_file_source::data() const", referenced from:
      osrm::engine::datafacade::SharedDataFacade::CheckAndReloadFacade() in libOSRM.a(engine.cpp.o)
      osrm::engine::datafacade::InternalDataFacade::InternalDataFacade(osrm::storage::StorageConfig const&) in libOSRM.a(engine.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
2016-05-20 16:04:18 +02:00
Dane Springmeyer 7649187095 workaround boostorg/numeric_conversion#4 2016-05-20 16:03:19 +02:00
Dane Springmeyer fe39d0fd10 disable BOOST_TEST_DYN_LINK if Boost_USE_STATIC_LIBS 2016-05-20 00:03:37 -04:00
Patrick Niklaus 98b83b7208 Fix library test 2016-05-19 16:44:31 +02:00
Patrick Niklaus 57321979ae Remove leftover debugging code 2016-05-19 16:44:31 +02:00
Patrick Niklaus e3ce0c5887 Add fuzzy matching for bearings and intersections list 2016-05-19 16:44:31 +02:00
Patrick Niklaus 95af72c70c Make intersection backwards compatible
For `depart` and `arrive` `step.intersections[0].{bearings|entry}` will have
only one entry.
2016-05-19 16:44:31 +02:00
Patrick Niklaus 3b37769624 Use bearing_before and bearing_after in the bearings field 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch d150df1c5c format 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch a322e27e05 update changelog/docs 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 98fe0badbe fix loading in storage 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 44b841a25d fix storage 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 9c8bf820de adjusted to in/out. only emit one of them for depart/arrive 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 4d9aa65e78 intersection classes with variable degree of discretization 2016-05-19 16:44:31 +02:00
Moritz Kobitzsch 0f3942558f version using discrete values stored directly at intersection 2016-05-19 16:43:46 +02:00
Moritz Kobitzsch ba074b0116 initial version of intersection classification 2016-05-19 16:43:46 +02:00
Daniel J. Hofmann 6aa97048df Rip out custom CSV parser code and its third_party dependency 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann d9a5c79ea6 Map leaf nodes to RAM and iterate over them potentially in parallel 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 9d7714c714 Make looping through all leaf nodes less confusing 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 8291be375a Expose concurrency in saving files 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 0a73737f69 Fold parsing and data loading in concurrently executing action 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 2fd1b6c913 Expose concurrency between intern/external node map and geometries 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann ea38a1d880 Parse multiple files concurrently 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann f576e13c51 Concurrent lookup hashtables 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann ee7bb8731a Expose concurrency between segment speeds and turn penalties 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann da0c3ff394 Refactor edge weight parsing code 2016-05-19 00:01:54 +02:00
Daniel J. Hofmann 6ae559b42b Throw error if edge based graph file could not be loaded 2016-05-19 00:01:54 +02:00
Mathias Gug 95ca6ebdaa Update CHANGELOG entry. 2016-05-18 23:59:52 +02:00
Mathias Gug 0d6964d9c8 Add CHANGELOG entry. 2016-05-18 23:59:52 +02:00
Mathias Gug ba386d4b2c Document environment variable. 2016-05-18 23:59:52 +02:00
Mathias Gug b5ffb51e18 Signal the parent process when we're ready to serve requests.
This can be used for a hot reload of the process binary. The supervising
process can be told when the new process is ready to serve requests.
2016-05-18 23:59:52 +02:00
Moritz Kobitzsch a9f674497a emit turn-straight for obvious turns where the main road continues 2016-05-18 19:54:53 +02:00
Patrick Niklaus 1e8a92ccb4 Add changelog entry 2016-05-18 19:16:44 +02:00
Mathias Gug b9178bb8c7 Fix build on windows. 2016-05-18 19:13:18 +02:00
Mathias Gug 520b29d0d5 Use const for option. Include proper header files. 2016-05-18 19:13:18 +02:00
Mathias Gug fe397e6953 Support SO_REUSEPORT option
so that multiple osrm-routed processes can bind to the same port.
2016-05-18 19:13:18 +02:00
Patrick Niklaus dcb741d827 Merge pull request #2403 from oxidase/refactor/duration-parser
Refactoring of iso_8601_grammar
2016-05-17 12:26:28 -04:00
Michael Krasnyk 508c205d35 Refactoring of iso_8601_grammar
* formats 'hh:mm:ss' and ISO 8601 are merged into one grammar.
* iso_8601_grammar is changed to static const.
* iso_8601_grammar supports formats P[n]DT[n]H[n]M[n]S, P[n]W,
  and part of alternative PTHHMMSS and extended PTHH:MM:SS formats.
2016-05-17 00:39:32 +02:00
Daniel J. Hofmann d5294bb5d0 Silences warnings when running npm test 2016-05-16 14:43:54 -04:00
Patrick Niklaus 6ed9be31ca Merge pull request #2408 from oxidase/master
Remove latitude rounding in yToLat
2016-05-16 17:04:49 +02:00
Michael Krasnyk 3bbd3a8a65 Remove latitude rounding in yToLat 2016-05-16 00:53:33 +02:00
Daniel Patterson 73a608895a Merge pull request #2402 from Project-OSRM/fix_docker
Remove Ruby from docker setup, use Node.
2016-05-13 13:38:10 -07:00
Daniel Patterson 96c73baeb3 Remove Ruby from docker setup, use Node. 2016-05-13 12:32:36 -07:00
Patrick Niklaus 73113f5eb8 Fix codecov.yml 2016-05-12 17:56:40 +02:00
Patrick Niklaus 7b74b86891 Add codecov file 2016-05-12 01:17:16 +02:00
Daniel Patterson 0903b8227f Example of the annotation response value. 2016-05-12 01:11:09 +02:00
Daniel Patterson fa525ad610 Return an array with meta-data for each coordinate.
Currently supports duration and distance for each coordinate.

This is particularly useful in map-matching, comparing how
a trip progresses compared to a real GPS trace that is
map-matched.
2016-05-12 01:11:09 +02:00
Daniel J. Hofmann 0f2bb5dde5 Disable builing components tool by default until GDAL 2 compatibility #1738 lands 2016-05-12 00:25:18 +02:00
Patrick Niklaus 84dc1b6845 [skip ci] Use codecov badge 2016-05-11 22:45:07 +02:00
Patrick Niklaus 4ce1a37772 Limit osrm-extact to 3 jobs because OOM 2016-05-11 22:43:26 +02:00
Patrick Niklaus 8dd4cc5c40 Integrate codecov 2016-05-11 22:43:18 +02:00
Patrick Niklaus 6aed145dae [skip ci] Rephrased the API docs in terms of adding new types 2016-05-09 18:39:30 +02:00
Patrick Niklaus d15cc77b0b Merge pull request #2386 from oxidase/rtree-optimize-addition
Missing two commits in StaticRTree changes
2016-05-08 14:20:59 +02:00
Michael Krasnyk 24a75d37fb Approximate inverse Gudermannian function by a Padé approximant 2016-05-08 06:00:21 +02:00
Michael Krasnyk 7e80dae59b Fix MSVS build. 2016-05-08 06:00:21 +02:00
Patrick Niklaus 7316c48e9f Changelog entry for StaticRTree changes 2016-05-07 23:52:11 +02:00
Patrick Niklaus c520c7a24a Fix rtree benchmark 2016-05-07 23:52:11 +02:00
Patrick Niklaus 7564633045 Update SearchInBox to not copy TreeNode 2016-05-07 23:52:11 +02:00
Patrick Niklaus 7174c5d036 Make StaticRTree and facades const 2016-05-07 23:52:11 +02:00
Patrick Niklaus ddd128ce0e Only use const-ref for coordinate vector 2016-05-07 23:52:11 +02:00
Patrick Niklaus f5aa5c0769 Don't wrap StaticRTree in thread-specfic ptr 2016-05-07 23:52:11 +02:00
Michael Krasnyk 2acde49f0f Make LeafNode aligned to memory pages.
Changes:
* LeafNode is aligned to LEAF_PAGE_SIZE.
  Alignment brings 24 bytes memory overhead for 4096, but reduces
  cache misses rate.
* Unused m_element_count from leaf nodes file.
  The size is computed as m_leaves_region.size() / LEAF_PAGE_SIZE.
* Added try/catch for mmap exceptions messages.
2016-05-07 23:52:11 +02:00
Michael Krasnyk 8849015bbf Fix construct_multiple_levels_test
candidate_cache is removed because of failing test
make util-tests && ./unit_tests/util-tests --run_test=*/construct_multiple_levels_test
first bad commit: [9692be6f50] Add cache for CandidateSegments to reduce heap worke even more

Now SegmentIndex contains leaf index, object index and fixed_projected_coordinate
2016-05-07 23:52:11 +02:00
Michael Krasnyk 70cd7a94ec Fix memory mapping "Invalid argument" exception. 2016-05-07 23:52:11 +02:00
Patrick Niklaus 3984dea34b Use mmap in StaticRTree 2016-05-07 23:52:11 +02:00
Patrick Niklaus b11b471aa4 Move LoadLeafFromDisk to return by value 2016-05-07 23:52:11 +02:00
Patrick Niklaus 63754df4d4 Add cache for CandidateSegments to reduce heap worke even more 2016-05-07 23:52:11 +02:00
Patrick Niklaus e644424508 Only save TreeNode index in search tree x3 speedup 2016-05-07 23:52:11 +02:00
Patrick Niklaus 4f6eef3d16 Merge pull request #2376 from oxidase/fix/addition-to-2356
Addition to fix #2356
2016-05-07 12:47:28 +02:00
Michael Krasnyk e2e8104864 Addition to fix #2356
Updated unit tests for the Hint parser and
added emplacement of empty hints.
2016-05-07 09:47:32 +02:00
Patrick Niklaus 96127c289c Set OSX timeout to a minute 2016-05-06 10:36:40 +02:00
Patrick Niklaus cfed65f7ea Double timeout again 2016-05-05 21:07:38 +02:00
Patrick Niklaus c2263fec9b One TIMEOUT to rule them all 2016-05-05 18:36:30 +02:00
Patrick Niklaus 497720d060 Bump timeout and lower jobs on OSX 2016-05-05 17:12:22 +02:00
Patrick Niklaus 238366e71f Merge pull request #2373 from oxidase/master
Fix #2362 by using generic path strings
2016-05-05 15:57:51 +02:00
Michael Krasnyk 2c8cf26e74 Fix build break in MSVC
fatal error C1189: #error:  "This header can't be used in operating systems without XSI (System V) shared memory support"
2016-05-05 13:24:27 +02:00
Michael Krasnyk c87ae5612a Fix #2362 by using generic path strings
In windows native strings in Lua incorrectly
interpreted because native separators must be escaped.
Use of generic strings prevent use of backslashes and
"Generic paths are portable and independent of the operating system.".
2016-05-05 12:10:45 +02:00
Patrick Niklaus a2d83753bc Install ccmake on OSX 2016-05-05 11:39:15 +02:00
Patrick Niklaus eedf75d951 Correct path to test data 2016-05-04 20:44:05 +02:00
Patrick Niklaus 3f51a1ae2e Run tests from build directory 2016-05-04 19:46:27 +02:00
Patrick Niklaus a000f80705 [skip ci] Use 3 jobs on travis to utilize cores better 2016-05-04 19:39:52 +02:00
Patrick Niklaus 7030bff7f7 Fix typo in compiler name 2016-05-04 19:24:13 +02:00
Patrick Niklaus bb0b7fd2d1 Modify compiler name for ccache key 2016-05-04 19:22:43 +02:00
Patrick Niklaus 71e1f3679e Restructure travis run 2016-05-04 19:12:07 +02:00
Patrick Niklaus b33517b099 Remove pip from dependencies 2016-05-04 18:55:29 +02:00
Patrick Niklaus f3d5336892 Lint .travis.yml 2016-05-04 18:46:08 +02:00
Patrick Niklaus d81f25d54e Enable ccache compression 2016-05-04 18:42:47 +02:00
Patrick Niklaus 44ebdfeb2d [skip ci] Update changelog 2016-05-04 18:05:37 +02:00
Daniel J. Hofmann a5a7a03fa0 Cucumber test for destination:ref and no destination=* 2016-05-04 15:28:34 +02:00
Daniel J. Hofmann 363d2145bd Register a way's .nodes() function for use in the profile's way_function.
Can be used as in:

    function way_function(way, result)
      for node in way:get_nodes() do
        local id = node:id()
        io.write(">>> " .. id .. "\n")
      end

      -- ...
    end

Warning: we do not use libosmium's location cache, therefore .location()
on the nodes will crash at runtime. Once we switch to using libosmium's
cache this should work. Until then, you can use the node id now.
2016-05-04 15:28:34 +02:00
Daniel J. Hofmann c7e19396a4 Guard against mis-tagging: only use destination tag in combination with oneway tag 2016-05-04 15:28:34 +02:00
Daniel J. Hofmann 445e5bed49 Respect ';'-separated list in destination:ref tag 2016-05-04 15:28:34 +02:00
Daniel J. Hofmann 4cf94319df Basic destination sign handling.
This first part in our Exit Sign / Destination Sign quest re-wires
the `destination=` and `destination:ref=` tag to the `ref=` tag (in case
it's the highway does not already have a `ref=` tag).

Doing some analysis on both Berlin and San Francisco it looks like this
will add a couple of thousand `ref=` tags that we will announce in guidance.

References:
- https://github.com/Project-OSRM/osrm-backend/issues/2267#issuecomment-214771682
- http://wiki.openstreetmap.org/wiki/Key:destination
- http://wiki.openstreetmap.org/wiki/Proposed_features/Destination_details
2016-05-04 15:28:34 +02:00
Patrick Niklaus 1bb88b374e Make hint values optional, fixes issue 2356 2016-05-04 15:24:48 +02:00
Patrick Niklaus 35fac07581 Add failing test for empty hint 2016-05-04 15:24:48 +02:00
Patrick Niklaus 9287475b2a ccache needs language: cpp 2016-05-04 15:09:02 +02:00
Patrick Niklaus b4976f89f2 APT seems slow, try explicitly enabling 2016-05-04 14:27:44 +02:00
Patrick Niklaus 93c8674a40 Disable coverage builds since coveralls is broken 2016-05-04 14:02:11 +02:00
Moritz Kobitzsch d5f21fd13a fix test-case 2016-05-04 14:00:34 +02:00
Patrick Niklaus 04eef0463a Fix the second test that breaks because of phantom node 2016-05-04 14:00:34 +02:00
Patrick Niklaus 82c3bc7b0e Adapt tests to desired behaviour 2016-05-04 14:00:34 +02:00
Patrick Niklaus 1d33cb96f5 Fix missing semicolon in cucumber support code 2016-05-04 14:00:34 +02:00
Moritz Kobitzsch 648646068c additional testcase on what I would expect 2016-05-04 14:00:34 +02:00
Daniel Patterson f251f93a11 Fix summary generation when empty strings are present.
Also corrects step ordering when steps have equal durations.
2016-05-04 14:00:34 +02:00
Patrick Niklaus aab1aad8f4 Enable ccache 2016-05-04 13:54:04 +02:00
Patrick Niklaus 65a6dc704e Disable all release builds but one 2016-05-04 13:41:55 +02:00
Moritz Kobitzsch 6018fcf490 Introduce on_ramp and off_ramp, deprecate ramp 2016-05-04 12:09:54 +02:00
Moritz Kobitzsch 1e6888c0d3 fix new-name on empty strings 2016-05-04 10:52:55 +02:00
Patrick Niklaus c7303be33b [skip ci] Add specifics about how we interpret semver 2016-05-03 23:36:27 +02:00
Lauren Budorick d8acf76f2d Fix wrong assertion size in CompressedEdgeContainer::GetLastEdgeSourceID 2016-05-03 21:50:27 +02:00
Moritz Kobitzsch 08248e3853 fix 2349 2016-05-03 21:14:31 +02:00
Moritz Kobitzsch 78acc6f215 fix search with u-turn 2016-05-03 21:13:22 +02:00
Patrick Niklaus a4f1dc536d Trip plugin does not have a continue_straight parameter, use false 2016-05-03 21:13:22 +02:00
jperaltamalvar 57a30dd375 Remove more typename
Needed to compile con Windows
2016-05-03 16:00:44 +02:00
Daniel J. Hofmann 5517ee334f Remove typename prefix from non-dependent type alias
I think VS is predantic but actually right here.

References:
- http://eel.is/c++draft/namespace.udecl#19
2016-05-03 12:00:40 +02:00
Daniel J. Hofmann 30af544919 Changelog for street name assembly 2016-05-03 00:09:17 +02:00
Daniel J. Hofmann f0069d3dcc Makes bicycle and foot profile's name and ref tag handling consistent with car profile 2016-05-03 00:09:17 +02:00
Patrick Niklaus 206bdff9e7 Inline and vectorize haversine for GetPathDistance 2016-05-02 19:53:42 +02:00
Patrick Niklaus c32270b2b8 Make projectOnLine inline-able 2016-05-02 19:53:05 +02:00
Patrick Niklaus cc03402570 Use pass-by-copy for Coordinate 2016-05-02 19:51:32 +02:00
Patrick Niklaus 21a76f1867 Move coordinate constructors to header to enable inlining 2016-05-02 19:50:52 +02:00
Patrick Niklaus 212ad94c90 x2 speedup in Douglas Peucker by projecting all coordinates first 2016-05-02 19:50:33 +02:00
Patrick Niklaus 378d9f4112 Remove debug ouput from post-processing 2016-05-02 19:47:59 +02:00
Patrick Niklaus e341d367d8 Move detail:: to osrm::detail:: 2016-05-02 18:36:32 +02:00
Daniel J. Hofmann 98937b187f We require Visual Studio 2015+
References:
- https://github.com/Project-OSRM/osrm-backend/issues/2341#issuecomment-216231618
2016-05-02 17:50:54 +02:00
Moritz Kobitzsch 59168e21b4 remove unnecessary warnings, initialize correctly 2016-05-02 17:29:37 +02:00
Patrick Niklaus d12a95b4ef Fix naming convention of Percent 2016-05-02 17:25:58 +02:00
Patrick Niklaus 83482afa02 Fix naming conventions of TrajanSCC 2016-05-02 17:25:58 +02:00
Patrick Niklaus e470d1ae1c Fix naming convention in RasterSource 2016-05-02 17:25:58 +02:00
Patrick Niklaus e504128587 Fix naming convention in HiddenMarkovModell 2016-05-02 17:25:58 +02:00
Patrick Niklaus 1ab6c07bad Fix naming convention in BayesClassifier 2016-05-02 17:25:58 +02:00
Patrick Niklaus 5ce465ce23 Remove extra ; in PostProcessing 2016-05-02 17:25:58 +02:00
Patrick Niklaus a8b730576f Fix naming convention in GeospatialQuery 2016-05-02 17:25:58 +02:00
Patrick Niklaus b796033473 Clean up naming conventions in CRC32 code 2016-05-02 17:25:58 +02:00
Patrick Niklaus d078ed67ca Fix naming convention in GraphContractor 2016-05-02 17:25:58 +02:00
Lauren Budorick 346146d834 Address comments from b89164c14e (#2346) 2016-05-02 08:00:27 -07:00
Patrick Niklaus 64307ea882 Add missing headers and remove dead code 2016-04-29 20:02:08 +02:00
Patrick Niklaus 578eda7d28 [skip ci] Add release docs 2016-04-29 14:00:10 +02:00
Patrick Niklaus 505f4cb4a2 [skip ci] Add profile documentation 2016-04-29 13:10:43 +02:00
Patrick Niklaus bac6b729bf Overhault the README 2016-04-29 13:00:27 +02:00
Patrick Niklaus d3a5cadb6c [skip ci] Fix linkt to C++ library 2016-04-29 12:26:04 +02:00
Patrick Niklaus 65351faf83 [skip ci] Move correct docs. 2016-04-29 12:24:21 +02:00
Patrick Niklaus 3aa1c5f13c Link docs from README 2016-04-29 12:20:51 +02:00
Patrick Niklaus 8f3fe410b8 Import docs from the wiki 2016-04-29 12:16:19 +02:00
Patrick Niklaus ff3bf32b11 Merge pull request #2342 from Project-OSRM/publish-win-binaries
make AppVeyor publish binaries again
2016-04-29 11:16:27 +02:00
bergwerkgis 38cb01a30e [skip travis] make AppVeyor publish binaries again 2016-04-29 10:32:29 +02:00
Lauren Budorick b8f7569e93 Implement arbitrary turn penalty file IO and integration (#2306)
Closes #1830
2016-04-29 00:48:13 -07:00
Moritz Kobitzsch cf17bd38eb Revert "Revert "switched to space separated suffix/prefix only"" 2016-04-28 14:59:17 +02:00
Patrick Niklaus 930f6df2cb Fixes #2335, map matching was using shortest path with uturns disabled 2016-04-28 12:02:31 +02:00
Patrick Niklaus e88106e990 Revert "switched to space separated suffix/prefix only"
This reverts commit e9e935303c.
2016-04-27 23:20:10 +02:00
Patrick Niklaus 21f64c75eb Merge pull request #2324 from oxidase/master
Fix syntax error position indicators in parameters queries
2016-04-27 23:15:16 +02:00
Michael Krasnyk 5186b9490d Fix syntax error position indicators in parameters queries
To fix #2193 prefix_length member variable has been added to ParsedURL
that is set to the length of "/service/version/profile/" prefix
when the prefix is accepted by the parser.
Also BOOST_FUSION_ADAPT_STRUCT for osrm::server::api::ParsedURL
has been moved from header to url_parser.cpp to speed up compilation
of CUs that do not use the fusion adaption.
2016-04-27 19:52:23 +02:00
Moritz Kobitzsch e9e935303c switched to space separated suffix/prefix only 2016-04-27 19:12:24 +02:00
Moritz Kobitzsch a154d71841 enable suppression name suffix changes 2016-04-27 18:10:56 +02:00
Moritz Kobitzsch fddb035539 suppress name additions (xxx -> xxxbridge) 2016-04-27 12:13:42 +02:00
Moritz Kobitzsch 1544a08ea2 introduce roundabout-turns into instruction set 2016-04-27 12:13:42 +02:00
Moritz Kobitzsch 8d68d4c050 fix copy-paste errors in guidance tests 2016-04-26 13:43:22 +02:00
Moritz Kobitzsch 62a1290043 remove invalid assertion 2016-04-26 13:16:44 +02:00
Moritz Kobitzsch c5e1742150 fix post-processing for local paths, fixes #2310 2016-04-26 13:15:46 +02:00
Moritz Kobitzsch 754bc2d274 handle combined turns at segregated roads 2016-04-26 13:13:20 +02:00
Moritz Kobitzsch 3ac061c546 fix guidance issues / improve tests 2016-04-26 10:34:39 +02:00
Moritz Kobitzsch e59a7926a2 roundabout for segregated entry roads 2016-04-26 01:01:09 +02:00
Moritz Kobitzsch be5b49e391 Fix local path looping, fixes #2309 2016-04-25 19:37:59 +02:00
Moritz Kobitzsch 7b32d3184c remove unused instruction types 2016-04-25 19:24:59 +02:00
Moritz Kobitzsch d770c35245 refactor guidance 2016-04-25 19:24:59 +02:00
Daniel J. Hofmann e04baef3bb Do not copy geometries in loop 2016-04-25 12:12:32 +02:00
Patrick Niklaus 9d3ad22bc7 Fix path to monaco data 2016-04-25 00:46:36 +02:00
Patrick Niklaus cc35d15b2d More folds and reorder some build instructions 2016-04-25 00:19:48 +02:00
Patrick Niklaus 15e3928906 Merge pull request #2312 from oxidase/stateless-parameters-grammars
Stateless parameters grammars and fix for PhantomNode bitfields packing in MSVC
2016-04-24 23:45:51 +02:00
Michael Krasnyk 4363fd64c4 Fix for PhantomNode packing in MSVC
Changed bool to uint32_t in bit fields to have 4-byte packings for 32 bits:
"c++ compilers will allocate bit-fields in memory as follows:
several consecutive bit-field members of the same type will
be allocated sequentially. As soon as a new type needs to be allocated,
it will be aligned with the beginning of the next logical memory block."

References:
- https://msdn.microsoft.com/en-us/library/ewwyfdbe.aspx
- http://stackoverflow.com/questions/308364/c-bitfield-packing-with-bools/308383#308383
2016-04-24 14:06:48 +02:00
Michael Krasnyk dac2f93383 Refactoring of parameter garammars
* signature changed from void() to void(engine::api::Parameters&)
* performance increase due to use "static const GrammarT" and avoid
  construction and destruction of grammars during parsing
* removed code duplication in inherited grammars
* rule unlimited changed to qi::lit
* added rule size_t_
* parser accepts "&geometries=" and "&overview=" and fails at "foo"
  instead of "&geometries=foo" and &overview=foo
* added expectations checks for derived grammars
* changed rules qi::list(".") to character rules '.'
2016-04-23 21:15:21 +02:00
Patrick Niklaus 82372bb2ab Remove develop branch from appveyor 2016-04-23 17:55:18 +02:00
Patrick Niklaus b0c67c9019 Update coverall badge 2016-04-23 14:19:58 +02:00
Patrick Niklaus d83a34f72b Remove develop branch from travis 2016-04-22 14:51:38 +02:00
Patrick Niklaus a16f156203 Update README to remove develop branch 2016-04-22 14:49:27 +02:00
Patrick Niklaus 807aa71a7c Merge branch 'develop' 2016-04-22 14:35:32 +02:00
Patrick Niklaus 14d9b67b58 Update changelog with regard to 4.9.1 2016-04-22 14:28:45 +02:00
Patrick Niklaus 82df0ca766 Fix parser tests and destinations=all / sources=all 2016-04-22 11:01:15 +02:00
bergwerkgis a6c7529a4e AppVeyor: new path to test executables, add server-tests.exe 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 202bb6d3e2 Fix accidental rebase issues 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann bc514926bf Unit test for trip across component boundaries.
Daniel's mental model, with updates from Patrick and staring at the code
(plugins/trip.cpp): Trip first snaps coordinates which in the case of
phantoms that are not only in small components with the same id
switches small components to big ones. Therefore we get either only
small or only big components. Only then the Tarjan SCC decomposes this.

Result: multiple subtrips only happen for islands or continents.
2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 9fc16b6a83 Unit test for trip exclusively in big component 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 2125e0175d Unit tests for special symbols in radiuses, sources, destination 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 6b5982d389 Table unit test, revealing position_index -> waypoint_index mismatch 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann a4a8aa63d4 Invalid route requests 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann bedf451952 Namespace aliases 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann 93b8f1993c Split off parameters I/O from unit tests 2016-04-22 10:40:03 +02:00
Daniel J. Hofmann c693f4806b Unit tests for routing / snapping across components 2016-04-22 10:40:03 +02:00
Patrick Niklaus b07275694a Add more guidance tests 2016-04-21 23:07:29 +02:00
Patrick Niklaus 82177c101b Add changelog entry for summary 2016-04-21 22:47:05 +02:00
Patrick Niklaus da6dbd2159 Revert "Removes summary from legs property"
This adds the summary back to the RouteLeg, it now depends on if
`steps=true`.
This reverts commit eaf9993dd9.
2016-04-21 22:39:16 +02:00
Patrick Niklaus b3957d87b4 Add changelog entry 2016-04-21 22:14:01 +02:00
Patrick Niklaus 5f9ccadd6c If geometry is only one point, encode as Point not as LineString 2016-04-20 20:49:54 +02:00
karenzshea 6e04da9f8f remove movable bridge refs in bike profile 2016-04-19 14:24:16 -04:00
karenzshea 58c13d2c07 remove movable bridge travel mode references 2016-04-19 12:59:33 -04:00
karenzshea bca8593eef remove movable bridge mode from car profile 2016-04-19 10:21:46 -04:00
Patrick Niklaus 3e2e10a4c3 Add unit test for tile plugin 2016-04-15 14:48:21 +02:00
Patrick Niklaus 6979763292 Refactor the vector tile constants 2016-04-15 14:48:21 +02:00
karenzshea 324f1739e4 more table tests, break waypoint obj check into header file 2016-04-15 14:46:17 +02:00
karenzshea 1489662f57 start tests for table plugin 2016-04-15 14:46:17 +02:00
Daniel Patterson 1c1f407f67 Fix formatting. 2016-04-14 14:39:20 -07:00
Daniel Patterson 8fb631417b Abort processing if there are no snappable edges remaining. 2016-04-14 13:07:23 -07:00
Moritz Kobitzsch ae45ad1ad2 fix r-tree abort location 2016-04-14 11:40:36 +02:00
Patrick Niklaus 6b89803534 Forgot to commit a test 2016-04-13 11:24:14 +02:00
Patrick Niklaus f6116db957 Merge pull request #1902 from Project-OSRM/4.9.1
Bug fix release 4.9.1
2016-01-19 19:00:11 -05:00
Patrick Niklaus c824429458 Include the travel mode in the last instruction by copying it from the previous instruction. 2016-01-19 23:23:32 +01:00
Daniel Patterson 23b2154d98 Adds a shared/exclusive lock around queries and CheckAndReloadFacade.
Without this, it's possible for CheckAndReloadFacade to start working
while a query is still in progress, leading to undefined behaviour.
2016-01-19 21:26:30 +01:00
Daniel J. Hofmann 25c8711aad Fix shared memory non-copyable properties 2016-01-19 20:31:14 +01:00
Daniel Patterson cf30628d4e DataFacade should only remove shared segments if they're actually different from the last time they were checked. 2016-01-19 20:31:03 +01:00
Patrick Niklaus 7675c730b6 Fix wrong assertion and emplace_back bug in trip plugin 2016-01-19 17:38:02 +01:00
Patrick Niklaus 2ce74c05e1 Use a sane gps_precision multipler 2016-01-15 22:15:05 +01:00
Patrick Niklaus 88e6558da3 Fix handling unexpected errors. 2016-01-15 22:08:04 +01:00
Patrick Niklaus f1140ec903 Fix uturns at dead-end streets 2016-01-15 21:48:14 +01:00
Patrick Niklaus a2e114e852 Merge branch 'develop' 2015-12-24 11:22:16 +01:00
Patrick Niklaus 8f6fc0146b Merge branch 'develop' 2015-09-20 13:30:19 +02:00
Patrick Niklaus 6ad1cd3fb5 Merge branch 'develop' 2015-09-16 18:18:54 +02:00
Wilhelm Berg 40443d1e25 appveyor.yml update url to binary deps 2015-08-24 21:23:12 +02:00
Patrick Niklaus 4ec323c5cc Merge commit '9958937fd1c1f9dd60126a56e1c4f25ceefaf70e' 2015-08-15 00:11:31 +02:00
Patrick Niklaus 300d901618 Merge branch 'develop' 2015-06-22 13:06:50 +02:00
Patrick Niklaus fd6daa580a Merge branch 'develop' 2015-04-22 10:34:56 +02:00
Patrick Niklaus c2fc47df34 Merge branch 'develop' 2015-04-17 22:51:40 +02:00
338 changed files with 13673 additions and 6422 deletions
+59 -23
View File
@@ -2,53 +2,89 @@
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: true
AlwaysBreakTemplateDeclarations: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: false
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerBinding: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<'
Priority: 3
- Regex: '^"(osrm|util|engine|extract|contract)/'
Priority: 2
- Regex: '.*'
Priority: 1
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerBindsToType: false
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
IndentWidth: 4
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Allman
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
...
+1
View File
@@ -80,6 +80,7 @@ stxxl.errlog
/test/profile.lua
/test/cache
/test/speeds.csv
/test/penalties.csv
/test/data/monaco.*
node_modules
+98 -78
View File
@@ -1,7 +1,7 @@
#language: cpp
# This makes travis use the thin image which boots faster
language: generic
language: cpp
git:
depth: 10
# sudo:required is needed for trusty images
sudo: required
@@ -13,154 +13,174 @@ notifications:
branches:
only:
- master
- develop
cache:
ccache: true
apt: true
directories:
- test/cache
env:
global:
- CCACHE_TEMPDIR=/tmp/.ccache-temp
- CCACHE_COMPRESS=1
- JOBS=4
matrix:
fast_finish: true
# We override the compiler names here to yield better ccache behavior, which uses this as key
include:
# Debug Builds
- os: linux
compiler: gcc
compiler: "gcc-5-debug"
addons: &gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'pip']
packages: ['g++-5', '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']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Debug' COVERAGE=ON
- os: linux
compiler: gcc
compiler: "gcc-4.8-debug"
addons: &gcc48
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8', '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++-4.8', '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']
env: CCOMPILER='gcc-4.8' CXXCOMPILER='g++-4.8' BUILD_TYPE='Debug'
- os: linux
compiler: clang
compiler: "clang-3.8-debug"
addons: &clang38
apt:
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Debug' RUN_CLANG_FORMAT=ON
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', 'ccache']
env: CLANG_VERSION='3.8.0' BUILD_TYPE='Debug' RUN_CLANG_FORMAT=ON
- os: osx
osx_image: xcode7.3
compiler: clang
env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Debug'
env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Debug' JOBS=1 CUCUMBER_TIMEOUT=60000
# Release Builds
- os: linux
compiler: gcc
compiler: "gcc-5-release"
addons: &gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', '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++-5', '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']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
- os: linux
compiler: gcc
addons: &gcc48
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-4.8' CXXCOMPILER='g++-4.8' BUILD_TYPE='Release'
# Disabled because of CI slowness
#- os: linux
#- compiler: gcc
#- addons: &gcc48
#- apt:
#- sources: ['ubuntu-toolchain-r-test']
#- packages: ['g++-4.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='gcc-4.8' CXXCOMPILER='g++-4.8' BUILD_TYPE='Release'
- os: linux
compiler: clang
addons: &clang38
apt:
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release'
# Disabled because of CI slowness
#- os: linux
#- compiler: clang
#- addons: &clang38
#- apt:
#- sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
#- packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release'
- os: osx
osx_image: xcode7.3
compiler: clang
env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Release'
# Disabled because of CI slowness
#- os: osx
#- osx_image: xcode7.3
#- compiler: clang
#- env: CCOMPILER='clang' CXXCOMPILER='clang++' BUILD_TYPE='Release'
# Shared Library
- os: linux
compiler: gcc
compiler: "gcc-5-release-shared"
addons: &gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', '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++-5', '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']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
- os: linux
compiler: clang
addons: &clang38
apt:
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Disabled because CI slowness
#- os: linux
#- compiler: clang
#- addons: &clang38
#- apt:
#- sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test']
#- packages: ['clang-3.8', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
#- env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
before_install:
- if [[ $(uname -s) == 'Darwin' ]]; then sudo mdutil -i off /; fi;
- source ./scripts/install_node.sh 4
install:
- npm install
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- export PATH=${DEPS_DIR}/bin:${PATH} && mkdir -p ${DEPS_DIR}
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/3.5.2.tar.gz"
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}
- |
if [[ -n "${COVERAGE}" ]]; then
pip install --user cpp-coveralls
if [[ ${CLANG_VERSION:-false} != false ]]; then
export CCOMPILER='clang'
export CXXCOMPILER='clang++'
CLANG_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/clang/${CLANG_VERSION}.tar.gz"
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}
fi
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
# implicit deps, but seem to be installed by default with recent images: libxml2 GDAL boost
brew install cmake libzip libstxxl lua51 luabind tbb md5sha1sum
brew install libzip libstxxl lua51 luabind tbb md5sha1sum ccache
fi
before_script:
- cd ${TRAVIS_BUILD_DIR}
install:
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
./scripts/check_taginfo.py taginfo.json profiles/car.lua
fi
- mkdir build && pushd build
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- export OSRM_PORT=5000 OSRM_TIMEOUT=6000
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DCOVERAGE=${COVERAGE:-OFF} -DBUILD_TOOLS=1 -DENABLE_CCACHE=0
script:
- make --jobs=2
- make tests --jobs=2
- make benchmarks
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DCOVERAGE=${COVERAGE:-OFF} -DBUILD_TOOLS=1 -DENABLE_CCACHE=ON
- echo "travis_fold:start:MAKE"
- make osrm-extract --jobs=3
- make --jobs=${JOBS}
- make tests --jobs=${JOBS}
- make benchmarks --jobs=${JOBS}
- echo "travis_fold:end:MAKE"
- ccache -s
- sudo make install
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
sudo ldconfig
fi
- echo "travis_fold:start:UNIT_TESTS"
- popd
- mkdir example/build && pushd example/build
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- make
- popd
script:
- echo "travis_fold:start:BENCHMARK"
- make -C test/data benchmark
- echo "travis_fold:end:BENCHMARK"
- ./example/build/osrm-example test/data/monaco.osrm
# All tests assume to be run from the build directory
- pushd build
- ./unit_tests/library-tests ../test/data/monaco.osrm
- ./unit_tests/extractor-tests
- ./unit_tests/engine-tests
- ./unit_tests/util-tests
- ./unit_tests/server-tests
- echo "travis_fold:end:UNIT_TESTS"
- popd
- echo "travis_fold:start:CUCUMBER"
- npm test
- echo "travis_fold:end:CUCUMBER"
- echo "travis_fold:start:BENCHMARK"
- make -C test/data benchmark
- echo "travis_fold:end:BENCHMARK"
- ./build/unit_tests/library-tests test/data/monaco.osrm
- mkdir example/build && pushd example/build
- cmake ..
- make
- ./osrm-example ../../test/data/monaco.osrm
- popd
after_success:
- |
if [ -n "$RUN_CLANG_FORMAT" ]; then
./scripts/format.sh || true # we don't want to fail just yet
if [ -n "${RUN_CLANG_FORMAT}" ]; then
./scripts/format.sh # we don't want to fail just yet
fi
- |
if [ -n "${COVERAGE}" ]; then
bash <(curl -s https://codecov.io/bash)
fi
- coveralls --build-root build --exclude unit_tests --exclude third_party --exclude node_modules --gcov-options '\-lp'
+172
View File
@@ -1,3 +1,175 @@
# 5.2.0
Changes form 5.2.0 RC2
- Bugfixes:
- Fixed crash when loading shared memory caused by invalid OSM IDs segment size.
- Various small instructions handling fixes
Changes from 5.1.0
- API:
- new parameter `annotations` for `route`, `trip` and `match` requests. Returns additional data about each
coordinate along the selected/matched route line per `RouteLeg`:
- duration of each segment
- distance of each segment
- OSM node ids of all segment endpoints
- Introducing Intersections for Route Steps. This changes the API format in multiple ways.
- `bearing_before`/`bearing_after` of `StepManeuver` are now deprecated and will be removed in the next major release
- `location` of `StepManeuvers` is now deprecated and will be removed in the next major release
- every `RouteStep` now has property `intersections` containing a list of `Intersection` objects.
- Support for destination signs. New member `destinations` in `RouteStep`, based on `destination` and `destination:ref`
- Support for name pronunciations. New member `pronunciation` in `RouteStep`, based on `name:pronunciation`
- Profile changes:
- duration parser now accepts P[n]DT[n]H[n]M[n]S, P[n]W, PTHHMMSS and PTHH:MM:SS ISO8601 formats.
- `result.destinations` allows you to set a way's destinations
- `result.pronunciation` allows you to set way name pronunciations
- `highway=motorway_link` no longer implies `oneway` as per the OSM Wiki
- Infrastructure:
- BREAKING: Changed the on-disk encoding of the StaticRTree to reduce ramIndex file size. This breaks the **data format**
- BREAKING: Intersection Classification adds a new file to the mix (osrm.icd). This breaks the fileformat for older versions.
- Better support for osrm-routed binary upgrade on the fly [UNIX specific]:
- Open sockets with SO_REUSEPORT to allow multiple osrm-routed processes serving requests from the same port.
- Add SIGNAL_PARENT_WHEN_READY environment variable to enable osrm-routed signal its parent with USR1 when it's running and waiting for requests.
- Disable http access logging via DISABLE_ACCESS_LOGGING environment variable.
- Guidance:
- BREAKING: modifies the file format with new internal identifiers
- improved detection of turning streets, not reporting new-name in wrong situations
- improved handling of sliproads (emit turns instead of 'take the ramp')
- improved collapsing of instructions. Some 'new name' instructions will be suppressed if they are without alternative and the segment is short
- Bugfixes
- fixed broken summaries for very short routes
# 5.2.0 RC2
Changes from 5.2.0 RC1
- Guidance:
- improved handling of sliproads (emit turns instead of 'take the ramp')
- improved collapsing of instructions. Some 'new name' instructions will be suppressed if they are without alternative and the segment is short
- BREAKING: modifies the file format with new internal identifiers
- API:
- paramater `annotate` was renamed to `annotations`.
- `annotation` as accidentally placed in `Route` instead of `RouteLeg`
- Support for destination signs. New member `destinations` in `RouteStep`, based on `destination` and `destination:ref`
- Support for name pronunciations. New member `pronunciation` in `RouteStep`, based on `name:pronunciation`
- Add `nodes` property to `annotation` in `RouteLeg` containing the ids of nodes covered by the route
- Profile changes:
- `result.destinations` allows you to set a way's destinations
- `result.pronunciation` allows you to set way name pronunciations
- `highway=motorway_link` no longer implies `oneway` as per the OSM Wiki
- Infrastructure
- BREAKING: Changed the on-disk encoding of the StaticRTree to reduce ramIndex file size. This breaks the **data format**
- Bugfixes
- fixed broken summaries for very short routes
# 5.2.0 RC1
Changes from 5.1.0
- API:
- new parameter `annotate` for `route` and `match` requests. Returns additional data about each
coordinate along the selected/matched route line.
- Introducing Intersections for Route Steps. This changes the API format in multiple ways.
- `bearing_before`/`bearing_after` of `StepManeuver` are now deprecated and will be removed in the next major release
- `location` of `StepManeuvers` is now deprecated and will be removed in the next major release
- every `RouteStep` now has property `intersections` containing a list of `Intersection` objects.
- Profile changes:
- duration parser now accepts P[n]DT[n]H[n]M[n]S, P[n]W, PTHHMMSS and PTHH:MM:SS ISO8601 formats.
- Infrastructure:
- Better support for osrm-routed binary upgrade on the fly [UNIX specific]:
- Open sockets with SO_REUSEPORT to allow multiple osrm-routed processes serving requests from the same port.
- Add SIGNAL_PARENT_WHEN_READY environment variable to enable osrm-routed signal its parent with USR1 when it's running and waiting for requests.
- BREAKING: Intersection Classification adds a new file to the mix (osrm.icd). This breaks the fileformat for older versions.
- Disable http access logging via DISABLE_ACCESS_LOGGING environment
variable.
- Guidance:
- improved detection of turning streets, not reporting new-name in wrong situations
# 5.1.0
Changes with regard to 5.0.0
- API:
- added StepManeuver type `roundabout turn`. The type indicates a small roundabout that is treated as an intersection
(turn right at the roundabout for first exit, go straight at the roundabout...)
- added StepManeuver type `on ramp` and `off ramp` to distinguish between ramps that enter and exit a highway.
- reduced new name instructions for trivial changes
- combined multiple turns into a single instruction at segregated roads`
- Profile Changes:
- introduced a suffix_list / get_name_suffix_list to specify name suffices to be suppressed in name change announcements
- street names are now consistently assembled for the car, bike and walk profile as: "Name (Ref)" as in "Berlin (A5)"
- new `car.lua` dependency `lib/destination.lua`
- register a way's .nodes() function for use in the profile's way_function.
- Infrastructure
- BREAKING: reordered internal instruction types. This breaks the **data format**
- BREAKING: Changed the on-disk encoding of the StaticRTree for better performance. This breaks the **data format**
- Fixes:
- Issue #2310: post-processing for local paths, fixes #2310
- Issue #2309: local path looping, fixes #2309
- Issue #2356: Make hint values optional
- Issue #2349: Segmentation fault in some requests
- Issue #2335: map matching was using shortest path with uturns disabled
- Issue #2193: Fix syntax error position indicators in parameters queries
- Fix search with u-turn
- PhantomNode packing in MSVC now the same on other platforms
- Summary is now not malformed when including unnamed roads
- Emit new-name on when changing fron unanmed road to named road
# 5.0.0
Changes with regard 5.0.0 RC2:
- API:
- if `geometry=geojson` is passed the resulting geometry can be a LineString or Point
depending on how many coordinates are present.
- the removal of the summary field was revered. for `steps=flase` the field will always be an empty string.
Changes with regard to 4.9.1:
- API:
- BREAKING: Complete rewrite of the HTTP and library API. See detailed documentation in the wiki.
- BREAKING: The default coordinate order is now `longitude, latidue`. Exception: Polyline geometry
which follow the original Google specification of `latitdue, longitude`.
- BREAKING: Polyline geometries now use precision 5, instead of previously 6
- BREAKING: Removed GPX support
- New service `tile` which serves debug vector tiles of the road network
- Completely new engine for guidance generation:
- Support for highway ramps
- Support for different intersection types (end of street, forks, merges)
- Instruction post-processing to merge unimportant instructions
- Improved handling of roundabouts
- Tools:
- BREAKING: Renamed osrm-prepare to osrm-contract
- BREAKING: Removes profiles from osrm-contract, only needed in osrm-extract.
- Abort processing in osrm-extract if there are no snappable edges remaining.
- Added .properties file to osrm-extract ouput.
- Enables the use of multiple segment-speed-files on the osrm-contract command line
- Profile changes:
- Remove movable bridge mode
- Add `maxspeed=none` tag to car profile.
- A `side_road` tag support for the OSRM car profile.
- Fixes:
- Issue #2150: Prevents routing over delivery ways and nodes
- Issue #1972: Provide uninstall target
- Issue #2072: Disable alternatives by default and if core factor < 1.0
- Issue #1999: Fix unpacking for self-loop nodes not in core.
- Infrastructure:
- Cucumber test suit is now based on cucumber-js, removes Ruby as dependency
- Updated to mapbox/variant v1.1
- Updated to libosmium v2.6.1
- Remove GeoJSON based debugging output, replaced by debug tiles
# 5.0.0 RC2
- Profiles:
- `properties.allow_uturns_at_via` -> `properties.continue_straight_at_waypoint` (value is inverted!)
+78 -35
View File
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8.8)
cmake_minimum_required(VERSION 2.8.11)
# we depend on 2.8.11 introducing target_include_directories
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed.
@@ -8,9 +9,25 @@ endif()
project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 0)
set(OSRM_VERSION_MINOR 2)
set(OSRM_VERSION_PATCH 0)
# these two functions build up custom variables:
# OSRM_INCLUDE_PATHS and OSRM_DEFINES
# These variables we want to pass to
# include_directories and add_definitions for both
# this build and for sharing externally via pkg-config
function(add_dependency_includes includes)
list(APPEND OSRM_INCLUDE_PATHS "${includes}")
set(OSRM_INCLUDE_PATHS "${OSRM_INCLUDE_PATHS}" PARENT_SCOPE)
endfunction(add_dependency_includes)
function(add_dependency_defines defines)
list(APPEND OSRM_DEFINES "${defines}")
set(OSRM_DEFINES "${OSRM_DEFINES}" PARENT_SCOPE)
endfunction(add_dependency_defines)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXCompilerFlag)
include(FindPackageHandleStandardArgs)
@@ -25,14 +42,14 @@ else()
message(WARNING "Building on a 32 bit system is unsupported")
endif()
if(WIN32 AND MSVC_VERSION LESS 1800)
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif()
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" OFF)
option(BUILD_TOOLS "Build OSRM tools" OFF)
option(BUILD_COMPONENTS "Build osrm-components" ON)
option(BUILD_COMPONENTS "Build osrm-components" OFF)
option(ENABLE_ASSERTIONS OFF)
option(COVERAGE OFF)
option(SANITIZER OFF)
@@ -54,7 +71,7 @@ configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/util/version.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/util/version.hpp
)
file(GLOB UtilGlob src/util/*.cpp)
file(GLOB UtilGlob src/util/*.cpp src/util/*/*.cpp)
file(GLOB ExtractorGlob src/extractor/*.cpp src/extractor/*/*.cpp)
file(GLOB ContractorGlob src/contractor/*.cpp)
file(GLOB StorageGlob src/storage/*.cpp)
@@ -140,6 +157,7 @@ if (COVERAGE)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(ERROR "COVERAGE=ON only make sense with a Debug build")
endif()
message(INFO "Enabling coverage")
set(MAYBE_COVERAGE_LIBRARIES "gcov")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
endif()
@@ -162,7 +180,7 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# using GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=1 -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC")
if(WIN32) # using mingw
add_definitions(-DWIN32)
add_dependency_defines(-DWIN32)
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
@@ -171,12 +189,12 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# using Visual Studio C++
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time chrono zlib)
add_definitions(-DBOOST_LIB_DIAGNOSTIC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DNOMINMAX) # avoid min and max macros that can break compilation
add_definitions(-D_USE_MATH_DEFINES) #needed for M_PI with cmath.h
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-DXML_STATIC)
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
add_dependency_defines(-D_CRT_SECURE_NO_WARNINGS)
add_dependency_defines(-DNOMINMAX) # avoid min and max macros that can break compilation
add_dependency_defines(-D_USE_MATH_DEFINES) #needed for M_PI with cmath.h
add_dependency_defines(-D_WIN32_WINNT=0x0501)
add_dependency_defines(-DXML_STATIC)
find_library(ws2_32_LIBRARY_PATH ws2_32)
target_link_libraries(osrm-extract wsock32 ws2_32)
endif()
@@ -203,7 +221,7 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# Activate C++11
if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
# Configuring other platform dependencies
@@ -228,41 +246,54 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include")
find_package(Osmium REQUIRED COMPONENTS io)
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})
add_dependency_includes(${OSMIUM_INCLUDE_DIR})
find_package(Boost 1.49.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if(NOT WIN32)
add_definitions(-DBOOST_TEST_DYN_LINK)
# collect a subset of the boost libraries needed
# by libosrm
foreach(lib ${Boost_LIBRARIES})
if(NOT WIN32)
if(lib MATCHES filesystem OR lib MATCHES thread OR lib MATCHES iostreams OR lib MATCHES system)
list(APPEND BOOST_ENGINE_LIBRARIES "${lib}")
endif()
else()
list(APPEND BOOST_ENGINE_LIBRARIES "${lib}")
endif()
endforeach(lib)
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
endif()
add_definitions(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_definitions(-DBOOST_FILESYSTEM_NO_DEPRECATED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
add_dependency_includes(${Boost_INCLUDE_DIRS})
find_package(Threads REQUIRED)
find_package(TBB REQUIRED)
include_directories(SYSTEM ${TBB_INCLUDE_DIR})
add_dependency_includes(${TBB_INCLUDE_DIR})
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
endif()
find_package(Luabind REQUIRED)
include(check_luabind)
include_directories(SYSTEM ${LUABIND_INCLUDE_DIR})
add_dependency_includes(${LUABIND_INCLUDE_DIR})
set(USED_LUA_LIBRARIES ${LUA_LIBRARY})
if(LUAJIT_FOUND)
set(USED_LUA_LIBRARIES, LUAJIT_LIBRARIES)
endif()
include_directories(SYSTEM ${LUA_INCLUDE_DIR})
add_dependency_includes(${LUA_INCLUDE_DIR})
find_package(EXPAT REQUIRED)
include_directories(SYSTEM ${EXPAT_INCLUDE_DIRS})
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
find_package(STXXL REQUIRED)
include_directories(SYSTEM ${STXXL_INCLUDE_DIR})
add_dependency_includes(${STXXL_INCLUDE_DIR})
set(OpenMP_FIND_QUIETLY ON)
find_package(OpenMP)
@@ -272,16 +303,19 @@ if(OPENMP_FOUND)
endif()
find_package(BZip2 REQUIRED)
include_directories(SYSTEM ${BZIP_INCLUDE_DIRS})
add_dependency_includes(${BZIP2_INCLUDE_DIR})
find_package(ZLIB REQUIRED)
include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
if (ENABLE_JSON_LOGGING)
message(STATUS "Enabling json logging")
add_definitions(-DENABLE_JSON_LOGGING)
add_dependency_defines(-DENABLE_JSON_LOGGING)
endif()
add_definitions(${OSRM_DEFINES})
include_directories(SYSTEM ${OSRM_INCLUDE_PATHS})
# Binaries
target_link_libraries(osrm-datastore osrm_store ${Boost_LIBRARIES})
target_link_libraries(osrm-extract osrm_extract ${Boost_LIBRARIES})
@@ -310,12 +344,12 @@ set(CONTRACTOR_LIBRARIES
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(ENGINE_LIBRARIES
${Boost_LIBRARIES}
${BOOST_ENGINE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
${MAYBE_COVERAGE_LIBRARIES}
${ZLIB_LIBRARY})
set(STORAGE_LIBRARIES
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
@@ -411,14 +445,23 @@ foreach(lib ${ENGINE_LIBRARIES})
set(ENGINE_LIBRARY_LISTING "${ENGINE_LIBRARY_LISTING} -L${ENGINE_LIBRARY_PATH} -l${ENGINE_LIBRARY_NAME}")
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
if(BUILD_DEBIAN_PACKAGE)
include(CPackDebianConfig)
include(CPack)
endif()
function(JOIN VALUES GLUE OUTPUT)
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
# Set up variables, then write to pkgconfig file
JOIN("${OSRM_DEFINES}" " " OSRM_DEFINES_STRING)
JOIN("-I${OSRM_INCLUDE_PATHS}" " -I" OSRM_INCLUDE_PATHS_STRING)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
+45 -8
View File
@@ -4,13 +4,11 @@ The Open Source Routing Machine is a high performance routing engine written in
## Current build status
| build config | branch | status |
|:-------------|:--------|:------------|
| Linux | master | [![Build Status](https://travis-ci.org/Project-OSRM/osrm-backend.png?branch=master)](https://travis-ci.org/Project-OSRM/osrm-backend) |
| Linux | develop | [![Build Status](https://travis-ci.org/Project-OSRM/osrm-backend.png?branch=develop)](https://travis-ci.org/Project-OSRM/osrm-backend) |
| Windows | master/develop | [![Build status](https://ci.appveyor.com/api/projects/status/4iuo3s9gxprmcjjh)](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) |
| LUAbind fork | master | [![Build Status](https://travis-ci.org/DennisOSRM/luabind.png?branch=master)](https://travis-ci.org/DennisOSRM/luabind) |
| Coverage | develop | [![Coverage Status](https://coveralls.io/repos/github/Project-OSRM/osrm-backend/badge.svg?branch=develop)](https://coveralls.io/github/Project-OSRM/osrm-backend?branch=develop) |
| build config | status |
|:-------------|:-------|
| Linux | [![Build Status](https://travis-ci.org/Project-OSRM/osrm-backend.png?branch=master)](https://travis-ci.org/Project-OSRM/osrm-backend) |
| Windows | [![Build status](https://ci.appveyor.com/api/projects/status/4iuo3s9gxprmcjjh)](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) |
| Coverage | [![codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) |
## Building
@@ -20,7 +18,46 @@ To quickly try OSRM use our [free and daily updated online service](http://map.p
## Documentation
See the Wiki's [server API documentation](https://github.com/Project-OSRM/osrm-backend/wiki/Server-api) as well as the [library API documentation](https://github.com/Project-OSRM/osrm-backend/wiki/Library-api)
### Full documentation
- [osrm-routed HTTP API documentation](docs/http.md)
- [libosrm API documentation](docs/libosrm.md)
### Quick start
Building OSRM assuming all dependencies are installed:
```
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
```
Loading preparing a dataset and starting the server:
```
osrm-extract data.osm.pbf -p profiles/car.lua
osrm-contract data.osrm
osrm-routed data.osrm
```
Running a query on your local server:
```
curl http://127.0.0.1:5000/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
```
### Running a request against the Demo Server
First read the [API usage policy](https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy).
Then run simple query with instructions and alternatives on Berlin:
```
curl https://router.project-osrm.org/13.388860,52.517037;13.385983,52.496891?steps=true&alternatives=true
```
## References in publications
+9 -6
View File
@@ -116,17 +116,20 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH%
ECHO running engine-tests.exe ...
%Configuration%\unit_tests\engine-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running extractor-tests.exe ...
%Configuration%\unit_tests\extractor-tests.exe
unit_tests\%Configuration%\extractor-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running engine-tests.exe ...
unit_tests\%Configuration%\engine-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running util-tests.exe ...
%Configuration%\unit_tests\util-tests.exe
unit_tests\%Configuration%\util-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running server-tests.exe ...
unit_tests\%Configuration%\server-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF NOT "%APPVEYOR_REPO_BRANCH%"=="develop" GOTO DONE
IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" GOTO DONE
ECHO ========= CREATING PACKAGES ==========
CD %PROJECT_DIR%\build\%Configuration%
-1
View File
@@ -28,7 +28,6 @@ artifacts:
branches:
only:
- master
- develop
deploy:
provider: FTP
+1
View File
@@ -280,4 +280,5 @@ if (TBB_FOUND)
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}")
endif (TBB_FOUND)
+1 -1
View File
@@ -8,4 +8,4 @@ Version: v@OSRM_VERSION_MAJOR@.@OSRM_VERSION_MINOR@.@OSRM_VERSION_PATCH@
Requires:
Libs: -L${libdir} -losrm
Libs.private: @ENGINE_LIBRARY_LISTING@
Cflags: -I${includedir} -I${includedir}/osrm
Cflags: -I${includedir} -I${includedir}/osrm @OSRM_INCLUDE_PATHS_STRING@ @OSRM_DEFINES_STRING@ @CMAKE_CXX_FLAGS@
+7
View File
@@ -0,0 +1,7 @@
coverage:
ignore:
- unit_tests/.*
- third_party/.*
comment: off
+9 -1
View File
@@ -5,15 +5,23 @@ RUN apt-get install -y build-essential git-core python-pip python-software-prope
RUN apt-get -y install gcc-4.8 g++-4.8 libboost1.55-all-dev llvm-3.4
RUN apt-get -y install libbz2-dev libstxxl-dev libstxxl1 libxml2-dev
RUN apt-get -y install libzip-dev lua5.1 liblua5.1-0-dev libtbb-dev libgdal-dev ruby1.9
RUN apt-get -y install libzip-dev lua5.1 liblua5.1-0-dev libtbb-dev libgdal-dev
RUN apt-get -y install curl cmake cmake-curses-gui
RUN pip install awscli
# luabind
RUN curl https://gist.githubusercontent.com/DennisOSRM/f2eb7b948e6fe1ae319e/raw/install-luabind.sh | sudo bash
WORKDIR /opt
RUN git clone --depth 1 --branch v0.31.0 https://github.com/creationix/nvm.git
RUN /bin/bash -c "source /opt/nvm/nvm.sh && nvm install v4"
RUN useradd -ms /bin/bash mapbox
USER mapbox
ENV HOME /home/mapbox
WORKDIR /home/mapbox
RUN echo "source /opt/nvm/nvm.sh" > .bashrc
RUN echo "source /home/mapbox/.bashrc" > .profile
+1 -1
View File
@@ -8,4 +8,4 @@ docker run \
-e "CXX=clang++" \
-v `pwd`:/home/mapbox/osrm-backend \
-t mapbox/osrm:linux \
osrm-backend/docker/test.sh
/bin/bash -lc "osrm-backend/docker/test.sh"
+1 -1
View File
@@ -8,4 +8,4 @@ docker run \
-e "CXX=g++" \
-v `pwd`:/home/mapbox/osrm-backend \
-t mapbox/osrm:linux \
osrm-backend/docker/test.sh
/bin/bash -lc "osrm-backend/docker/test.sh"
+5 -6
View File
@@ -4,11 +4,8 @@ set -e
set -o pipefail
export CMAKEOPTIONS="-DCMAKE_BUILD_TYPE=Release"
export PATH=$PATH:/home/mapbox/.gem/ruby/1.9.1/bin:/home/mapbox/osrm-backend/vendor/bundle/ruby/1.9.1/bin
cd /home/mapbox/osrm-backend
gem install --user-install bundler
bundle install --path vendor/bundle
[ -d build ] && rm -rf build
mkdir -p build
cd build
@@ -16,7 +13,9 @@ cmake .. $CMAKEOPTIONS -DBUILD_TOOLS=1
make -j`nproc`
make tests -j`nproc`
./datastructure-tests
./algorithm-tests
#./unit_tests/server-tests
#./unit_tests/library-tests
#./unit_tests/extractor-tests
#./unit_tests/util-tests
cd ..
bundle exec cucumber -p verify
npm test
+595
View File
@@ -0,0 +1,595 @@
## Environent Variables
### SIGNAL_PARENT_WHEN_READY
If the SIGNAL_PARENT_WHEN_READY environment variable is set osrm-routed will
send the USR1 signal to its parent when it will be running and waiting for
requests. This could be used to upgrade osrm-routed to a new binary on the fly
without any service downtime - no incoming requests will be lost.
### DISABLE_ACCESS_LOGGING
If the DISABLE_ACCESS_LOGGING environment variable is set osrm-routed will
**not** log any http requests to standard output. This can be useful in high
traffic setup.
## HTTP API
`osrm-routed` supports only `GET` requests of the form. If you your response size
exceeds the limits of a simple URL encoding, consider using our [NodeJS bindings](https://github.com/Project-OSRM/node-osrm)
or using the [C++ library directly](libosrm.md).
### Request
```
http://{server}/{service}/{version}/{profile}/{coordinates}[.{format}]?option=value&option=value
```
- `server`: location of the server. Example: `127.0.0.1:5000` (default)
- `service`: Name of the service to be used. Support are the following services:
| Service | Description |
|-------------|-----------------------------------------------------------|
| [`route`](#service-route) | shortest path between given coordinates |
| [`nearest`](#service-nearest) | returns the nearest street segment for a given coordinate |
| [`table`](#service-table) | computes distance tables for given coordinates |
| [`match`](#service-match) | matches given coordinates to the road network |
| [`trip`](#service-trip) | Compute the shortest round trip between given coordinates |
| [`tile`](#service-tile) | Return vector tiles containing debugging info |
- `version`: Version of the protocol implemented by the service.
- `profile`: Mode of transportation, is determined by the profile that is used to prepare the data
- `coordinates`: String of format `{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]` or `polyline({polyline})`.
- `format`: Only `json` is supportest at the moment. This parameter is optional and defaults to `json`.
Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 and can be generated using [this package](https://www.npmjs.com/package/polyline).
To pass parameters to each location some options support an array like encoding:
```
{option}={element};{element}[;{element} ... ]
```
The number of elements must match exactly the number of locations. If you don't want to pass a value but instead use the default you can pass an empty `element`.
Example: 2nd location use the default value for `option`:
```
{option}={element};;{element}
```
## General options
| Option | Values | Description |
|------------|--------------------------------------------------------|--------------------------------------------------|
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|hints |`{hint};{hint}[;{hint} ...]` |Hint to derive position in street network. |
Where the elements follow the following format:
| Element | Values |
|------------|--------------------------------------------------------|
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|radius |`double >= 0` or `unlimited` (default) |
|hint |Base64 `string` |
#### Examples
Query on Berlin with three coordinates:
```
http://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?overview=false
```
Using polyline:
```
http://router.project-osrm.org/route/v1/driving/polyline(ofp_Ik_vpAilAyu@te@g`E)?overview=false
```
### Response
Every response object has a `code` field.
```json
{
"code": {code},
"message": {message}
}
```
Where `code` is on one of the strings below or service dependent:
| Type | Description |
|-------------------|----------------------------------------------------------------------------------|
| `Ok` | Request could be processed as expected. |
| `InvalidUrl` | URL string is invalid. |
| `InvalidService` | Service name is invalid. |
| `InvalidVersion` | Version is not found. |
| `InvalidOptions` | Options are invalid. |
| `NoSegment` | One of the supplied input coordinates could not snap to street segment. |
| `TooBig` | The request size violates one of the service specific request size restrictions. |
`message` is a **optional** human-readable error message. All other status types are service dependent.
In case of an error the HTTP status code will be `400`. Otherwise the HTTP status code will be `200` and `code` will be `Ok`.
## Service `nearest`
Snaps a coordinate to the street network and returns the nearest n matches.
### Request
```
http://{server}/nearest/v1/{profile}/{coordinates}.json?number={number}
```
Where `coordinates` only supports a single `{longitude},{latitude}` entry.
In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description |
|------------|------------------------------|----------------------------------------------------|
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
### Response
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `waypoints` array of `Waypoint` objects sorted by distance to the input coordinate. Each object has at least the following additional properties:
- `distance`: Distance in meters to the supplied input coordinate.
### Examples
Querying nearest three snapped locations of `13.388860,52.517037` with a bearing between `20° - 340°`.
```
http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?number=3&bearings=0,20
```
## Service `route`
### Request
```
http://{server}/route/v1/{profile}/{coordinates}?alternatives={true|false}&steps={true|false}&geometries={polyline|geojson}&overview={full|simplified|false}&annotations={true|false}
```
In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description |
|------------|------------------------------------------|-------------------------------------------------------------------------------|
|alternatives|`true`, `false` (default) |Search for alternative routes and return as well.\* |
|steps |`true`, `false` (default) |Return route steps for each route leg |
|annotations |`true`, `false` (default) |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|continue_straight |`default` (default), `true`, `false`|Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile. |
\* Please note that even if an alternative route is requested, a result cannot be guaranteed.
### Response
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `waypoints`: Array of `Waypoint` objects representing all waypoints in order:
- `routes`: An array of `Route` objects, ordered by descending recommendation rank.
In case of error the following `code`s are supported in addition to the general ones:
| Type | Description |
|-------------------|-----------------|
| `NoRoute` | No route found. |
All other fields might be undefined.
## Service `table`
### Request
```
http://{server}/table/v1/{profile}/{coordinates}?{sources}=[{elem}...];&destinations=[{elem}...]`
```
This computes duration tables for the given locations. Allows for both symmetric and asymmetric tables.
### Coordinates
In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description |
|------------|--------------------------------------------------|---------------------------------------------|
|sources |`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as source. |
|destinations|`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as destination.|
Unlike other array encoded options, the length of `sources` and `destinations` can be **smaller or equal**
to number of input locations;
Example:
```
sources=0;5;7&destinations=5;1;4;2;3;6
```
|Element |Values |
|------------|-----------------------------|
|index |`0 <= integer < #locations` |
### Response
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `durations` array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from
the i-th waypoint to the j-th waypoint. Values are given in seconds.
- `sources` array of `Waypoint` objects describing all sources in order
- `destinations` array of `Waypoint` objects describing all destinations in order
In case of error the following `code`s are supported in addition to the general ones:
| Type | Description |
|-------------------|-----------------|
| `NoTable` | No route found. |
All other fields might be undefined.
#### Examples
Returns a `3x3` matrix:
```
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219
```
Returns a `1x3` matrix:
```
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?sources=0
```
Returns a asymmetric 3x2 matrix with from the polyline encoded locations `qikdcB}~dpXkkHz`:
```
http://router.project-osrm.org/table/v1/driving/qikdcB}~dpXkkHz?sources=0;1;3&destinations=2;4
```
## Service `match`
Map matching matches given GPS points to the road network in the most plausible way.
Please note the request might result multiple sub-traces. Large jumps in the timestamps (>60s) or improbable transitions lead to trace splits if a complete matching could not be found.
The algorithm might not be able to match all points. Outliers are removed if they can not be matched successfully.
### Request
```
http://{server}/match/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|geojson}&overview={simplified|full|false}&annotations={true|false}
```
In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description |
|------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|steps |`true`, `false` (default) |Return route steps for each route |
|geometries |`polyline` (default), `geojson` |Returned route geometry format (influences overview and per step) |
|annotations |`true`, `false` (default) |Returns additional metadata for each coordinate along the route geometry. |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamp of the input location. |
|radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.|
|Parameter |Values |
|------------|------------------------------|
|timestamp |`integer` UNIX-like timestamp |
|radius |`double >= 0` (default 5m) |
### Response
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `tracepoints`: Array of `Ẁaypoint` objects representing all points of the trace in order.
If the trace point was ommited by map matching because it is an outlier, the entry will be `null`.
Each `Waypoint` object has the following additional properties:
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
- `waypoint_index`: Index of the waypoint inside the matched route.
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.
In case of error the following `code`s are supported in addition to the general ones:
| Type | Description |
|-------------------|---------------------|
| `NoMatch` | No matchings found. |
All other fields might be undefined.
## Service `trip`
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm).
The returned path does not have to be the shortest path, as TSP is NP-hard it is only an approximation.
Note that if the input coordinates can not be joined by a single trip (e.g. the coordinates are on several disconnected islands)
multiple trips for each connected component are returned.
### Request
```
http://{server}/trip/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|geojson}&overview={simplified|full|false}&annotations={true|false}
```
In addition to the [general options](#general-options) the following options are supported for this service:
|Option |Values |Description |
|------------|------------------------------------------------|---------------------------------------------------------------------------|
|steps |`true`, `false` (default) |Return route instructions for each trip |
|annotations |`true`, `false` (default) |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
### Response
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `waypoints`: Array of `Waypoint` objects representing all waypoints in input order. Each `Waypoint` object has the following additional properties:
- `trips_index`: Index to `trips` of the sub-trip the point was matched to.
- `waypoint_index`: Index of the point in the trip.
- `trips`: An array of `Route` objects that assemble the trace.
In case of error the following `code`s are supported in addition to the general ones:
| Type | Description |
|-------------------|---------------------|
| `NoTrips` | No trips found. |
All other fields might be undefined.
## Result objects
### Route
Represents a route through (potentially multiple) waypoints.
#### Properties
- `distance`: The distance traveled by the route, in `float` meters.
- `duration`: The estimated travel time, in `float` number of seconds.
- `geometry`: The whole geometry of the route value depending on `overview` parameter, format depending on the `geometries` parameter. See `RouteStep`'s `geometry` field for a parameter documentation.
| overview | Description |
|------------|-----------------------------|
| simplified | Geometry is simplified according to the highest zoom level it can still be displayed on full. |
| full | Geometry is not simplified. |
| false | Geometry is not added. |
- `legs`: The legs between the given waypoints, an array of `RouteLeg` objects.
#### Example
Three input coordinates, `geometry=geojson`, `steps=false`:
```json
{
"distance": 90.0,
"duration": 300.0,
"geometry": {"type": "LineString", "coordinates": [[120., 10.], [120.1, 10.], [120.2, 10.], [120.3, 10.]]},
"legs": [
{
"distance": 30.0,
"duration": 100.0,
"steps": []
},
{
"distance": 60.0,
"duration": 200.0,
"steps": []
}
]
}
```
### RouteLeg
Represents a route between two waypoints.
#### Properties
- `distance`: The distance traveled by this route leg, in `float` meters.
- `duration`: The estimated travel time, in `float` number of seconds.
- `summary`: Summary of the route taken as `string`. Depends on the `steps` parameter:
| steps | |
|--------------|-----------------------------------------------------------------------|
| true | Names of the two major roads used. Can be empty if route is too short.|
| false | empty `string` |
- `steps`: Depends on the `steps` parameter.
| steps | |
|--------------|-----------------------------------------------------------------------|
| true | array of `RouteStep` objects describing the turn-by-turn instructions |
| false | empty array |
- `annotation`: Additional details about each coordinate along the route geometry:
| annotations | |
|--------------|-----------------------------------------------------------------------|
| true | returns distance and durations of each coordinate along the route |
| false | will not exist |
#### Example
With `steps=false` and `annotations=true`:
```json
{
"distance": 30.0,
"duration": 100.0,
"steps": []
"annotation": {
"distance": [5,5,10,5,5],
"duration": [15,15,40,15,15],
"nodes": [49772551,49772552,49786799,49786800,49786801,49786802]
}
}
```
### RouteStep
A step consists of a maneuver such as a turn or merge, followed
by a distance of travel along a single way to the subsequent
step.
#### Properties
- `distance`: The distance of travel from the maneuver to the subsequent step, in `float` meters.
- `duration`: The estimated travel time, in `float` number of seconds.
- `geometry`: The unsimplified geometry of the route segment, depending on the `geometries` parameter.
| geometries | |
|------------|--------------------------------------------------------------------|
| polyline | [polyline](https://www.npmjs.com/package/polyline) with precision 5 in [latitude,longitude] encoding |
| geojson | [GeoJSON `LineString`](http://geojson.org/geojson-spec.html#linestring) or [GeoJSON `Point`](http://geojson.org/geojson-spec.html#point) if it is only one coordinate (not wrapped by a GeoJSON feature)|
- `name`: The name of the way along which travel proceeds.
- `pronunciation`: The pronunciation hint of the way name. Will be `undefined` if there is no pronunciation hit.
- `destinations`: The destinations of the way. Will be `undefined` if there are no destinations.
- `mode`: A string signifying the mode of transportation.
- `maneuver`: A `StepManeuver` object representing the maneuver.
- `intersections`: A list of `Intersections` that are passed along the segment, the very first belonging to the StepManeuver
#### Example
```
{
"distance":152.3,
"duration":15.6,
"name":"Lortzingstraße",
"maneuver":{
"type":"depart",
"modifier":"left"
},
"geometry":"{lu_IypwpAVrAvAdI",
"mode":"driving",
"intersections":[
{"location":[13.39677,52.54366],
"out":1,
"bearings":[66,246],
"entry":["true","true"]},
{"location":[13.394718,52.543096],
"in":0,
"out":2,
"bearings":[60,150,240,330],
"entry":["false","true","true","true"]
}
]}
```
### StepManeuver
#### Properties
- `location`: A `[longitude, latitude]` pair describing the location of the turn.
- `bearing_before`: The clockwise angle from true north to the
direction of travel immediately before the maneuver.
- `bearing_after`: The clockwise angle from true north to the
direction of travel immediately after the maneuver.
- `type` A string indicating the type of maneuver. **new identifiers might be introduced without API change**
Types unknown to the client should be handled like the `turn` type, the existance of correct `modifier` values is guranteed.
| `type` | Description |
|-------------------|--------------------------------------------------------------|
| turn | a basic turn into direction of the `modifier` |
| new name | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
| depart | indicates the departure of the leg |
| arrive | indicates the destination of the leg |
| merge | merge onto a street (e.g. getting on the highway from a ramp, the `modifier specifies the direction of the merge`) |
| ramp | **Deprecated**. Replaced by `on_ramp` and `off_ramp`. |
| on ramp | take a ramp to enter a highway (direction given my `modifier`) |
| 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`|
| continue | Turn in direction of `modifier` to stay on the same road |
| roundabout | traverse roundabout, has additional field `exit` with NR if the roundabout is left. `the modifier specifies the direction of entering the roundabout` |
| rotary | a larger version of a roundabout, can offer `rotary_name` in addition to the `exit` parameter. |
| roundabout turn | Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. |
| notification | not an actual turn but a change in the driving conditions. For example the travel mode. If the road takes a turn itself, the `modifier` describes the direction |
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
between all instructions. They only offer a fallback in case nothing else is to report.
- `modifier` An optional `string` indicating the direction change of the maneuver.
| `modifier` | Description |
|-------------------|-------------------------------------------|
| uturn | indicates reversal of direction |
| sharp right | a sharp right turn |
| right | a normal turn to the right |
| slight right | a slight turn to the right |
| straight | no relevant change in direction |
| slight left | a slight turn to the left |
| left | a normal turn to the left |
| sharp left | a sharp turn to the left |
The list of turns without a modifier is limited to: `depart/arrive`. If the source/target location is close enough to the `depart/arrive` location, no modifier will be given.
The meaning depends on the `type` field.
| `type` | Description |
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
| `turn` | `modifier` indicates the change in direction accomplished through the turn |
| `depart`/`arrive` | `modifier` indicates the position of departure point and arrival point in relation to the current direction of travel |
- `exit` An optional `integer` indicating number of the exit to take. The field exists for the following `type` field:
| `type` | Description |
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
| `roundabout` | Number of the roundabout exit to take. If exit is `undefined` the destination is on the roundabout. |
| else | Indicates the number of intersections passed until the turn. Example instruction: `at the fourth intersection, turn left` |
New properties (potentially depending on `type`) may be introduced in the future without an API version change.
### Intersections
An intersection gives a full representation of any cross-way the path passes bay. For every step, the very first intersection (`intersections[0]`) corresponds to the
location of the StepManeuver. Further intersections are listed for every cross-way until the next turn instruction.
#### Properties
- `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.
- `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
direction of travel immediately before the maneuver/passing the intersection. Bearings are given relative to the intersection. To get the bearing
in the direction of driving, the bearing has to be rotated by a value of 180. The value is not supplied for `depart` maneuvers.
- `out`: index into the bearings/entry array. Used to extract the bearing just after the turn. Namely, The clockwise angle from true north to the
direction of travel immediately after the maneuver/passing the intersection. The value is not supplied for `arrive` maneuvers.
#### Example
```
{
"location":[13.394718,52.543096],
"in":0,
"out":2,
"bearings":[60,150,240,330],
"entry":["false","true","true","true"]
}
```
### Waypoint
Object used to describe waypoint on a route.
#### Properties
- `name` Name of the street the coordinate snapped to
- `location` Array that contains the `[longitude, latitude]` pair of the snapped coordinate
- `hint` Unique internal identifier of the segment (ephemeral, not constant over data updates)
This can be used on subsequent request to significantly speed up the query and to connect multiple services.
E.g. you can use the `hint` value obtained by the `nearest` query as `hint` values for `route` inputs.
## Service `tile`
This generates [Mapbox Vector Tiles](https://www.mapbox.com/developers/vector-tiles/) that can be viewed with a vector-tile capable slippy-map viewer. The tiles contain road geometries and metadata that can be used to examine the routing graph. The tiles are generated directly from the data in-memory, so are in sync with actual routing results, and let you examine which roads are actually routable, and what weights they have applied.
### Request
```
http://{server}/tile/v1/{profile}/tile({x},{y},{zoom}).mvt
```
The `x`, `y`, and `zoom` values are the same as described at https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames, and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/).
### Response
The response object is either a binary encoded blob with a `Content-Type` of `application/x-protobuf`, or a `404` error. Note that OSRM is hard-coded to only return tiles from zoom level 12 and higher (to avoid accidentally returning extremely large vector tiles).
Vector tiles contain just a single layer named `speeds`. Within that layer, features can have `speed` (int) and `is_small` (boolean) attributes.
+26
View File
@@ -0,0 +1,26 @@
OSRM can be used as a library (libosrm) via C++ instead of using it through the HTTP interface and `osrm-routed`. This allows for fine-tuning OSRM and has much less overhead. Here is a quick introduction into how to use `libosrm` in the upcoming v5 release.
Take a look at the example code that lives in the [example directory](https://github.com/Project-OSRM/osrm-backend/tree/master/example). Here is all you ever wanted to know about `libosrm`, that is a short description of what the types do and where to find documentation on it:
- [`EngineConfig`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/engine_config.hpp) - for initializing an OSRM instance we can configure certain properties and constraints. E.g. the storage config is the base path such as `france.osm.osrm` from which we derive and load `france.osm.osrm.*` auxiliary files. This also lets you set constraints such as the maximum number of locations allowed for specific services.
- [`OSRM`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/osrm/osrm.hpp) - this is the main Routing Machine type with functions such as `Route` and `Table`. You initialize it with a `EngineConfig`. It does all the heavy lifting for you. Each function takes its own parameters, e.g. the `Route` function takes `RouteParameters`, and a out-reference to a JSON result that gets filled. The return value is a `Status`, indicating error or success.
- [`Status`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/status.hpp) - this is a type wrapping `Error` or `Ok` for indicating error or success, respectively.
- [`TableParameters`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/table_parameters.hpp) - this is an example of parameter types the Routing Machine functions expect. In this case `Table` expects its own parameters as `TableParameters`. You can see it wrapping two vectors, sources and destinations --- these are indices into your coordinates for the table service to construct a matrix from (empty sources or destinations means: use all of them). If you ask yourself where coordinates come from, you can see `TableParameters` inheriting from `BaseParameters`.
- [`BaseParameter`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/base_parameters.hpp) - this most importantly holds coordinates (and a few other optional properties that you don't need for basic usage); the specific parameter types inherit from `BaseParameters` to get these member attributes. That means your `TableParameters` type has `coordinates`, `sources` and `destination` member attributes (and a few other that we ignore for now).
- [`Coordinate`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp) - this is a wrapper around a (longitude, latitude) pair. We really don't care about (lon,lat) vs (lat, lon) but we don't want you to accidentally mix them up, so both latitude and longitude are strictly typed wrappers around integers (fixed notation such as `13423240`) and floating points (floating notation such as `13.42324`).
- [Parameters for other services](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api) - here are all other `*Parameters` you need for other Routing Machine services.
- [JSON](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/json_container.hpp) - this is a sum type resembling JSON. The Routing Machine service functions take a out-ref to a JSON result and fill it accordingly. It is currently implemented using [mapbox/variant](https://github.com/mapbox/variant) which is similar to [Boost.Variant](http://www.boost.org/doc/libs/1_55_0/doc/html/variant.html) (Boost documentation is great). There are two ways to work with this sum type: either provide a visitor that acts on each type on visitation or use the `get` function in case you're sure about the structure. The JSON structure is written down in the [[v5 server API|Server-API-v5,-current]].
------------------------------------------------------------------------------------------------------------------
To summarize:
- create an `OSRM` instance initialized with a `EngineConfig`
- call the service function on the `OSRM` object providing service specific `*Parameters`
- check the return code and use the JSON result
+34
View File
@@ -0,0 +1,34 @@
OSRM supports "profiles". Configurations representing different routing behaviours for (typically) different transport modes. A profile describes whether or not we route along a particular type of way, or over a particular node in the OpenStreetMap data, and also how quickly we'll be travelling when we do. This feeds into the way the routing graph is created and thus influences the output routes.
## Available profiles
Out-of-the-box OSRM comes with several different profiles, including car, bicycle and foot.
Profile configuration files have a 'lua' extension, and are found under the 'profiles' subdirectory.
Alternatively commands will take a lua profile specified with an explicit -p param, for example:
`osrm-extract -p ../profiles/car.lua planet-latest.osm.pbf`
And then **you will need to extract and contract again** (A change to the profile will typically affect the extract step as well as the contract step. See [Processing Flow](https://github.com/Project-OSRM/osrm-backend/wiki/Processing-Flow))
## lua scripts?
Profiles are not just configuration files. They are scripts written in the "lua" scripting language ( http://www.lua.org ) The reason for this, is that OpenStreetMap data is not sufficiently straightforward, to simply define tag mappings. Lua scripting offers a powerful way of coping with the complexity of different node,way,relation,tag combinations found within OpenStreetMap data.
## Basic structure of a profile
You can understand these lua scripts enough to make interesting modifications, without needing to get to grips with how they work completely.
Towards the top of the file, a profile (such as [car.lua](../profiles/car.lua)) will typically define various configurations as global variables. A lot of these are look-up hashes of one sort or another.
As you scroll down the file you'll see local variables, and then local functions, and finally...
`way_function` and `node_function` are the important functions which are called when extracting OpenStreetMap data with `osrm-extract`.
## way_function
Given an OpenStreetMap way, the way_function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash to be returned. The most important thing it will do is set the value of `result.forward_speed` and `result.backward_speed` as a suitable integer value representing the speed for traversing the way.
All other calculations stem from that, including the returned timings in driving directions, but also, less directly, it feeds into the actual routing decisions the engine will take (a way with a slow traversal speed, may be less favoured than a way with fast traversal speed, but it depends how long it is, and... what it connects to in the rest of the network graph)
Using the power of the scripting language you wouldn't typically see something as simple as a `result.forward_speed = 20` line within the way_function. Instead a way_function will examine the tagging (e.g. `way:get_value_by_key("highway")` and many others), process this information in various ways, calling other local functions, referencing the global variables and look-up hashes, before arriving at the result.
+50
View File
@@ -0,0 +1,50 @@
# Releasing a new OSRM version
Do decide if this is a major or minor version bump use: http://semver.org/
What we guarantee on major version changes:
- Breaking changes will be in the changelog
- If we break an HTTP API we bump the version
What we guarantee on minor version changes:
- HTTP API does not include breaking changes
- C++ library API does not include breaking changes
- node-osrm API does not include breaking changes
What we DO NOT guarantee on minor version changes:
- file format comp ability. Breakage will be listed in the changelog.
- new turn types and fields may be introduced. How to handle this see [the HTTP API docs](http.md).
What we guarantee on patch version changes:
- HTTP API does not include breaking changes
- C++ library API does not include breaking changes
- node-osrm API does not include breaking changes
- full file format compatibility
## Major or Minor release x.y
1. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
2. Make sure `CHANGELOG.md` is up to date.
3. Make sure the OSRM version in `CMakeLists.txt` is up to date
4. Use an annotated tag to mark the release: `git tag vx.y.0 -a` Body of the tag description should be the changelog entries.
5. Push tags and commits: `git push; git push --tags`
6. Branch of the `vx.y.0` tag to create a release branch `x.y`:
`git branch x.y. vx.y.0; git push -u x.y:origin/x.y`
7. Modify `.travis.yml` to allow builds for the `x.y` branch.
8. Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
## Patch release x.y.z
1. Check out the appropriate release branch x.y
2. Make sure all fixes are listed in the changelog and included in the branch
3. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
4. Make sure the OSRM version in `CMakeLists.txt` is up to date
5. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
6. Push tags and commits: `git push; git push --tags`
7. Proceede with the `node-osrm` release as outlined in the repository.
8. Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
+239
View File
@@ -0,0 +1,239 @@
# Testsuite
OSRM comes with a testsuite containing both unit-tests using the Boost library and cucucmber.js for scenario driven testing.
## Unit Tests
For a general introduction on Boost.Test have a look at [its docs](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/index.html).
### Separate Test Binaries
Unit tests should be registered according to the sub-project they're in.
If you want to write tests for utility functions, add them to the utility test binary.
See `CMakeLists.txt` in the unit test directory for how to register new unit tests.
### Using Boost.Test Primitives
There is a difference between only reporting a failed condition and aborting the test right at a failed condition.
Have a look at [`BOOST_CHECK` vs `BOOST_REQUIRE`](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level.html).
Instead of manually checking e.g. for equality, less than, if a function throws etc. use their [corresponding Boost.Test primitives](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref.html).
If you use `BOOST_CHECK_EQUAL` you have to implement `operator<<` for your type so that Boost.Test can print mismatches.
If you do not want to do this, define `BOOST_TEST_DONT_PRINT_LOG_VALUE` (and undef it after the check call) or sidestep it with `BOOST_CHECK(fst == snd);`.
### Test Fixture
If you need to test features on a real dataset (think about this twice: prefer cucumber and dataset-independent tests for their reproducibility and minimality), there is a fixed dataset in `test/data`.
This dataset is a small extract and may not even contain all tags or edge cases.
Furthermore this dataset is not in sync with what you see in up-to-date OSM maps or on the demo server.
See the library tests for how to add new dataset dependent tests.
## Cucumber
For a general introduction on cucumber in our testsuite, have a look at [the wiki](https://github.com/Project-OSRM/osrm-backend/wiki/Cucumber-Test-Suite).
This documentation aims to supply a guideline on how to write cucumber tests that test new features introduced into osrm.
### Test the feature
It is often tempting to reduce the test to a path and accompanying instructions. Instructions can and will change over the course of improving guidance.
Instructions should only be used when writing a feature located in `features/guidance`. All other features should avoid using instructions at all.
### Write Tests to Scale
OSRM is a navigation engine. Tests should always consider this background.
An important implication is the grid size. If tests use a very small grid size, you run into the chance of instructions being omitted.
For example:
```
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Testbot - Straight Road
Given the node map
| a | b | c | d |
And the ways
| nodes | highway |
| ab | primary |
| bc | primary |
| cd | primary |
When I route I should get
| from | to | route |
| a | d | ab,bc,cd,cd |
```
In a navigation engine, the instructions
- depart east on ab
- in 10 meters the road name changes to bc
- in 10 meters the road name changes to cd
- you arrived at cd
would be impossible to announce and not helpful at all.
Since no actual choices exist, the route you get could result in `ab,cd` and simply say `depart` and `arrive`.
To prevent such surprises, always consider the availability of other roads and use grid sizes/road lengths that correspond to actually reasonable scenarios in a road network.
### Use names
If you specify many nodes in close succession to present a specific road geometry, consider using `name` to indicate to OSRM that the segment is a single road.
```
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Testbot - Straight Road
Given the node map
| a | b | c | d |
And the ways
| nodes | highway | name |
| ab | primary | road |
| bc | primary | road |
| cd | primary | road |
When I route I should get
| from | to | route | turns |
| a | d | road,road | depart,arrive |
```
Guidance guarantees only essential maneuvers. You will always see `depart` and `arrive` as well as all turns that are not obvious.
So the following scenario does not change the instructions
```
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Testbot - Straight Road
Given the node map
| a | b |
| d | c |
And the ways
| nodes | highway | name |
| ab | primary | road |
| bc | primary | road |
| cd | primary | road |
When I route I should get
| from | to | route | turns |
| a | d | road,road | depart,arrive |
```
but if we modify it to
```
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Testbot - Straight Road
Given the node map
| a | b | e |
| d | c | |
And the ways
| nodes | highway | name |
| ab | primary | road |
| bc | primary | road |
| cd | primary | road |
| be | primary | turn |
When I route I should get
| from | to | route | turns |
| a | d | road,road,road | depart,continue right,arrive |
```
### Test all directions
Modelling a road as roundabout has an implied oneway tag associated with it. In the following case, we can route from `a` to `d` but not from `d` to `a`.
To discover those errors, make sure to check for all allowed directions.
```
Scenario: Enter and Exit mini roundabout with sharp angle # features/guidance/mini-roundabout.feature:37
Given the profile "car" # features/step_definitions/data.js:8
Given a grid size of 10 meters # features/step_definitions/data.js:20
Given the node map # features/step_definitions/data.js:45
| a | b | |
| | c | d |
And the ways # features/step_definitions/data.js:128
| nodes | highway | name |
| ab | tertiary | MySt |
| bc | roundabout | |
| cd | tertiary | MySt |
When I route I should get # features/step_definitions/routing.js:4
| from | to | route | turns | # |
| a | d | MySt,MySt | depart,arrive | # suppress multiple enter/exit mini roundabouts |
| d | a | MySt,MySt | depart,arrive | # suppress multiple enter/exit mini roundabouts |
Tables were not identical:
| from | to | route | turns | #
| a | d | MySt,MySt | depart,arrive | # suppress multiple enter/exit mini roundabouts |
| (-) d | (-) a | (-) MySt,MySt | (-) depart,arrive | (-) # suppress multiple enter/exit mini roundabouts |
| (+) d | (+) a | (+) | (+) | (+) # suppress multiple enter/exit mini roundabouts |
```
### Prevent Randomness
Some features in OSRM can result in strange experiences during testcases. To prevent some of these issues, follow the guidelines below.
#### Use Waypoints
Using grid nodes as waypoints offers the chance of unwanted side effects.
OSRM converts the grid into a so called edge-based graph.
```
Scenario: Testbot - Intersection
Given the node map
| | e | |
| b | a | d |
| | c | |
And the ways
| nodes | highway | oneway |
| ab | primary | yes |
| ac | primary | yes |
| ad | primary | yes |
| ae | primary | yes |
```
Selecting `a` as a `waypoint` results in four possible starting locations. Which one of the routes `a,b`, `a,c`, `a,d`, or `a,e` is found is pure chance and depends on the order in the static `r-tree`.
To guarantee discovery, use:
```
Scenario: Testbot - Intersection
Given the node map
| | | e | | |
| | | 4 | | |
| b | 1 | a | 3 | d |
| | | 2 | | |
| | | c | | |
And the ways
| nodes | highway | oneway |
| ab | primary | yes |
| ac | primary | yes |
| ad | primary | yes |
| ae | primary | yes |
```
And use `1`,`2`,`3`, and `4` as starting waypoints. The routes `1,b`, `2,c`, `3,d`, and `4,e` can all be discovered.
#### Allow For Small Offsets
Whenever you are independent of the start location (see use waypoints), the waypoint chosen as start/end location can still influence distances/durations.
If you are testing for a duration metric, allow for a tiny offset to ensure a passing test in the presence of rounding/snapping issues.
#### Don't Rely on Alternatives
Alternative route discovery is a random feature in itself. The discovery of routes depends on the contraction order of roads and cannot be assumed successful, ever.
+10 -7
View File
@@ -6,10 +6,13 @@ Please create a directory and run cmake from there, passing the path to this sou
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
endif()
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_BUILD_TYPE Release)
endif()
project(osrm-example C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -19,15 +22,15 @@ else()
message(WARNING "Building on a 32 bit system is unsupported")
endif()
if(WIN32 AND MSVC_VERSION LESS 1800)
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif()
link_directories(${LibOSRM_LIBRARY_DIRS})
add_executable(osrm-example example.cpp)
find_package(LibOSRM REQUIRED)
find_package(Boost 1.49.0 COMPONENTS filesystem system thread REQUIRED)
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${Boost_LIBRARIES})
include_directories(SYSTEM ${LibOSRM_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${LibOSRM_DEPENDENT_LIBRARIES})
include_directories(SYSTEM ${LibOSRM_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS ${LibOSRM_CXXFLAGS})
+24 -26
View File
@@ -1,13 +1,24 @@
# - Try to find LibOSRM
# Once done this will define
# LibOSRM_FOUND - System has LibOSRM
# LibOSRM_INCLUDE_DIRS - The LibOSRM include directories
# LibOSRM_LIBRARIES - The libraries needed to use LibOSRM
# LibOSRM_DEFINITIONS - Compiler switches required for using LibOSRM
# LibOSRM_LIBRARIES - The libraries and ldflags needed to use LibOSRM
# LibOSRM_DEPENDENT_LIBRARIES - The libraries and ldflags need to link LibOSRM dependencies
# LibOSRM_LIBRARY_DIRS - The libraries paths needed to find LibOSRM
# LibOSRM_CXXFLAGS - Compiler switches required for using LibOSRM
find_package(PkgConfig)
pkg_check_modules(PC_LibOSRM QUIET libosrm)
set(LibOSRM_DEFINITIONS ${PC_LibOSRM_CFLAGS_OTHER})
pkg_search_module(PC_LibOSRM QUIET libosrm)
function(JOIN VALUES GLUE OUTPUT)
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
list(REMOVE_ITEM PC_LibOSRM_CFLAGS " ")
JOIN("${PC_LibOSRM_CFLAGS}" " " output)
set(LibOSRM_CXXFLAGS ${output})
set(LibOSRM_LIBRARY_DIRS ${PC_LibOSRM_LIBRARY_DIRS})
find_path(LibOSRM_INCLUDE_DIR osrm/osrm.hpp
PATH_SUFFIXES osrm include/osrm include
@@ -19,8 +30,6 @@ find_path(LibOSRM_INCLUDE_DIR osrm/osrm.hpp
/opt/local
/opt)
set(LibOSRM_INCLUDE_DIRS ${LibOSRM_INCLUDE_DIR} ${LibOSRM_INCLUDE_DIR}/osrm)
find_library(TEST_LibOSRM_STATIC_LIBRARY Names osrm.lib libosrm.a
PATH_SUFFIXES osrm lib/osrm lib
HINTS ${PC_LibOSRM_LIBDIR} ${PC_LibOSRM_LIBRARY_DIRS}
@@ -30,7 +39,7 @@ find_library(TEST_LibOSRM_STATIC_LIBRARY Names osrm.lib libosrm.a
/usr
/opt/local
/opt)
find_library(TEST_LibOSRM_DYNAMIC_LIBRARY Names osrm.dynlib libosrm.so
find_library(TEST_LibOSRM_DYNAMIC_LIBRARY Names libosrm.dylib libosrm.so
PATH_SUFFIXES osrm lib/osrm lib
HINTS ${PC_LibOSRM_LIBDIR} ${PC_LibOSRM_LIBRARY_DIRS}
~/Library/Frameworks
@@ -40,26 +49,15 @@ find_library(TEST_LibOSRM_DYNAMIC_LIBRARY Names osrm.dynlib libosrm.so
/opt/local
/opt)
if (NOT ("${TEST_LibOSRM_STATIC_LIBRARY}" STREQUAL "TEST_LibOSRM_STATIC_LIBRARY-NOTFOUND"))
if ("${PC_LibOSRM_STATIC_LIBRARIES}" STREQUAL "")
set(LibOSRM_STATIC_LIBRARIES ${TEST_LibOSRM_STATIC_LIBRARY})
else()
set(LibOSRM_STATIC_LIBRARIES ${PC_LibOSRM_STATIC_LIBRARIES})
endif()
set(LibOSRM_LIBRARIES ${LibOSRM_STATIC_LIBRARIES})
endif()
if (NOT ("${TEST_LibOSRM_DYNAMIC_LIBRARY}" STREQUAL "TEST_LibOSRM_DYNAMIC_LIBRARY-NOTFOUND"))
if ("${PC_LibOSRM_LIBRARIES}" STREQUAL "")
set(LibOSRM_DYNAMIC_LIBRARIES ${TEST_LibOSRM_DYNAMIC_LIBRARY})
else()
set(LibOSRM_DYNAMIC_LIBRARIES ${PC_LibOSRM_LIBRARIES})
endif()
set(LibOSRM_LIBRARIES ${LibOSRM_DYNAMIC_LIBRARIES})
endif()
set(LibOSRM_DEPENDENT_LIBRARIES ${PC_LibOSRM_STATIC_LDFLAGS})
set(LibOSRM_LIBRARIES ${PC_LibOSRM_LDFLAGS})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBOSRM_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibOSRM DEFAULT_MSG
LibOSRM_LIBRARIES LibOSRM_INCLUDE_DIR)
LibOSRM_LIBRARY_DIRS
LibOSRM_CXXFLAGS
LibOSRM_LIBRARIES
LibOSRM_DEPENDENT_LIBRARIES
LibOSRM_INCLUDE_DIR)
+5 -5
View File
@@ -1,20 +1,20 @@
#include "osrm/match_parameters.hpp"
#include "osrm/nearest_parameters.hpp"
#include "osrm/route_parameters.hpp"
#include "osrm/table_parameters.hpp"
#include "osrm/nearest_parameters.hpp"
#include "osrm/trip_parameters.hpp"
#include "osrm/match_parameters.hpp"
#include "osrm/coordinate.hpp"
#include "osrm/engine_config.hpp"
#include "osrm/json_container.hpp"
#include "osrm/status.hpp"
#include "osrm/osrm.hpp"
#include "osrm/status.hpp"
#include <exception>
#include <iostream>
#include <string>
#include <utility>
#include <iostream>
#include <exception>
#include <cstdlib>
+3 -3
View File
@@ -4,7 +4,7 @@ Feature: Bike - Squares and other areas
Background:
Given the profile "bicycle"
@square @mokob @2154
@square
Scenario: Bike - Route along edge of a squares
Given the node map
| x | |
@@ -50,7 +50,7 @@ Feature: Bike - Squares and other areas
| d | a | xa,xa |
| a | d | xa,xa |
@parking @mokob @2154
@parking
Scenario: Bike - parking areas
Given the node map
| e | | | f |
@@ -78,7 +78,7 @@ Feature: Bike - Squares and other areas
| a | d | abcda,abcda |
@train @platform @mokob @2154
@train @platform
Scenario: Bike - railway platforms
Given the node map
| x | a | b | y |
+13 -13
View File
@@ -1,5 +1,5 @@
@routing @bicycle @bridge
Feature: Bicycle - Handle movable bridge
Feature: Bicycle - Handle cycling
Background:
Given the profile "bicycle"
@@ -18,14 +18,14 @@ Feature: Bicycle - Handle movable bridge
When I route I should get
| from | to | route | modes |
| a | g | abc,cde,efg,efg | cycling,movable bridge,cycling,cycling |
| b | f | abc,cde,efg,efg | cycling,movable bridge,cycling,cycling |
| e | c | cde,cde | movable bridge,movable bridge |
| e | b | cde,abc,abc | movable bridge,cycling,cycling |
| e | a | cde,abc,abc | movable bridge,cycling,cycling |
| c | e | cde,cde | movable bridge,movable bridge |
| c | f | cde,efg,efg | movable bridge,cycling,cycling |
| c | g | cde,efg,efg | movable bridge,cycling,cycling |
| a | g | abc,cde,efg,efg | cycling,cycling,cycling,cycling |
| b | f | abc,cde,efg,efg | cycling,cycling,cycling,cycling |
| e | c | cde,cde | cycling,cycling |
| e | b | cde,abc,abc | cycling,cycling,cycling |
| e | a | cde,abc,abc | cycling,cycling,cycling |
| c | e | cde,cde | cycling,cycling |
| c | f | cde,efg,efg | cycling,cycling,cycling |
| c | g | cde,efg,efg | cycling,cycling,cycling |
Scenario: Bicycle - Properly handle durations
Given the node map
@@ -41,7 +41,7 @@ Feature: Bicycle - Handle movable bridge
When I route I should get
| from | to | route | modes | speed |
| a | g | abc,cde,efg,efg | cycling,movable bridge,cycling,cycling | 5 km/h |
| b | f | abc,cde,efg,efg | cycling,movable bridge,cycling,cycling | 4 km/h |
| c | e | cde,cde | movable bridge,movable bridge | 2 km/h |
| e | c | cde,cde | movable bridge,movable bridge | 2 km/h |
| a | g | abc,cde,efg,efg | cycling,cycling,cycling,cycling | 5 km/h |
| b | f | abc,cde,efg,efg | cycling,cycling,cycling,cycling | 4 km/h |
| c | e | cde,cde | cycling,cycling | 2 km/h |
| e | c | cde,cde | cycling,cycling | 2 km/h |
+5 -5
View File
@@ -10,13 +10,13 @@ Feature: Bike - Street names in instructions
| | c |
And the ways
| nodes | name |
| ab | My Way |
| bc | Your Way |
| nodes | name | ref |
| ab | My Way | A6 |
| bc | Your Way | A7 |
When I route I should get
| from | to | route |
| a | c | My Way,Your Way,Your Way |
| from | to | route |
| a | c | My Way (A6),Your Way (A7),Your Way (A7) |
@unnamed
Scenario: Bike - Use way type to describe unnamed ways
+14 -14
View File
@@ -48,22 +48,22 @@ Feature: Bike - Oneway streets
Scenario: Bike - Implied oneways
Then routability should be
| highway | foot | bicycle | junction | forw | backw |
| | no | | | x | x |
| | no | | roundabout | x | |
| motorway | no | yes | | x | |
| motorway_link | no | yes | | x | |
| motorway | no | yes | roundabout | x | |
| motorway_link | no | yes | roundabout | x | |
| highway | foot | bicycle | junction | forw | backw | # |
| | no | | | x | x | |
| | no | | roundabout | x | | |
| motorway | no | yes | | x | | |
| motorway_link | no | yes | | x | x | does not imply oneway |
| motorway | no | yes | roundabout | x | | |
| motorway_link | no | yes | roundabout | x | | |
Scenario: Bike - Overriding implied oneways
Then routability should be
| highway | foot | junction | oneway | forw | backw |
| primary | no | roundabout | no | x | x |
| primary | no | roundabout | yes | x | |
| motorway_link | no | | -1 | | |
| trunk_link | no | | -1 | | |
| primary | no | roundabout | -1 | | x |
| highway | foot | junction | oneway | forw | backw |
| primary | no | roundabout | no | x | x |
| primary | no | roundabout | yes | x | |
| motorway_link | no | | -1 | | |
| trunk_link | no | | -1 | | |
| primary | no | roundabout | -1 | | x |
Scenario: Bike - Oneway:bicycle should override normal oneways tags
Then routability should be
@@ -115,7 +115,7 @@ Feature: Bike - Oneway streets
Scenario: Bike - Two consecutive oneways
Given the node map
| a | b | c |
| a | b | | c |
And the ways
| nodes | oneway |
+1 -1
View File
@@ -14,7 +14,7 @@ Feature: Bike - Way ref
When I route I should get
| from | to | route |
| a | b | Utopia Drive / E7,Utopia Drive / E7 |
| a | b | Utopia Drive (E7),Utopia Drive (E7) |
Scenario: Bike - Way with only ref
Given the node map
-3
View File
@@ -34,7 +34,6 @@ OSRM will use 4/5 of the projected free-flow speed.
| a | b | ab,ab | 47 km/h +- 1 |
| b | c | bc,bc | 47 km/h +- 1 |
@mokob @2162
Scenario: Car - Advisory speed overwrites backwards maxspeed
Given the node map
| a | b | c |
@@ -49,7 +48,6 @@ OSRM will use 4/5 of the projected free-flow speed.
| b | a | ab,ab | 47 km/h +- 1 |
| c | b | bc,bc | 47 km/h +- 1 |
@mokob @2162 @deleteme
Scenario: Car - Advisory speed overwrites backwards maxspeed
Given the node map
| a | b | c | d |
@@ -65,7 +63,6 @@ OSRM will use 4/5 of the projected free-flow speed.
| c | b | bc,bc | 47 km/h +- 1 |
| d | c | cd,cd | 47 km/h +- 1 |
@mokob @2162
Scenario: Car - Directional advisory speeds play nice with eachother
Given the node map
| a | b | c |
+13 -13
View File
@@ -1,5 +1,5 @@
@routing @car @bridge
Feature: Car - Handle movable bridge
Feature: Car - Handle driving
Background:
Given the profile "car"
@@ -18,14 +18,14 @@ Feature: Car - Handle movable bridge
When I route I should get
| from | to | route | modes |
| a | g | abc,cde,efg,efg | driving,movable bridge,driving,driving |
| b | f | abc,cde,efg,efg | driving,movable bridge,driving,driving |
| e | c | cde,cde | movable bridge,movable bridge |
| e | b | cde,abc,abc | movable bridge,driving,driving |
| e | a | cde,abc,abc | movable bridge,driving,driving |
| c | e | cde,cde | movable bridge,movable bridge |
| c | f | cde,efg,efg | movable bridge,driving,driving |
| c | g | cde,efg,efg | movable bridge,driving,driving |
| a | g | abc,cde,efg,efg | driving,driving,driving,driving |
| b | f | abc,cde,efg,efg | driving,driving,driving,driving |
| e | c | cde,cde | driving,driving |
| e | b | cde,abc,abc | driving,driving,driving |
| e | a | cde,abc,abc | driving,driving,driving |
| c | e | cde,cde | driving,driving |
| c | f | cde,efg,efg | driving,driving,driving |
| c | g | cde,efg,efg | driving,driving,driving |
Scenario: Car - Properly handle durations
Given the node map
@@ -41,7 +41,7 @@ Feature: Car - Handle movable bridge
When I route I should get
| from | to | route | modes | speed |
| a | g | abc,cde,efg,efg | driving,movable bridge,driving,driving | 7 km/h |
| b | f | abc,cde,efg,efg | driving,movable bridge,driving,driving | 5 km/h |
| c | e | cde,cde | movable bridge,movable bridge | 2 km/h |
| e | c | cde,cde | movable bridge,movable bridge | 2 km/h |
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 7 km/h |
| b | f | abc,cde,efg,efg | driving,driving,driving,driving | 5 km/h |
| c | e | cde,cde | driving,driving | 2 km/h |
| e | c | cde,cde | driving,driving | 2 km/h |
+17
View File
@@ -18,6 +18,23 @@ Feature: Car - Street names in instructions
| from | to | route |
| a | c | My Way,Your Way (A1),Your Way (A1) |
Scenario: Car - A named street with pronunciation
Given the node map
| a | b | d |
| | 1 | |
| | c | |
And the ways
| nodes | name |name:pronunciation | ref |
| ab | My Way | | |
| bd | My Way | meyeway | A1 |
| cd | Your Way | yourewaye | |
When I route I should get
| from | to | route | pronunciations |
| a | d | My Way,My Way (A1) | ,meyeway |
| 1 | c | Your Way,Your Way | yourewaye,yourewaye |
@todo
Scenario: Car - Use way type to describe unnamed ways
Given the node map
+13 -11
View File
@@ -17,19 +17,21 @@ Feature: Car - Oneway streets
Scenario: Car - Implied oneways
Then routability should be
| highway | junction | forw | backw |
| motorway | | x | |
| motorway_link | | x | |
| primary | | x | x |
| motorway | roundabout | x | |
| motorway_link | roundabout | x | |
| primary | roundabout | x | |
| highway | junction | forw | backw | # |
| motorway | | x | | |
| motorway_link | | x | x | does not imply oneway |
| primary | | x | x | |
| motorway | roundabout | x | | |
| motorway_link | roundabout | x | | |
| primary | roundabout | x | | |
Scenario: Car - Overrule implied oneway
Then routability should be
| highway | oneway | forw | backw |
| motorway | no | x | x |
| motorway_link | no | x | x |
| highway | oneway | forw | backw | # |
| motorway | no | x | x | |
| motorway_link | no | x | x | |
| motorway_link | yes | x | | |
| motorway_link | | x | x | does not imply onway |
Scenario: Car - Around the Block
Given the node map
@@ -66,7 +68,7 @@ Feature: Car - Oneway streets
Scenario: Car - Two consecutive oneways
Given the node map
| a | b | c |
| a | b | | c |
And the ways
| nodes | oneway |
+1
View File
@@ -5,6 +5,7 @@ Feature: Car - Turn restrictions
Background: Use car routing
Given the profile "car"
Given a grid size of 200 meters
@no_turning
Scenario: Car - No left turn
@@ -31,7 +31,7 @@ Feature: Traffic - speeds
4,1,27
"""
Scenario: Weighting not based on raster sources
Scenario: Weighting based on speed file
Given the profile "testbot"
Given the extract extra arguments "--generate-edge-lookup"
Given the contract extra arguments "--segment-speed-file speeds.csv"
@@ -0,0 +1,95 @@
@routing @speed @traffic
Feature: Traffic - turn penalties
Background: Evenly spaced grid with multiple intersections
Given the node map
| | a:1 | | b:2 | |
| c:3 | d:4 | e:5 | f:6 | g:7 |
| | h:8 | | i:9 | |
| j:10 | k:11 | l:12 | m:13 | n:14 |
| | o:15 | | p:16 | |
And the ways
| nodes | highway |
| ad | primary |
| cd | primary |
| def | primary |
| dhk | primary |
| bf | primary |
| fg | primary |
| fim | primary |
| jk | primary |
| klm | primary |
| ko | primary |
| mn | primary |
| mp | primary |
And the profile "car"
And the extract extra arguments "--generate-edge-lookup"
Scenario: Weighting not based on turn penalty file
When I route I should get
| from | to | route | speed | time |
| a | h | ad,dhk,dhk | 63 km/h | 11.5s +-1 |
# straight
| i | g | fim,fg,fg | 59 km/h | 12s +-1 |
# right
| a | e | ad,def,def | 57 km/h | 12.5s +-1 |
# left
| c | g | cd,def,fg,fg | 63 km/h | 23s +-1 |
# double straight
| p | g | mp,fim,fg,fg | 61 km/h | 23.5s +-1 |
# straight-right
| a | l | ad,dhk,klm,klm | 60 km/h | 24s +-1 |
# straight-left
| l | e | klm,dhk,def,def | 59 km/h | 24.5s +-1 |
# double right
| g | n | fg,fim,mn,mn | 57 km/h | 25s +-1 |
# double left
Scenario: Weighting based on turn penalty file
Given the turn penalty file
"""
9,6,7,1.8
9,13,14,24.5
8,4,3,26
12,11,8,9
8,11,12,13
1,4,5,-0.2
"""
And the contract extra arguments "--turn-penalty-file penalties.csv"
When I route I should get
| from | to | route | speed | time |
| a | h | ad,dhk,dhk | 63 km/h | 11.5s +-1 |
# straight
| i | g | fim,fg,fg | 55 km/h | 13s +-1 |
# right - ifg penalty
| a | e | ad,def,def | 64 km/h | 11s +-1 |
# left - faster because of negative ade penalty
| c | g | cd,def,fg,fg | 63 km/h | 23s +-1 |
# double straight
| p | g | mp,fim,fg,fg | 59 km/h | 24.5s +-1 |
# straight-right - ifg penalty
| a | l | ad,def,fim,klm,klm | 61 km/h | 35.5s +-1 |
# was straight-left - forced around by hkl penalty
| l | e | klm,fim,def,def | 57 km/h | 25s +-1 |
# double right - forced left by lkh penalty
| g | n | fg,fim,mn,mn | 30 km/h | 47.5s +-1 |
# double left - imn penalty
| j | c | jk,klm,fim,def,cd,cd | 60 km/h | 48s +-1 |
# double left - hdc penalty ever so slightly higher than imn; forces all the way around
Scenario: Too-negative penalty clamps, but does not fail
Given the contract extra arguments "--turn-penalty-file penalties.csv"
And the profile "testbot"
And the turn penalty file
"""
1,4,5,-10
"""
When I route I should get
| from | to | route | time |
| a | d | ad,ad | 10s +-1 |
| a | e | ad,def,def | 10s +-1 |
| b | f | bf,bf | 10s +-1 |
| b | g | bf,fg,fg | 20s +-1 |
+5 -5
View File
@@ -10,13 +10,13 @@ Feature: Foot - Street names in instructions
| | c |
And the ways
| nodes | name |
| ab | My Way |
| bc | Your Way |
| nodes | name | ref |
| ab | My Way | A6 |
| bc | Your Way | B7 |
When I route I should get
| from | to | route |
| a | c | My Way,Your Way,Your Way |
| from | to | route |
| a | c | My Way (A6),Your Way (B7),Your Way (B7) |
@unnamed
Scenario: Foot - Use way type to describe unnamed ways
+1 -1
View File
@@ -14,7 +14,7 @@ Feature: Foot - Way ref
When I route I should get
| from | to | route |
| a | b | Utopia Drive / E7,Utopia Drive / E7 |
| a | b | Utopia Drive (E7),Utopia Drive (E7) |
Scenario: Foot - Way with only ref
Given the node map
@@ -0,0 +1,120 @@
@routing @car @bridge @tunnel @guidance
Feature: Car - Guidance - Bridges and Tunnels
Background:
Given the profile "car"
And a grid size of 100 meters
Scenario: Simple Bridge
Given the node map
| a | b | c | d |
And the ways
| nodes | highway | bridge | name |
| ab | primary | | Hauptstraße |
| bc | primary | yes | Hauptstraßenbrücke |
| cd | primary | | Hauptstraße |
When I route I should get
| from | to | route | turns |
| a | d | Hauptstraße,Hauptstraße | depart,arrive |
Scenario: Bridge with Immediate Turn
Given the node map
| | | | d |
| a | | b | c |
| | | | e |
And the ways
| nodes | highway | bridge | name |
| ab | primary | | Hauptstraße |
| bc | primary | yes | Hauptstraßenbrücke |
| dce | primary | | Nebenstraße |
When I route I should get
| from | to | route | turns |
| a | d | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road left,arrive |
| a | e | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road right,arrive |
| e | a | Nebenstraße,Hauptstraßenbrücke,Hauptstraße | depart,turn left,arrive |
| d | a | Nebenstraße,Hauptstraßenbrücke,Hauptstraße | depart,turn right,arrive |
Scenario: Bridge with Immediate Turn Front and Back
Given the node map
| f | | | d |
| a | | b | c |
| g | | | e |
And the ways
| nodes | highway | bridge | name |
| ab | primary | | Hauptstraße |
| bc | primary | yes | Hauptstraßenbrücke |
| dce | primary | | Nebenstraße |
| gaf | primary | | Anderestraße |
When I route I should get
| from | to | route | turns |
| f | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road left,arrive |
| f | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road right,arrive |
| g | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road left,arrive |
| g | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road right,arrive |
| e | f | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn left,end of road right,arrive |
| e | g | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn left,end of road left,arrive |
| d | f | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn right,end of road right,arrive |
| d | g | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn right,end of road left,arrive |
Scenario: Simple Tunnel
Given the node map
| a | b | c | d |
And the ways
| nodes | highway | tunnel | name |
| ab | primary | | Hauptstraße |
| bc | primary | yes | Hauptstraßentunnel |
| cd | primary | | Hauptstraße |
When I route I should get
| from | to | route | turns |
| a | d | Hauptstraße,Hauptstraße | depart,arrive |
Scenario: Tunnel with Immediate Turn
Given the node map
| | | | d |
| a | | b | c |
| | | | e |
And the ways
| nodes | highway | tunnel | name |
| ab | primary | | Hauptstraße |
| bc | primary | yes | Hauptstraßentunnel |
| dce | primary | | Nebenstraße |
When I route I should get
| from | to | route | turns |
| a | d | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road left,arrive |
| a | e | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road right,arrive |
| e | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn left,arrive |
| d | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn right,arrive |
Scenario: Tunnel with Immediate Turn Front and Back
Given the node map
| f | | | d |
| a | | b | c |
| g | | | e |
And the ways
| nodes | highway | bridge | name |
| ab | primary | | Hauptstraße |
| bc | primary | yes | Hauptstraßentunnel |
| dce | primary | | Nebenstraße |
| gaf | primary | | Anderestraße |
When I route I should get
| from | to | route | turns |
| f | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road left,arrive |
| f | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road right,arrive |
| g | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road left,arrive |
| g | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road right,arrive |
| e | f | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn left,end of road right,arrive |
| e | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn left,end of road left,arrive |
| d | f | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,end of road right,arrive |
| d | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,end of road left,arrive |
+632
View File
@@ -0,0 +1,632 @@
@routing @guidance @collapsing
Feature: Collapse
Background:
Given the profile "car"
Given a grid size of 20 meters
Scenario: Segregated Intersection, Cross Belonging to Single Street
Given the node map
| | | i | l | | |
| | | | | | |
| d | | c | b | | a |
| e | | f | g | | h |
| | | | | | |
| | | j | k | | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | first | yes |
| cd | primary | first | yes |
| ef | primary | first | yes |
| fg | primary | first | yes |
| gh | primary | first | yes |
| ic | primary | second | yes |
| bl | primary | second | yes |
| kg | primary | second | yes |
| fj | primary | second | yes |
| cf | primary | first | yes |
| gb | primary | first | yes |
When I route I should get
| waypoints | route | turns |
| a,l | first,second,second | depart,turn right,arrive |
| a,d | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,h | first,first,first | depart,continue uturn,arrive |
| e,j | first,second,second | depart,turn right,arrive |
| e,h | first,first | depart,arrive |
| e,l | first,second,second | depart,turn left,arrive |
| e,d | first,first,first | depart,continue uturn,arrive |
| k,h | second,first,first | depart,turn right,arrive |
| k,l | second,second | depart,arrive |
| k,d | second,first,first | depart,turn left,arrive |
| k,j | second,second,second | depart,continue uturn,arrive |
| i,d | second,first,first | depart,turn right,arrive |
| i,j | second,second | depart,arrive |
| i,h | second,first,first | depart,turn left,arrive |
| i,l | second,second,second | depart,continue uturn,arrive |
Scenario: Segregated Intersection, Cross Belonging to Correct Street
Given the node map
| | | i | l | | |
| | | | | | |
| d | | c | b | | a |
| e | | f | g | | h |
| | | | | | |
| | | j | k | | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | first | yes |
| cd | primary | first | yes |
| ef | primary | first | yes |
| fg | primary | first | yes |
| gh | primary | first | yes |
| ic | primary | second | yes |
| bl | primary | second | yes |
| kg | primary | second | yes |
| fj | primary | second | yes |
| cf | primary | second | yes |
| gb | primary | second | yes |
When I route I should get
| waypoints | route | turns |
| a,l | first,second,second | depart,turn right,arrive |
| a,d | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,h | first,first,first | depart,continue uturn,arrive |
| e,j | first,second,second | depart,turn right,arrive |
| e,h | first,first | depart,arrive |
| e,l | first,second,second | depart,turn left,arrive |
| e,d | first,first,first | depart,continue uturn,arrive |
| k,h | second,first,first | depart,turn right,arrive |
| k,l | second,second | depart,arrive |
| k,d | second,first,first | depart,turn left,arrive |
| k,j | second,second,second | depart,continue uturn,arrive |
| i,d | second,first,first | depart,turn right,arrive |
| i,j | second,second | depart,arrive |
| i,h | second,first,first | depart,turn left,arrive |
| i,l | second,second,second | depart,continue uturn,arrive |
Scenario: Segregated Intersection, Cross Belonging to Mixed Streets
Given the node map
| | | i | l | | |
| | | | | | |
| d | | c | b | | a |
| e | | f | g | | h |
| | | | | | |
| | | j | k | | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | second | yes |
| cd | primary | first | yes |
| ef | primary | first | yes |
| fg | primary | first | yes |
| gh | primary | first | yes |
| ic | primary | second | yes |
| bl | primary | second | yes |
| kg | primary | second | yes |
| fj | primary | second | yes |
| cf | primary | second | yes |
| gb | primary | first | yes |
When I route I should get
| waypoints | route | turns |
| a,l | first,second,second | depart,turn right,arrive |
| a,d | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,h | first,first,first | depart,continue uturn,arrive |
| e,j | first,second,second | depart,turn right,arrive |
| e,h | first,first | depart,arrive |
| e,l | first,second,second | depart,turn left,arrive |
| e,d | first,first,first | depart,continue uturn,arrive |
| k,h | second,first,first | depart,turn right,arrive |
| k,l | second,second | depart,arrive |
| k,d | second,first,first | depart,turn left,arrive |
| k,j | second,second,second | depart,continue uturn,arrive |
| i,d | second,first,first | depart,turn right,arrive |
| i,j | second,second | depart,arrive |
| i,h | second,first,first | depart,turn left,arrive |
| i,l | second,second,second | depart,continue uturn,arrive |
Scenario: Partly Segregated Intersection, Two Segregated Roads
Given the node map
| | g | | h | |
| | | | | |
| | | | | |
| c | | b | | a |
| d | | e | | f |
| | | | | |
| | | | | |
| | j | | i | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | first | yes |
| de | primary | first | yes |
| ef | primary | first | yes |
| be | primary | first | no |
| gbh | primary | second | yes |
| iej | primary | second | yes |
When I route I should get
| waypoints | route | turns |
| a,h | first,second,second | depart,turn right,arrive |
| a,c | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,f | first,first,first | depart,continue uturn,arrive |
| d,j | first,second,second | depart,turn right,arrive |
| d,f | first,first | depart,arrive |
| d,h | first,second,second | depart,turn left,arrive |
| d,c | first,first,first | depart,continue uturn,arrive |
| g,c | second,first,first | depart,turn right,arrive |
| g,j | second,second | depart,arrive |
| g,f | second,first,first | depart,turn left,arrive |
| g,h | second,second,second | depart,continue uturn,arrive |
| i,f | second,first,first | depart,turn right,arrive |
| i,h | second,second | depart,arrive |
| i,c | second,first,first | depart,turn left,arrive |
| i,j | second,second,second | depart,continue uturn,arrive |
Scenario: Partly Segregated Intersection, Two Segregated Roads, Intersection belongs to Second
Given the node map
| | g | | h | |
| | | | | |
| | | | | |
| c | | b | | a |
| d | | e | | f |
| | | | | |
| | | | | |
| | j | | i | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | first | yes |
| de | primary | first | yes |
| ef | primary | first | yes |
| be | primary | second | no |
| gbh | primary | second | yes |
| iej | primary | second | yes |
When I route I should get
| waypoints | route | turns |
| a,h | first,second,second | depart,turn right,arrive |
| a,c | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,f | first,first,first | depart,continue uturn,arrive |
| d,j | first,second,second | depart,turn right,arrive |
| d,f | first,first | depart,arrive |
| d,h | first,second,second | depart,turn left,arrive |
| d,c | first,first,first | depart,continue uturn,arrive |
| g,c | second,first,first | depart,turn right,arrive |
| g,j | second,second | depart,arrive |
| g,f | second,first,first | depart,turn left,arrive |
| g,h | second,second,second | depart,continue uturn,arrive |
| i,f | second,first,first | depart,turn right,arrive |
| i,h | second,second | depart,arrive |
| i,c | second,first,first | depart,turn left,arrive |
| i,j | second,second,second | depart,continue uturn,arrive |
Scenario: Segregated Intersection, Cross Belonging to Mixed Streets - Slight Angles
Given the node map
| | | i | l | | |
| | | | | | a |
| | | c | b | | h |
| d | | f | g | | |
| e | | | | | |
| | | j | k | | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | second | yes |
| cd | primary | first | yes |
| ef | primary | first | yes |
| fg | primary | first | yes |
| gh | primary | first | yes |
| ic | primary | second | yes |
| bl | primary | second | yes |
| kg | primary | second | yes |
| fj | primary | second | yes |
| cf | primary | second | yes |
| gb | primary | first | yes |
When I route I should get
| waypoints | route | turns |
| a,l | first,second,second | depart,turn right,arrive |
| a,d | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,h | first,first,first | depart,continue uturn,arrive |
| e,j | first,second,second | depart,turn right,arrive |
| e,h | first,first | depart,arrive |
| e,l | first,second,second | depart,turn left,arrive |
| e,d | first,first,first | depart,continue uturn,arrive |
| k,h | second,first,first | depart,turn right,arrive |
| k,l | second,second | depart,arrive |
| k,d | second,first,first | depart,turn left,arrive |
| k,j | second,second,second | depart,continue uturn,arrive |
| i,d | second,first,first | depart,turn right,arrive |
| i,j | second,second | depart,arrive |
| i,h | second,first,first | depart,turn left,arrive |
| i,l | second,second,second | depart,continue uturn,arrive |
Scenario: Segregated Intersection, Cross Belonging to Mixed Streets - Slight Angles (2)
Given the node map
| | | i | l | | |
| | | | | | |
| | | c | b | | |
| d | | f | g | | a |
| e | | | | | h |
| | | j | k | | |
And the ways
| nodes | highway | name | oneway |
| ab | primary | first | yes |
| bc | primary | second | yes |
| cd | primary | first | yes |
| ef | primary | first | yes |
| fg | primary | first | yes |
| gh | primary | first | yes |
| ic | primary | second | yes |
| bl | primary | second | yes |
| kg | primary | second | yes |
| fj | primary | second | yes |
| cf | primary | second | yes |
| gb | primary | first | yes |
When I route I should get
| waypoints | route | turns |
| a,l | first,second,second | depart,turn right,arrive |
| a,d | first,first | depart,arrive |
| a,j | first,second,second | depart,turn left,arrive |
| a,h | first,first,first | depart,continue uturn,arrive |
| e,j | first,second,second | depart,turn right,arrive |
| e,h | first,first | depart,arrive |
| e,l | first,second,second | depart,turn left,arrive |
| e,d | first,first,first | depart,continue uturn,arrive |
| k,h | second,first,first | depart,turn right,arrive |
| k,l | second,second | depart,arrive |
| k,d | second,first,first | depart,turn left,arrive |
| k,j | second,second,second | depart,continue uturn,arrive |
| i,d | second,first,first | depart,turn right,arrive |
| i,j | second,second | depart,arrive |
| i,h | second,first,first | depart,turn left,arrive |
| i,l | second,second,second | depart,continue uturn,arrive |
Scenario: Entering a segregated road
Given the node map
| | a | f | | |
| | | | | g |
| | b | e | | |
| | | | | |
| | | | | |
| c | d | | | |
And the ways
| nodes | highway | name | oneway |
| abc | primary | first | yes |
| def | primary | first | yes |
| be | primary | first | no |
| ge | primary | second | no |
When I route I should get
| waypoints | route | turns |
| d,c | first,first,first | depart,continue uturn,arrive |
| a,f | first,first,first | depart,continue uturn,arrive |
| a,g | first,second,second | depart,turn left,arrive |
| d,g | first,second,second | depart,turn right,arrive |
| g,f | second,first,first | depart,turn right,arrive |
| g,c | second,first,first | depart,end of road left,arrive |
Scenario: Do not collapse turning roads
Given the node map
| | | e | | |
| | | c | | d |
| a | | b | f | |
And the ways
| nodes | highway | name |
| ab | primary | first |
| bc | primary | first |
| cd | primary | first |
| ce | primary | second |
| bf | primary | third |
When I route I should get
| waypoints | route | turns |
| a,d | first,first,first,first | depart,continue left,continue right,arrive |
| a,e | first,second,second | depart,turn left,arrive |
| a,f | first,third,third | depart,turn straight,arrive |
Scenario: Bridge on unnamed road
Given the node map
| a | b | | | | c | d |
And the ways
| nodes | highway | name |
| ab | primary | |
| bc | primary | Bridge |
| cd | primary | |
When I route I should get
| waypoints | route | turns |
| a,d | , | depart,arrive |
Scenario: Crossing Bridge into Segregated Turn
Given the node map
| | | | | | f |
| i | h | | | g | e |
| a | b | | | c | d |
And the ways
| nodes | highway | oneway | name |
| ab | primary | yes | to_bridge |
| bc | primary | yes | bridge |
| cd | primary | yes | off_bridge |
| de | primary | yes | |
| ef | primary | no | target_road |
| eg | primary | yes | off_bridge |
| gh | primary | yes | bridge |
| hi | primary | yes | to_bridge |
When I route I should get
| waypoints | route | turns |
| a,f | to_bridge,target_road,target_road | depart,turn left,arrive |
Scenario: Pankenbruecke
Given the node map
| h | | | | | | i | | | | | | |
| | | b | c | d | e | f | | | | | | g |
| a | | | | | | | | | | | | |
And the ways
| nodes | highway | name | oneway |
| abh | primary | inroad | yes |
| bc | primary | inroad | no |
| cd | primary | bridge | no |
| defg | primary | outroad | no |
| fi | primary | cross | no |
When I route I should get
| waypoints | route | turns |
| a,g | inroad,outroad,outroad | depart,new name straight,arrive |
| a,i | inroad,cross,cross | depart,turn left,arrive |
Scenario: Close Turns - Don't Collapse
Given the node map
| | g | d | |
| | | | |
| e | b | c | f |
| | | | |
| | a | h | |
And the ways
| nodes | highway | name |
| ab | primary | in |
| ebcf | primary | cross |
| cd | primary | out |
| bg | primary | straight |
| ch | primary | reverse |
When I route I should get
| waypoints | route | turns |
| a,d | in,cross,out,out | depart,turn right,turn left,arrive |
| a,h | in,cross,reverse,reverse | depart,turn right,turn right,arrive |
| g,d | straight,cross,out,out | depart,turn left,turn left,arrive |
Scenario: No Name During Turns
Given the node map
| a | b | |
| | c | d |
And the ways
| nodes | highway | name |
| ab | tertiary | road |
| bc | tertiary | |
| cd | tertiary | road |
When I route I should get
| waypoints | route | turns |
| a,d | road,road | depart,arrive |
Scenario: No Name During Turns, Random Oneway
Given the node map
| a | b | |
| | c | d |
And the ways
| nodes | highway | name | oneway |
| ab | tertiary | road | no |
| bc | tertiary | | yes |
| cd | tertiary | road | no |
When I route I should get
| waypoints | route | turns |
| a,d | road,road | depart,arrive |
Scenario: Pulled Back Turn
Given the node map
| | | d |
| a | b | c |
| | e | |
And the ways
| nodes | highway | name |
| abc | tertiary | road |
| cd | tertiary | left |
| be | tertiary | right |
When I route I should get
| waypoints | route | turns |
| a,d | road,left,left | depart,turn left,arrive |
| a,e | road,right,right | depart,turn right,arrive |
Scenario: No Name During Turns, keep important turns
Given the node map
| a | b | e |
| | c | d |
And the ways
| nodes | highway | name |
| ab | tertiary | road |
| bc | tertiary | |
| cd | tertiary | road |
| be | tertiary | other |
When I route I should get
| waypoints | route | turns |
| a,d | road,road,road | depart,continue right,arrive |
Scenario: Segregated Intersection into Slight Turn
Given the node map
| h | | | | | | |
| a | | | | | | |
| | | | | | | |
| | | g | | | | |
| | | b | f | | | |
| | | | c | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | e |
| | | | | | | d |
| | | j | i | | | |
And the ways
| nodes | highway | name | oneway |
| abcd | primary | road | yes |
| efgh | primary | road | yes |
| icf | secondary | in | yes |
| gbj | secondary | out | yes |
When I route I should get
| waypoints | route | turns |
| i,h | in,road,road | depart,turn slight left,arrive |
| a,d | road,road | depart,arrive |
| a,j | road,out,out | depart,turn slight right,arrive |
Scenario: Don't collapse everything to u-turn / too wide
Given the node map
| a | | b | | e |
| | | | | |
| d | | c | | f |
And the ways
| nodes | highway | name |
| abcd | primary | road |
| be | secondary | top |
| cf | secondary | bottom |
When I route I should get
| waypoints | turns | route |
| a,d | depart,continue right,end of road right,arrive | road,road,road,road |
| d,a | depart,continue left,end of road left,arrive | road,road,road,road |
Scenario: Forking before a turn
Given the node map
| | | | g | |
| | | | | |
| | | | c | |
| a | | b | d | e |
| | | | | |
| | | | f | |
And the ways
| nodes | name | oneway | highway |
| ab | road | yes | primary |
| bd | road | yes | primary |
| bc | road | yes | primary |
| de | road | yes | primary |
| fdcg | cross | no | secondary |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bd | fdcg | d | no_left_turn |
| restriction | bc | fdcg | c | no_right_turn |
When I route I should get
| waypoints | route | turns |
| a,g | road,cross,cross | depart,turn left,arrive |
| a,e | road,road | depart,arrive |
Scenario: Forking before a turn (narrow)
Given the node map
| | | | g | |
| | | | | |
| | | | c | |
| a | b | | d | e |
| | | | | |
| | | | f | |
And the ways
| nodes | name | oneway | highway |
| ab | road | yes | primary |
| bd | road | yes | primary |
| bc | road | yes | primary |
| de | road | yes | primary |
| fdcg | cross | no | secondary |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bd | fdcg | d | no_left_turn |
| restriction | bc | fdcg | c | no_right_turn |
When I route I should get
| waypoints | route | turns |
| a,g | road,cross,cross | depart,turn left,arrive |
| a,e | road,road | depart,arrive |
Scenario: Forking before a turn (forky)
Given the node map
| | | | g | | |
| | | | | | |
| | | | c | | |
| a | b | | | | |
| | | | | d | |
| | | | | f | e |
And the ways
| nodes | name | oneway | highway |
| ab | road | yes | primary |
| bd | road | yes | primary |
| bc | road | yes | primary |
| de | road | yes | primary |
| fdcg | cross | no | secondary |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bd | fdcg | d | no_left_turn |
| restriction | bc | fdcg | c | no_right_turn |
When I route I should get
| waypoints | route | turns |
| a,g | road,cross,cross | depart,turn left,arrive |
| a,e | road,road,road | depart,continue slight right,arrive |
# We should discuss whether the next item should be collapsed to depart,turn right,arrive.
| a,f | road,road,cross,cross | depart,continue slight right,turn right,arrive |
Scenario: On-Off on Highway
Given the node map
| f | | | |
| a | b | c | d |
| | | | e |
And the ways
| nodes | name | highway | oneway |
| abcd | Hwy | motorway | yes |
| fb | on | motorway_link | yes |
| ce | off | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,d | Hwy,Hwy | depart,arrive |
| f,d | on,Hwy,Hwy | depart,merge slight right,arrive |
| f,e | on,Hwy,off,off | depart,merge slight right,off ramp right,arrive |
| a,e | Hwy,off,off | depart,off ramp right,arrive |
+39 -6
View File
@@ -16,9 +16,42 @@ Feature: Continue Instructions
| bd | primary |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,continue left,arrive |
| a,d | abc,bd,bd | depart,new name straight,arrive |
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,continue left,arrive |
| a,d | abc,bd,bd | depart,turn straight,arrive |
Scenario: Road turning left and straight
Given the node map
| | | c | |
| a | | b | d |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bd | primary | road |
When I route I should get
| waypoints | route | turns |
| a,c | road,road,road | depart,continue left,arrive |
| a,d | road,road | depart,arrive |
Scenario: Road turning left and straight
Given the node map
| | | c | |
| a | | b | d |
| | | e | |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bd | primary | road |
| be | primary | road |
When I route I should get
| waypoints | route | turns |
| a,c | road,road,road | depart,continue left,arrive |
| a,d | road,road | depart,arrive |
| a,e | road,road,road | depart,continue right,arrive |
Scenario: Road turning right
Given the node map
@@ -31,9 +64,9 @@ Feature: Continue Instructions
| bd | primary |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,continue right,arrive |
| a,d | abc,bd,bd | depart,new name straight,arrive |
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,continue right,arrive |
| a,d | abc,bd,bd | depart,turn straight,arrive |
Scenario: Road turning slight left
Given the node map
@@ -0,0 +1,125 @@
@routing @guidance
Feature: Slipways and Dedicated Turn Lanes
Background:
Given the profile "car"
Given a grid size of 5 meters
Scenario: Turn Instead of Ramp
Given the node map
| | | | | e | |
| a | b | | | c | d |
| | | | h | | |
| | | | | | |
| | | | 1 | | |
| | | | | | |
| | | | | f | |
| | | | | | |
| | | | | g | |
And the ways
| nodes | highway | name |
| abcd | trunk | first |
| bhf | trunk_link | |
| ecfg | primary | second |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | abcd | ecfg | c | no_right_turn |
When I route I should get
| waypoints | route | turns |
| a,g | first,second,second | depart,turn right,arrive |
| a,1 | first,, | depart,turn slight right,arrive |
Scenario: Turn Instead of Ramp
Given the node map
| | | | | e | |
| a | b | | | c | d |
| | | | h | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | f | |
| | | | | | |
| | | | | | |
| | | | | g | |
And the ways
| nodes | highway | name |
| abcd | motorway | first |
| bhf | motorway_link | |
| efg | primary | second |
When I route I should get
| waypoints | route | turns |
| a,g | first,,second,second | depart,off ramp slight right,merge slight left,arrive |
Scenario: Inner city expressway with on road
Given the node map
| a | b | | | | c |
| | | | | f | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | d |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | e |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bfd | trunk_link | |
| cde | trunk | trunk |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | abc | cde | c | no_right_turn |
When I route I should get
| waypoints | route | turns |
| a,e | road,trunk,trunk | depart,turn right,arrive |
Scenario: Slipway Round U-Turn
Given the node map
| a | | f |
| | | |
| b | | e |
| | | |
| | | |
| | g | |
| | | |
| c | | d |
And the ways
| nodes | highway | name | oneway |
| abc | primary | road | yes |
| bge | primary_link | | yes |
| def | primary | road | yes |
When I route I should get
| waypoints | route | turns |
| a,f | road,road,road | depart,continue uturn,arrive |
Scenario: Slipway Steep U-Turn
Given the node map
| a | | f |
| | | |
| b | | e |
| | g | |
| | | |
| | | |
| c | | d |
And the ways
| nodes | highway | name | oneway |
| abc | primary | road | yes |
| bge | primary_link | | yes |
| def | primary | road | yes |
When I route I should get
| waypoints | route | turns |
| a,f | road,road,road | depart,continue uturn,arrive |
@@ -0,0 +1,41 @@
@routing @guidance
Feature: Destination Signs
Background:
Given the profile "car"
Scenario: Car - route name assembly with destination signs
Given the node map
| a | b |
| c | d |
| e | f |
| g | h |
| i | j |
| k | l |
| m | n |
| o | p |
| q | r |
And the ways
| nodes | name | ref | destination | destination:ref | oneway | # |
| ab | AB | E1 | | | yes | |
| cd | CD | | Berlin | | yes | |
| ef | EF | | Berlin | A1 | yes | |
| gh | | | Berlin | A1 | yes | |
| ij | | | Berlin | | yes | |
| kl | KL | E1 | Berlin | A1 | yes | |
| mn | MN | | Berlin;Hamburg | A1;A2 | yes | |
| op | OP | | Berlin;Hamburg | A1;A2 | no | mis-tagged destination: not a oneway |
| qr | QR | | | A1;A2 | yes | |
When I route I should get
| from | to | route | destinations | # |
| a | b | AB (E1),AB (E1) | , | |
| c | d | CD (Berlin),CD (Berlin) | Berlin,Berlin | |
| e | f | EF (A1: Berlin),EF (A1: Berlin) | A1: Berlin,A1: Berlin | |
| g | h | , | A1: Berlin,A1: Berlin | |
| i | j | , | Berlin,Berlin | |
| k | l | KL (E1),KL (E1) | A1: Berlin,A1: Berlin | |
| m | n | MN (A1, A2: Berlin, Hamburg),MN (A1, A2: Berlin, Hamburg) | A1, A2: Berlin, Hamburg,A1, A2: Berlin, Hamburg | |
| o | p | OP,OP | , | guard against mis-tagging |
| q | r | QR (A1, A2),QR (A1, A2) | A1, A2,A1, A2 | |
+18 -1
View File
@@ -21,7 +21,6 @@ Feature: End Of Road Instructions
| a,c | ab,cbd,cbd | depart,end of road left,arrive |
| a,d | ab,cbd,cbd | depart,end of road right,arrive |
Scenario: End of Road with three streets
Given the node map
| | | c |
@@ -104,3 +103,21 @@ Feature: End Of Road Instructions
| waypoints | route | turns |
| a,c | ab,cbd,cbd | depart,end of road left,arrive |
| a,d | ab,cbd,cbd | depart,end of road right,arrive |
Scenario: End of Road with two ramps - prefer ramp over end of road
Given the node map
| | | c |
| a | | b |
| | | d |
And the ways
| nodes | highway |
| ab | primary |
| bc | motorway_link |
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,c | ab,bc,bc | depart,on ramp left,arrive |
| a,d | ab,bd,bd | depart,on ramp right,arrive |
+85
View File
@@ -211,3 +211,88 @@ Feature: Fork Instructions
| a,c | ,, | depart,fork slight left,arrive |
| a,d | ,, | depart,fork slight right,arrive |
Scenario: Non-Fork on complex intersection - left
Given the node map
| | | | | c |
| a | | b | | |
| | e | | | d |
And the ways
| nodes | highway |
| abc | secondary |
| bd | tertiary |
| eb | tertiary |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc | depart,arrive |
| a,d | abc,bd,bd | depart,turn slight right,arrive |
Scenario: Non-Fork on complex intersection - right
Given the node map
| | e | | | c |
| a | | b | | |
| | | | | d |
And the ways
| nodes | highway |
| abd | secondary |
| bc | tertiary |
| eb | tertiary |
When I route I should get
| waypoints | route | turns |
| a,c | abd,bc,bc | depart,turn slight left,arrive |
| a,d | abd,abd | depart,arrive |
Scenario: Tripple fork
Given the node map
| | | | | | | | | c |
| a | | b | | d | | | | |
| | | | | | | | | e |
And the ways
| nodes | highway |
| ab | secondary |
| bc | secondary |
| bd | secondary |
| be | secondary |
When I route I should get
| waypoints | route | turns |
| a,c | ab,bc,bc | depart,fork slight left,arrive |
| a,d | ab,bd,bd | depart,fork straight,arrive |
| a,e | ab,be,be | depart,fork slight right,arrive |
Scenario: Tripple fork -- middle obvious
Given the node map
| | | | | c |
| a | | b | | d |
| | | | | e |
And the ways
| nodes | highway |
| abd | secondary |
| bc | secondary |
| be | secondary |
When I route I should get
| waypoints | route | turns |
| a,c | abd,bc,bc | depart,turn slight left,arrive |
| a,d | abd,abd | depart,arrive |
| a,e | abd,be,be | depart,turn slight right,arrive |
Scenario: Don't Fork when leaving Road
Given the node map
| a | | b | | c |
| | | | | d |
And the ways
| nodes | highway |
| abc | secondary |
| bd | secondary |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc | depart,arrive |
| a,d | abc,bd,bd | depart,turn slight right,arrive |
+153
View File
@@ -0,0 +1,153 @@
@routing @guidance @intersections
Feature: Intersections Data
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Passing Three Way South
Given the node map
| a | | b | | c |
| | | d | | |
And the ways
| nodes | name |
| ab | through |
| bc | through |
| bd | corner |
When I route I should get
| waypoints | route | turns | intersections |
| a,c | through,through | depart,arrive | true:90,true:90 true:180 false:270;true:270 |
Scenario: Passing Three Way North
Given the node map
| | | d | | |
| a | | b | | c |
And the ways
| nodes | name |
| ab | through |
| bc | through |
| bd | corner |
When I route I should get
| waypoints | route | turns | intersections |
| a,c | through,through | depart,arrive | true:90,true:0 true:90 false:270;true:270 |
Scenario: Passing Oneway Street In
Given the node map
| | | d | | |
| a | | b | | c |
And the ways
| nodes | name | oneway |
| ab | through | no |
| bc | through | no |
| db | corner | yes |
When I route I should get
| waypoints | route | turns | intersections |
| a,c | through,through | depart,arrive | true:90,false:0 true:90 false:270;true:270 |
Scenario: Passing Oneway Street Out
Given the node map
| | | d | | |
| a | | b | | c |
And the ways
| nodes | name | oneway |
| ab | through | no |
| bc | through | no |
| bd | corner | yes |
When I route I should get
| waypoints | route | turns | intersections |
| a,c | through,through | depart,arrive | true:90,true:0 true:90 false:270;true:270 |
Scenario: Passing Two Intersections
Given the node map
| | | e | | | | |
| a | | b | | c | | d |
| | | | | f | | |
And the ways
| nodes | name |
| ab | through |
| bc | through |
| cd | through |
| be | corner |
| cf | corner |
When I route I should get
| waypoints | route | turns | intersections |
| a,d | through,through | depart,arrive | true:90,true:0 true:90 false:270,true:90 true:180 false:270;true:270 |
Scenario: Regression test #2424
Given the node map
| | | e | | | | | | i | | | | |
| a | | b | | c | | d | | h | | k | | m |
| | | | | f | | | | | | l | | |
And the ways
| nodes | name |
| abcd | Fritz-Elsas-Straße |
| hkm | Fritz-Elsas-Straße |
| dhi | Martin-Luther-Straße |
| be | corner |
| kl | corner |
| cf | corner |
When I route I should get
| waypoints | route | turns |
| a,m | Fritz-Elsas-Straße,Fritz-Elsas-Straße| depart,arrive |
Scenario: Passing Two Intersections, Collapsing
Given the node map
| | | e | | | | |
| a | | b | | c | | d |
| | | | | f | | |
And the ways
| nodes | name |
| ab | through |
| bc | throughbridge |
| cd | through |
| be | corner |
| cf | corner |
When I route I should get
| waypoints | route | turns | intersections |
| a,d | through,through | depart,arrive | true:90,true:0 true:90 false:270,true:90 true:180 false:270;true:270 |
| f,a | corner,through,through | depart,end of road left,arrive | true:0;true:90 false:180 true:270,true:0 false:90 true:270;true:90 |
Scenario: Roundabouts
Given the node map
| | | | | e | | | | |
| | | | | | | | | |
| | | | | a | | | | |
| | | | 1 | | 4 | | | |
| | | | | | | | | |
| f | | b | | | | d | | h |
| | | | | | | | | |
| | | | 2 | | 3 | | | |
| | | | | c | | | | |
| | | | | | | | | |
| | | | | g | | | | |
And the ways
| nodes | junction |
| abcda | roundabout |
| ea | |
| fb | |
| gc | |
| hd | |
When I route I should get
| waypoints | route | turns | intersections |
| e,f | ea,fb,fb | depart,abcda-exit-1,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270;true:90 |
| e,g | ea,gc,gc | depart,abcda-exit-2,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270,true:30 true:180 false:330;true:0|
| e,h | ea,hd,hd | depart,abcda-exit-3,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270,true:30 true:180 false:330,true:90 false:210 true:330;true:270 |
| e,2 | ea,abcda,abcda | depart,abcda-exit-undefined,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270;true:327 +-1|
| 1,g | abcda,gc,gc | depart,abcda-exit-2,arrive | true:214;true:214,false:30 true:150 true:270,true:30 true:180 false:330;true:0|
| 1,3 | abcda,abcda | depart,arrive | true:214,false:30 true:150 true:270,true:30 true:180 false:330;true:214|
+64 -64
View File
@@ -11,14 +11,14 @@ Feature: Motorway Guidance
| | | | f | g |
And the ways
| nodes | highway |
| abcde | motorway |
| bfg | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| bfg | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,ramp slight right,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,off ramp slight right,arrive |
Scenario: Ramp Exit Right Curved Right
Given the node map
@@ -27,14 +27,14 @@ Feature: Motorway Guidance
| | | | g | e |
And the ways
| nodes | highway |
| abcde | motorway |
| bfg | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| bfg | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,ramp right,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,off ramp right,arrive |
Scenario: Ramp Exit Right Curved Left
Given the node map
@@ -44,14 +44,14 @@ Feature: Motorway Guidance
And the ways
| nodes | highway |
| abcde | motorway |
| cfg | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| cfg | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,cfg,cfg | depart,ramp slight right,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,cfg,cfg | depart,off ramp slight right,arrive |
Scenario: Ramp Exit Left
@@ -60,14 +60,14 @@ Feature: Motorway Guidance
| a | b | c | d | e |
And the ways
| nodes | highway |
| abcde | motorway |
| bfg | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| bfg | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,ramp slight left,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,off ramp slight left,arrive |
Scenario: Ramp Exit Left Curved Left
Given the node map
@@ -76,14 +76,14 @@ Feature: Motorway Guidance
| a | b | c | | |
And the ways
| nodes | highway |
| abcde | motorway |
| bfg | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| bfg | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,ramp left,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,bfg,bfg | depart,off ramp left,arrive |
Scenario: Ramp Exit Left Curved Right
Given the node map
@@ -92,14 +92,14 @@ Feature: Motorway Guidance
| | | | | e |
And the ways
| nodes | highway |
| abcde | motorway |
| cfg | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| cfg | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,cfg,cfg | depart,ramp slight left,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| a,g | abcde,cfg,cfg | depart,off ramp slight left,arrive |
Scenario: On Ramp Right
Given the node map
@@ -107,9 +107,9 @@ Feature: Motorway Guidance
| f | g | | | |
And the ways
| nodes | highway |
| abcde | motorway |
| fgd | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| fgd | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
@@ -122,9 +122,9 @@ Feature: Motorway Guidance
| a | b | c | d | e |
And the ways
| nodes | highway |
| abcde | motorway |
| fgd | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| fgd | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
@@ -154,10 +154,10 @@ Feature: Motorway Guidance
| | | | | f | g |
And the ways
| nodes | highway |
| abc | motorway_link |
| cde | motorway |
| cfg | motorway |
| nodes | highway | oneway |
| abc | motorway_link | yes |
| cde | motorway | |
| cfg | motorway | |
When I route I should get
| waypoints | route | turns |
@@ -170,17 +170,17 @@ Feature: Motorway Guidance
| f | g | | | | h | i |
And the ways
| nodes | highway |
| abcde | motorway |
| fgc | motorway_link |
| chi | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| fgc | motorway_link | yes |
| chi | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| f,e | fgc,abcde,abcde | depart,merge slight left,arrive |
| a,i | abcde,chi,chi | depart,ramp slight right,arrive |
| f,i | fgc,chi,chi | depart,ramp right,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| f,e | fgc,abcde,abcde | depart,merge slight left,arrive |
| a,i | abcde,chi,chi | depart,off ramp slight right,arrive |
| f,i | fgc,chi,chi | depart,off ramp right,arrive |
Scenario: On And Off Ramp Left
Given the node map
@@ -188,17 +188,17 @@ Feature: Motorway Guidance
| a | b | | c | | d | e |
And the ways
| nodes | highway |
| abcde | motorway |
| fgc | motorway_link |
| chi | motorway_link |
| nodes | highway | oneway |
| abcde | motorway | |
| fgc | motorway_link | yes |
| chi | motorway_link | yes |
When I route I should get
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| f,e | fgc,abcde,abcde | depart,merge slight right,arrive |
| a,i | abcde,chi,chi | depart,ramp slight left,arrive |
| f,i | fgc,chi,chi | depart,ramp left,arrive |
| waypoints | route | turns |
| a,e | abcde,abcde | depart,arrive |
| f,e | fgc,abcde,abcde | depart,merge slight right,arrive |
| a,i | abcde,chi,chi | depart,off ramp slight left,arrive |
| f,i | fgc,chi,chi | depart,off ramp left,arrive |
Scenario: Merging Motorways
Given the node map
+32 -1
View File
@@ -3,7 +3,7 @@ Feature: New-Name Instructions
Background:
Given the profile "car"
Given a grid size of 10 meters
Given a grid size of 100 meters
Scenario: Undisturbed name Change
Given the node map
@@ -133,3 +133,34 @@ Feature: New-Name Instructions
When I route I should get
| waypoints | route | turns |
| a,c | ab,bc,bc | depart,new name slight right,arrive |
Scenario: Empty road names - Announce Change From, suppress Change To
Given the node map
| a | | b | 1 | c | | d |
And the ways
| nodes | name |
| ab | ab |
| bc | |
| cd | cd |
When I route I should get
| waypoints | route | turns |
| a,d | ab,cd,cd | depart,new name straight,arrive |
| a,1 | ab, | depart,arrive |
Scenario: Empty road names - Loose name shortly
Given the node map
| a | | b | | c | | d | | e |
And the ways
| nodes | name |
| ab | name |
| bc | with-name |
| cd | |
| de | with-name |
When I route I should get
| waypoints | route | turns |
| a,e | name,with-name,with-name | depart,new name straight,arrive |
| b,e | with-name,with-name | depart,arrive |
+32 -32
View File
@@ -16,8 +16,8 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp right,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp right,arrive |
Scenario: Ramp On Through Street Left
Given the node map
@@ -30,8 +30,8 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp left,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp left,arrive |
Scenario: Ramp On Through Street Left and Right
Given the node map
@@ -46,9 +46,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp right,arrive |
| a,e | abc,be,be | depart,ramp left,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp right,arrive |
| a,e | abc,be,be | depart,on ramp left,arrive |
Scenario: Ramp On Three Way Intersection Right
Given the node map
@@ -62,8 +62,8 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,ramp right,arrive |
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,on ramp right,arrive |
Scenario: Ramp On Three Way Intersection Right
Given the node map
@@ -78,8 +78,8 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,ramp right,arrive |
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,on ramp right,arrive |
Scenario: Ramp Off Though Street
Given the node map
@@ -93,9 +93,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp right,arrive |
| a,c | abc,abc | depart,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp right,arrive |
| a,c | abc,abc | depart,arrive |
Scenario: Straight Ramp Off Turning Though Street
Given the node map
@@ -108,9 +108,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp straight,arrive |
| a,c | abc,abc,abc | depart,continue left,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp straight,arrive |
| a,c | abc,abc,abc | depart,continue left,arrive |
Scenario: Fork Ramp Off Turning Though Street
Given the node map
@@ -124,9 +124,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp right,arrive |
| a,c | abc,abc,abc | depart,continue left,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp right,arrive |
| a,c | abc,abc,abc | depart,continue left,arrive |
Scenario: Fork Ramp
Given the node map
@@ -141,9 +141,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,ramp right,arrive |
| a,c | ab,bc,bc | depart,turn left,arrive |
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,on ramp right,arrive |
| a,c | ab,bc,bc | depart,turn left,arrive |
Scenario: Fork Slight Ramp
Given the node map
@@ -158,9 +158,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,ramp slight right,arrive |
| a,c | ab,bc,bc | depart,turn slight left,arrive |
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,on ramp slight right,arrive |
| a,c | ab,bc,bc | depart,turn slight left,arrive |
Scenario: Fork Slight Ramp on Through Street
Given the node map
@@ -174,9 +174,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp slight right,arrive |
| a,c | abc,abc,abc | depart,continue slight left,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp slight right,arrive |
| a,c | abc,abc,abc | depart,continue slight left,arrive |
Scenario: Fork Slight Ramp on Obvious Through Street
Given the node map
@@ -190,9 +190,9 @@ Feature: Ramp Guidance
| bd | motorway_link |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,ramp slight right,arrive |
| a,c | abc,abc | depart,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,on ramp slight right,arrive |
| a,c | abc,abc | depart,arrive |
Scenario: Two Ramps Joining into common Motorway
Given the node map
+10 -10
View File
@@ -194,15 +194,15 @@ Feature: Rotary
And the ways
| nodes | junction |
| ab | |
| ad | |
| bcdb | roundabout |
| ce | |
| df | |
| be | |
| cf | |
When I route I should get
| waypoints | route | turns |
| a,e | ab,ce,ce | depart,bcdb-exit-1,arrive |
| a,f | ab,df,df | depart,bcdb-exit-2,arrive |
| a,e | ad,be,be | depart,bcdb-exit-1,arrive |
| a,f | ad,cf,cf | depart,bcdb-exit-2,arrive |
Scenario: Collinear in X,Y
Given the node map
@@ -213,15 +213,15 @@ Feature: Rotary
And the ways
| nodes | junction |
| ab | |
| ac | |
| bcdb | roundabout |
| ce | |
| df | |
| de | |
| bf | |
When I route I should get
| waypoints | route | turns |
| a,e | ab,ce,ce | depart,bcdb-exit-1,arrive |
| a,f | ab,df,df | depart,bcdb-exit-2,arrive |
| a,e | ac,de,de | depart,bcdb-exit-1,arrive |
| a,f | ac,bf,bf | depart,bcdb-exit-2,arrive |
Scenario: Collinear in X,Y
Given the node map
+391
View File
@@ -0,0 +1,391 @@
@routing @guidance
Feature: Basic Roundabout
Background:
Given the profile "car"
Given a grid size of 3 meters
Scenario: Enter and Exit
Given the node map
| | | a | | |
| | | b | | |
| h | g | | c | d |
| | | e | | |
| | | f | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bgecb | roundabout |
When I route I should get
| waypoints | route | turns |
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive |
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive |
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive |
| d,f | cd,ef,ef | depart,roundabout turn left exit-3,arrive |
| d,h | cd,gh,gh | depart,roundabout turn straight exit-2,arrive |
| d,a | cd,ab,ab | depart,roundabout turn right exit-1,arrive |
| f,h | ef,gh,gh | depart,roundabout turn left exit-3,arrive |
| f,a | ef,ab,ab | depart,roundabout turn straight exit-2,arrive |
| f,d | ef,cd,cd | depart,roundabout turn right exit-1,arrive |
| h,a | gh,ab,ab | depart,roundabout turn left exit-3,arrive |
| h,d | gh,cd,cd | depart,roundabout turn straight exit-2,arrive |
| h,f | gh,ef,ef | depart,roundabout turn right exit-1,arrive |
Scenario: Enter and Exit - Rotated
Given the node map
| a | | | d |
| | b | c | |
| | g | e | |
| h | | | f |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bgecb | roundabout |
When I route I should get
| waypoints | route | turns |
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive |
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive |
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive |
| d,f | cd,ef,ef | depart,roundabout turn left exit-3,arrive |
| d,h | cd,gh,gh | depart,roundabout turn straight exit-2,arrive |
| d,a | cd,ab,ab | depart,roundabout turn right exit-1,arrive |
| f,h | ef,gh,gh | depart,roundabout turn left exit-3,arrive |
| f,a | ef,ab,ab | depart,roundabout turn straight exit-2,arrive |
| f,d | ef,cd,cd | depart,roundabout turn right exit-1,arrive |
| h,a | gh,ab,ab | depart,roundabout turn left exit-3,arrive |
| h,d | gh,cd,cd | depart,roundabout turn straight exit-2,arrive |
| h,f | gh,ef,ef | depart,roundabout turn right exit-1,arrive |
Scenario: Only Enter
Given the node map
| | | a | | |
| | | b | | |
| d | c | | g | h |
| | | e | | |
| | | f | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bcegb | roundabout |
When I route I should get
| waypoints | route | turns |
| a,c | ab,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| a,e | ab,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| a,g | ab,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| d,e | cd,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| d,g | cd,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| d,b | cd,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| f,g | ef,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| f,b | ef,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| f,c | ef,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| h,b | gh,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| h,c | gh,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
| h,e | gh,bcegb,bcegb | depart,roundabout-exit-undefined,arrive |
Scenario: Only Exit
Given the node map
| | | a | | |
| | | b | | |
| d | c | | g | h |
| | | e | | |
| | | f | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bcegb | roundabout |
When I route I should get
| waypoints | route | turns |
| b,d | bcegb,cd,cd | depart,roundabout-exit-1,arrive |
| b,f | bcegb,ef,ef | depart,roundabout-exit-2,arrive |
| b,h | bcegb,gh,gh | depart,roundabout-exit-3,arrive |
| c,f | bcegb,ef,ef | depart,roundabout-exit-1,arrive |
| c,h | bcegb,gh,gh | depart,roundabout-exit-2,arrive |
| c,a | bcegb,ab,ab | depart,roundabout-exit-3,arrive |
| e,h | bcegb,gh,gh | depart,roundabout-exit-1,arrive |
| e,a | bcegb,ab,ab | depart,roundabout-exit-2,arrive |
| e,d | bcegb,cd,cd | depart,roundabout-exit-3,arrive |
| g,a | bcegb,ab,ab | depart,roundabout-exit-1,arrive |
| g,d | bcegb,cd,cd | depart,roundabout-exit-2,arrive |
| g,f | bcegb,ef,ef | depart,roundabout-exit-3,arrive |
#phantom node snapping can result in a full round-trip here, therefore we cannot test b->a and the other direct exits
Scenario: Drive Around
Given the node map
| | | a | | |
| | | b | | |
| d | c | | g | h |
| | | e | | |
| | | f | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bcegb | roundabout |
When I route I should get
| waypoints | route | turns |
| b,c | bcegb,bcegb | depart,arrive |
| b,e | bcegb,bcegb | depart,arrive |
| b,g | bcegb,bcegb | depart,arrive |
| c,e | bcegb,bcegb | depart,arrive |
| c,g | bcegb,bcegb | depart,arrive |
| c,b | bcegb,bcegb | depart,arrive |
| e,g | bcegb,bcegb | depart,arrive |
| e,b | bcegb,bcegb | depart,arrive |
| e,c | bcegb,bcegb | depart,arrive |
| g,b | bcegb,bcegb | depart,arrive |
| g,c | bcegb,bcegb | depart,arrive |
| g,e | bcegb,bcegb | depart,arrive |
Scenario: Mixed Entry and Exit - Not an Intersection
Given the node map
| | c | | a | |
| j | | b | | f |
| | k | | e | |
| l | | h | | d |
| | g | | i | |
And the ways
| nodes | junction | oneway |
| abc | | yes |
| def | | yes |
| ghi | | yes |
| jkl | | yes |
| bkheb | roundabout | yes |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,roundabout-exit-1,arrive |
| a,l | abc,jkl,jkl | depart,roundabout-exit-2,arrive |
| a,i | abc,ghi,ghi | depart,roundabout-exit-3,arrive |
| a,f | abc,def,def | depart,roundabout-exit-4,arrive |
| d,f | def,def,def | depart,roundabout-exit-1,arrive |
| d,c | def,abc,abc | depart,roundabout-exit-2,arrive |
| d,l | def,jkl,jkl | depart,roundabout-exit-3,arrive |
| d,i | def,ghi,ghi | depart,roundabout-exit-4,arrive |
| g,i | ghi,ghi,ghi | depart,roundabout-exit-1,arrive |
| g,f | ghi,def,def | depart,roundabout-exit-2,arrive |
| g,c | ghi,abc,abc | depart,roundabout-exit-3,arrive |
| g,l | ghi,jkl,jkl | depart,roundabout-exit-4,arrive |
| j,l | jkl,jkl,jkl | depart,roundabout-exit-1,arrive |
| j,i | jkl,ghi,ghi | depart,roundabout-exit-2,arrive |
| j,f | jkl,def,def | depart,roundabout-exit-3,arrive |
| j,c | jkl,abc,abc | depart,roundabout-exit-4,arrive |
Scenario: Segregated roads - Not an intersection
Given the node map
| | a | | c | |
| l | | b | | d |
| | k | | e | |
| j | | h | | f |
| | i | | g | |
And the ways
| nodes | junction | oneway |
| abc | | yes |
| def | | yes |
| ghi | | yes |
| jkl | | yes |
| bkheb | roundabout | yes |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,roundabout-exit-4,arrive |
| a,l | abc,jkl,jkl | depart,roundabout-exit-1,arrive |
| a,i | abc,ghi,ghi | depart,roundabout-exit-2,arrive |
| a,f | abc,def,def | depart,roundabout-exit-3,arrive |
| d,f | def,def,def | depart,roundabout-exit-4,arrive |
| d,c | def,abc,abc | depart,roundabout-exit-1,arrive |
| d,l | def,jkl,jkl | depart,roundabout-exit-2,arrive |
| d,i | def,ghi,ghi | depart,roundabout-exit-3,arrive |
| g,i | ghi,ghi,ghi | depart,roundabout-exit-4,arrive |
| g,f | ghi,def,def | depart,roundabout-exit-1,arrive |
| g,c | ghi,abc,abc | depart,roundabout-exit-2,arrive |
| g,l | ghi,jkl,jkl | depart,roundabout-exit-3,arrive |
| j,l | jkl,jkl,jkl | depart,roundabout-exit-4,arrive |
| j,i | jkl,ghi,ghi | depart,roundabout-exit-1,arrive |
| j,f | jkl,def,def | depart,roundabout-exit-2,arrive |
| j,c | jkl,abc,abc | depart,roundabout-exit-3,arrive |
Scenario: Collinear in X
Given the node map
| a | b | c | d | f |
| | | e | | |
And the ways
| nodes | junction |
| ab | |
| bcdb | roundabout |
| ce | |
| df | |
When I route I should get
| waypoints | route | turns |
| a,e | ab,ce,ce | depart,roundabout-exit-1,arrive |
| a,f | ab,df,df | depart,roundabout-exit-2,arrive |
Scenario: Collinear in X,Y
Given the node map
| a | | |
| b | | |
| c | d | f |
| e | | |
And the ways
| nodes | junction |
| ab | |
| bcdb | roundabout |
| ce | |
| df | |
When I route I should get
| waypoints | route | turns |
| a,e | ab,ce,ce | depart,roundabout turn straight exit-1,arrive |
| a,f | ab,df,df | depart,roundabout turn left exit-2,arrive |
Scenario: Collinear in X,Y
Given the node map
| a | | |
| d | | |
| b | c | f |
| e | | |
And the ways
| nodes | junction |
| ad | |
| bcdb | roundabout |
| be | |
| cf | |
When I route I should get
| waypoints | route | turns |
| a,e | ad,be,be | depart,roundabout turn straight exit-1,arrive |
| a,f | ad,cf,cf | depart,roundabout turn left exit-2,arrive |
Scenario: Collinear in X,Y
Given the node map
| a | | |
| c | | |
| d | b | f |
| e | | |
And the ways
| nodes | junction |
| ac | |
| bcdb | roundabout |
| de | |
| bf | |
When I route I should get
| waypoints | route | turns |
| a,e | ac,de,de | depart,roundabout turn straight exit-1,arrive |
| a,f | ac,bf,bf | depart,roundabout turn left exit-2,arrive |
Scenario: Enter and Exit -- too complex
Given the node map
| j | | a | | |
| | i | b | | |
| | g | | c | d |
| h | | e | | |
| | | f | | |
And the ways
| nodes | junction |
| ab | |
| ij | |
| cd | |
| ef | |
| gh | |
| bigecb | roundabout |
When I route I should get
| waypoints | route | turns |
| a,d | ab,cd,cd | depart,roundabout-exit-4,arrive |
| a,f | ab,ef,ef | depart,roundabout-exit-3,arrive |
| a,h | ab,gh,gh | depart,roundabout-exit-2,arrive |
| d,f | cd,ef,ef | depart,roundabout-exit-4,arrive |
| d,h | cd,gh,gh | depart,roundabout-exit-3,arrive |
| d,a | cd,ab,ab | depart,roundabout-exit-1,arrive |
| f,h | ef,gh,gh | depart,roundabout-exit-4,arrive |
| f,a | ef,ab,ab | depart,roundabout-exit-2,arrive |
| f,d | ef,cd,cd | depart,roundabout-exit-1,arrive |
| h,a | gh,ab,ab | depart,roundabout-exit-3,arrive |
| h,d | gh,cd,cd | depart,roundabout-exit-2,arrive |
| h,f | gh,ef,ef | depart,roundabout-exit-1,arrive |
Scenario: Enter and Exit -- Non-Distinct
Given the node map
| | | a | | |
| | | b | | |
| | g | | c | d |
| | | e | | |
| h | | f | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bgecb | roundabout |
When I route I should get
| waypoints | route | turns |
| a,d | ab,cd,cd | depart,roundabout-exit-3,arrive |
| a,f | ab,ef,ef | depart,roundabout-exit-2,arrive |
| a,h | ab,gh,gh | depart,roundabout-exit-1,arrive |
| d,f | cd,ef,ef | depart,roundabout-exit-3,arrive |
| d,h | cd,gh,gh | depart,roundabout-exit-2,arrive |
| d,a | cd,ab,ab | depart,roundabout-exit-1,arrive |
| f,h | ef,gh,gh | depart,roundabout-exit-3,arrive |
| f,a | ef,ab,ab | depart,roundabout-exit-2,arrive |
| f,d | ef,cd,cd | depart,roundabout-exit-1,arrive |
| h,a | gh,ab,ab | depart,roundabout-exit-3,arrive |
| h,d | gh,cd,cd | depart,roundabout-exit-2,arrive |
| h,f | gh,ef,ef | depart,roundabout-exit-1,arrive |
Scenario: Enter and Exit -- Bearing
Given the node map
| | | a | | |
| | | b | | |
| h | g | | c | d |
| | | e | | |
| | | f | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bgecb | roundabout |
When I route I should get
| waypoints | route | turns | bearing |
| a,d | ab,cd,cd | depart,roundabout turn left exit-3,arrive | 0->180,180->224,90->0 |
| a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive | 0->180,180->224,180->0 |
| a,h | ab,gh,gh | depart,roundabout turn right exit-1,arrive | 0->180,180->224,270->0 |
+117 -15
View File
@@ -165,6 +165,84 @@ Feature: Basic Roundabout
| j,f | jkl,def,def | depart,roundabout-exit-3,arrive |
| j,c | jkl,abc,abc | depart,roundabout-exit-4,arrive |
Scenario: Mixed Entry and Exit - segregated roads
Given the node map
| | | a | | c | | |
| | | | | | | |
| l | | | b | | | d |
| | | k | | e | | |
| j | | | h | | | f |
| | | | | | | |
| | | i | | g | | |
And the ways
| nodes | junction | oneway |
| abc | | yes |
| def | | yes |
| ghi | | yes |
| jkl | | yes |
| bkheb | roundabout | yes |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc,abc | depart,roundabout-exit-4,arrive |
| a,l | abc,jkl,jkl | depart,roundabout-exit-1,arrive |
| a,i | abc,ghi,ghi | depart,roundabout-exit-2,arrive |
| a,f | abc,def,def | depart,roundabout-exit-3,arrive |
| d,f | def,def,def | depart,roundabout-exit-4,arrive |
| d,c | def,abc,abc | depart,roundabout-exit-1,arrive |
| d,l | def,jkl,jkl | depart,roundabout-exit-2,arrive |
| d,i | def,ghi,ghi | depart,roundabout-exit-3,arrive |
| g,i | ghi,ghi,ghi | depart,roundabout-exit-4,arrive |
| g,f | ghi,def,def | depart,roundabout-exit-1,arrive |
| g,c | ghi,abc,abc | depart,roundabout-exit-2,arrive |
| g,l | ghi,jkl,jkl | depart,roundabout-exit-3,arrive |
| j,l | jkl,jkl,jkl | depart,roundabout-exit-4,arrive |
| j,i | jkl,ghi,ghi | depart,roundabout-exit-1,arrive |
| j,f | jkl,def,def | depart,roundabout-exit-2,arrive |
| j,c | jkl,abc,abc | depart,roundabout-exit-3,arrive |
Scenario: Mixed Entry and Exit - segregated roads, different names
Given the node map
| | | a | | c | | |
| | | | | | | |
| l | | | b | | | d |
| | | k | | e | | |
| j | | | h | | | f |
| | | | | | | |
| | | i | | g | | |
And the ways
| nodes | junction | oneway |
| ab | | yes |
| bc | | yes |
| de | | yes |
| ef | | yes |
| gh | | yes |
| hi | | yes |
| jk | | yes |
| kl | | yes |
| bkheb | roundabout | yes |
When I route I should get
| waypoints | route | turns |
| a,c | ab,bc,bc | depart,roundabout-exit-4,arrive |
| a,l | ab,kl,kl | depart,roundabout-exit-1,arrive |
| a,i | ab,hi,hi | depart,roundabout-exit-2,arrive |
| a,f | ab,ef,ef | depart,roundabout-exit-3,arrive |
| d,f | de,ef,ef | depart,roundabout-exit-4,arrive |
| d,c | de,bc,bc | depart,roundabout-exit-1,arrive |
| d,l | de,kl,kl | depart,roundabout-exit-2,arrive |
| d,i | de,hi,hi | depart,roundabout-exit-3,arrive |
| g,i | gh,hi,hi | depart,roundabout-exit-4,arrive |
| g,f | gh,ef,ef | depart,roundabout-exit-1,arrive |
| g,c | gh,bc,bc | depart,roundabout-exit-2,arrive |
| g,l | gh,kl,kl | depart,roundabout-exit-3,arrive |
| j,l | jk,kl,kl | depart,roundabout-exit-4,arrive |
| j,i | jk,hi,hi | depart,roundabout-exit-1,arrive |
| j,f | jk,ef,ef | depart,roundabout-exit-2,arrive |
| j,c | jk,bc,bc | depart,roundabout-exit-3,arrive |
Scenario: Collinear in X
Given the node map
| a | b | c | d | f |
@@ -184,11 +262,11 @@ Feature: Basic Roundabout
Scenario: Collinear in Y
Given the node map
| a | |
| b | |
| c | e |
| d | |
| f | |
| | a |
| | b |
| e | c |
| | d |
| | f |
And the ways
| nodes | junction |
@@ -230,15 +308,15 @@ Feature: Basic Roundabout
And the ways
| nodes | junction |
| ab | |
| ad | |
| bcdb | roundabout |
| ce | |
| df | |
| be | |
| cf | |
When I route I should get
| waypoints | route | turns |
| a,e | ab,ce,ce | depart,roundabout-exit-1,arrive |
| a,f | ab,df,df | depart,roundabout-exit-2,arrive |
| a,e | ad,be,be | depart,roundabout-exit-1,arrive |
| a,f | ad,cf,cf | depart,roundabout-exit-2,arrive |
Scenario: Collinear in X,Y
Given the node map
@@ -249,13 +327,37 @@ Feature: Basic Roundabout
And the ways
| nodes | junction |
| ab | |
| ac | |
| bcdb | roundabout |
| ce | |
| df | |
| de | |
| bf | |
When I route I should get
| waypoints | route | turns |
| a,e | ab,ce,ce | depart,roundabout-exit-1,arrive |
| a,f | ab,df,df | depart,roundabout-exit-2,arrive |
| a,e | ac,de,de | depart,roundabout-exit-1,arrive |
| a,f | ac,bf,bf | depart,roundabout-exit-2,arrive |
Scenario: Enter and Exit - Bearings
Given the node map
| | | | a | | | |
| | | | | | | |
| | | i | b | l | | |
| h | | g | | c | | d |
| | | j | e | k | | |
| | | | | | | |
| | | | f | | | |
And the ways
| nodes | junction |
| ab | |
| cd | |
| ef | |
| gh | |
| bigjekclb | roundabout |
When I route I should get
| waypoints | route | turns | bearing |
| a,d | ab,cd,cd | depart,roundabout-exit-3,arrive | 0->180,180->270,90->0 |
| a,f | ab,ef,ef | depart,roundabout-exit-2,arrive | 0->180,180->270,180->0 |
| a,h | ab,gh,gh | depart,roundabout-exit-1,arrive | 0->180,180->270,270->0 |
+101
View File
@@ -0,0 +1,101 @@
@routing @guidance
Feature: Suppress New Names on dedicated Suffices
Background:
Given the profile "car"
Given a grid size of 10 meters
Scenario: Suffix To Suffix
Given the node map
| a | | b | | c |
And the ways
| nodes | name |
| ab | 42 N |
| bc | 42 S |
When I route I should get
| waypoints | route | turns |
| a,c | 42 N,42 S | depart,arrive |
Scenario: Suffix To Suffix Ref
Given the node map
| a | | b | | c |
And the ways
| nodes | name | ref |
| ab | 42 N | |
| bc | 42 S | 101 |
When I route I should get
| waypoints | route | turns |
| a,c | 42 N,42 S (101) | depart,arrive |
Scenario: Prefix Change
Given the node map
| a | | b | | c |
And the ways
| nodes | name |
| ab | West 42 |
| bc | East 42 |
When I route I should get
| waypoints | route | turns |
| a,c | West 42,East 42 | depart,arrive |
Scenario: Prefix Change and Reference
Given the node map
| a | | b | | c |
And the ways
| nodes | name | ref |
| ab | West 42 | 101 |
| bc | East 42 | |
When I route I should get
| waypoints | route | turns |
| a,c | West 42 (101),East 42 | depart,arrive |
Scenario: Suffix To Suffix - Turn
Given the node map
| a | | b | | c |
| | | d | | |
And the ways
| nodes | name |
| ab | 42 N |
| bc | 42 S |
| bd | 42 E |
When I route I should get
| waypoints | route | turns |
| a,c | 42 N,42 S | depart,arrive |
| a,d | 42 N,42 E,42 E | depart,turn right,arrive |
Scenario: Suffix To No Suffix
Given the node map
| a | | b | | c |
And the ways
| nodes | name |
| ab | 42 N |
| bc | 42 |
When I route I should get
| waypoints | route | turns |
| a,c | 42 N,42 | depart,arrive |
Scenario: No Suffix To Suffix
Given the node map
| a | | b | | c |
And the ways
| nodes | name |
| ab | 42 |
| bc | 42 S |
When I route I should get
| waypoints | route | turns |
| a,c | 42,42 S | depart,arrive |
+551
View File
@@ -282,3 +282,554 @@ Feature: Simple Turns
| h,c | first,second,second | depart,turn left,arrive |
| h,i | first,first,first | depart,continue uturn,arrive |
Scenario: Three Way Similar Sharp Turns
Given the node map
| a | | | | b |
| c | | | | |
| | d | | | |
And the ways
| nodes | highway |
| ab | primary |
| bc | primary |
| bd | primary |
When I route I should get
| waypoints | route | turns |
| a,c | ab,bc,bc | depart,turn sharp right,arrive |
| a,d | ab,bd,bd | depart,turn sharp right,arrive |
| d,c | bd,bc,bc | depart,turn sharp left,arrive |
| d,a | bd,ab,ab | depart,turn sharp left,arrive |
Scenario: Left Turn Assignment (1)
Given the node map
| | | | | d |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn slight left,arrive |
Scenario: Left Turn Assignment (2)
Given the node map
| | | | | d |
| | | | | |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn left,arrive |
Scenario: Left Turn Assignment (3)
Given the node map
| | | | d | |
| | | | | |
| | | | | |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn left,arrive |
Scenario: Left Turn Assignment (4)
Given the node map
| | | d | | |
| | | | | |
| | | | | |
| | | | | |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn left,arrive |
Scenario: Left Turn Assignment (5)
Given the node map
| | d | | | |
| | | | | |
| | | | | |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn left,arrive |
Scenario: Left Turn Assignment (6)
Given the node map
| d | | | | |
| | | | | |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp left,arrive |
Scenario: Left Turn Assignment (7)
Given the node map
| d | | | | |
| a | | b | | c |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp left,arrive |
Scenario: Right Turn Assignment (1)
Given the node map
| | | e | | |
| a | | b | | c |
| | | | | d |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn slight right,arrive |
Scenario: Right Turn Assignment (2)
Given the node map
| | | e | | |
| a | | b | | c |
| | | | | |
| | | | | d |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
Scenario: Right Turn Assignment (3)
Given the node map
| | | e | | |
| a | | b | | c |
| | | | | |
| | | | | |
| | | | d | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
Scenario: Right Turn Assignment (4)
Given the node map
| | | e | | |
| a | | b | | c |
| | | | | |
| | | | | |
| | | | | |
| | | d | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
Scenario: Right Turn Assignment (5)
Given the node map
| | | e | | |
| a | | b | | c |
| | | | | |
| | | | | |
| | d | | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
Scenario: Right Turn Assignment (6)
Given the node map
| | | e | | |
| a | | b | | c |
| | | | | |
| d | | | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
Scenario: Right Turn Assignment (7)
Given the node map
| | | e | | |
| a | | b | | c |
| d | | | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
Scenario: Right Turn Assignment Two Turns
Given the node map
| | | f | | |
| a | | b | | c |
| | | | | |
| d | e | | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
| a,e | abc,be,be | depart,turn right,arrive |
Scenario: Right Turn Assignment Two Turns (2)
Given the node map
| | | f | | c |
| a | | b | | |
| | | | | e |
| | | | d | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
| a,e | abc,be,be | depart,turn slight right,arrive |
Scenario: Right Turn Assignment Two Turns (3)
Given the node map
| | | f | | |
| a | | b | | c |
| | | | | e |
| | | | d | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
| a,e | abc,be,be | depart,turn slight right,arrive |
Scenario: Right Turn Assignment Two Turns (4)
Given the node map
| | | f | | |
| a | | b | | c |
| | | | | |
| | | d | | e |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
| a,e | abc,be,be | depart,turn slight right,arrive |
Scenario: Right Turn Assignment Three Turns
Given the node map
| | | g | | |
| a | | b | | c |
| | d | | f | |
| | | e | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
| bg | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
| a,e | abc,be,be | depart,turn right,arrive |
| a,f | abc,bf,bf | depart,turn slight right,arrive |
Scenario: Slight Turn involving Oneways
Given the node map
| | | a | | |
| | | | | |
| | | b | | e |
| d | | | | |
| | | c | | |
And the ways
| nodes | highway | oneway |
| abc | primary | yes |
| dbe | primary | no |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc | depart,arrive |
| d,e | dbe,dbe | depart,arrive |
| e,d | dbe,dbe | depart,arrive |
Scenario: Slight Turn involving Oneways
Given the node map
| | | | a | |
| | | | | |
| | | | | |
| | | b | | e |
| d | | | | |
| | | c | | |
And the ways
| nodes | highway | oneway |
| abc | primary | yes |
| dbe | primary | no |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc | depart,arrive |
| d,e | dbe,dbe | depart,arrive |
| e,d | dbe,dbe | depart,arrive |
Scenario: Slight Turn involving Oneways - Name Change
Given the node map
| | | a | | |
| | | | | |
| | | b | | e |
| d | | | | |
| | | c | | |
And the ways
| nodes | highway | oneway |
| abc | primary | yes |
| db | primary | no |
| be | primary | no |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc | depart,arrive |
| d,e | db,be,be | depart,new name slight right,arrive |
| e,d | be,db,db | depart,new name slight left,arrive |
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 1
Given the node map
| | | g | | |
| a | | b | | c |
| | | | | |
| | d | e | f | |
And the ways
| nodes | highway | oneway |
| abc | primary | no |
| db | primary | yes |
| eb | primary | no |
| fb | primary | no |
| bg | primary | no |
When I route I should get
| waypoints | route | turns |
| a,e | abc,eb,eb | depart,turn right,arrive |
| a,f | abc,fb,fb | depart,turn slight right,arrive |
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 2
Given the node map
| | | g | | |
| a | | b | | c |
| | | | | |
| | d | e | f | |
And the ways
| nodes | highway | oneway |
| abc | primary | no |
| db | primary | no |
| eb | primary | yes |
| fb | primary | no |
| bg | primary | no |
When I route I should get
| waypoints | route | turns |
| a,d | abc,db,db | depart,turn sharp right,arrive |
| a,f | abc,fb,fb | depart,turn right,arrive |
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 3
Given the node map
| | | g | | |
| a | | b | | c |
| | | | | |
| | d | e | f | |
And the ways
| nodes | highway | oneway |
| abc | primary | no |
| db | primary | no |
| be | primary | no |
| fb | primary | yes |
| bg | primary | no |
When I route I should get
| waypoints | route | turns |
| a,d | abc,db,db | depart,turn sharp right,arrive |
| a,e | abc,be,be | depart,turn right,arrive |
Scenario: Conflicting Turns with well distinguished turn
Given the node map
| a | | | b | | | c |
| | | | | | | |
| f | | | | | | d |
| | | | | | | e |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn slight right,arrive |
| a,e | abc,be,be | depart,turn right,arrive |
| a,f | abc,bf,bf | depart,turn sharp right,arrive |
Scenario: Conflicting Turns with well distinguished turn (back)
Given the node map
| a | | | b | | | c |
| | | | | | | |
| d | | | | | | f |
| | e | | | | | |
And the ways
| nodes | highway |
| abc | primary |
| bd | primary |
| be | primary |
| bf | primary |
When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
| a,e | abc,be,be | depart,turn right,arrive |
| a,f | abc,bf,bf | depart,turn slight right,arrive |
Scenario: Turn Lane on Splitting up Road
Given the node map
| | | | | | | | | | | | | | | |
| g | | | | f | | | | | | | | | | |
| | | | | | | | | | | | | | | |
| | | | | | h | | | e | | | c | | | d |
| a | | | b | | | | | | | | | | | |
| | | | i | | | | | | | | | | | |
And the ways
| nodes | highway | oneway | name |
| ab | secondary | yes | road |
| be | secondary | yes | road |
| ecd | secondary | no | road |
| efg | secondary | yes | road |
| ehb | secondary_link | yes | road |
| bi | tertiary | no | cross |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | ehb | be | b | no_left_turn |
When I route I should get
| waypoints | route | turns |
| a,d | road,road | depart,arrive |
| d,i | road,cross,cross | depart,turn left,arrive |
| d,g | road,road | depart,arrive |
@@ -0,0 +1,30 @@
@prepare @options @files
Feature: osrm-contract command line options: datasources
# expansions:
# {extracted_base} => path to current extracted input file
# {profile} => path to current profile script
Background:
Given the profile "testbot"
Given the extract extra arguments "--generate-edge-lookup"
And the node map
| a | b |
And the ways
| nodes |
| ab |
And the speed file
"""
1,2,27
2,1,27
2,3,27
3,2,27
1,4,27
4,1,27
"""
And the data has been extracted
Scenario: osrm-contract - Passing base file
When I run "osrm-contract --segment-speed-file speeds.csv {extracted_base}.osrm"
Then stderr should be empty
And datasource names should contain "lua profile,speeds"
And it should exit with code 0
+33 -17
View File
@@ -10,13 +10,11 @@ module.exports = function () {
});
this.Given(/^the extract extra arguments "(.*?)"$/, (args, callback) => {
this.setExtractArgs(args);
callback();
this.setExtractArgs(args, callback);
});
this.Given(/^the contract extra arguments "(.*?)"$/, (args, callback) => {
this.setContractArgs(args);
callback();
this.setContractArgs(args, callback);
});
this.Given(/^a grid size of (\d+) meters$/, (meters, callback) => {
@@ -49,18 +47,27 @@ module.exports = function () {
var addNode = (name, ri, ci, cb) => {
if (name) {
if (name.length !== 1) throw new Error(util.format('*** node invalid name %s, must be single characters', name));
if (!name.match(/[a-z0-9]/)) throw new Error(util.format('*** invalid node name %s, must me alphanumeric', name));
var lonLat;
if (name.match(/[a-z]/)) {
if (this.nameNodeHash[name]) throw new Error(util.format('*** duplicate node %s', name));
var nodeWithID = name.match(/([a-z])\:([0-9]*)/);
if (nodeWithID) {
var nodeName = nodeWithID[1],
nodeID = nodeWithID[2];
if (this.nameNodeHash[nodeName]) throw new Error(util.format('*** duplicate node %s', name));
lonLat = this.tableCoordToLonLat(ci, ri);
this.addOSMNode(name, lonLat[0], lonLat[1], null);
this.addOSMNode(nodeName, lonLat[0], lonLat[1], nodeID);
} else {
if (this.locationHash[name]) throw new Error(util.format('*** duplicate node %s'), name);
lonLat = this.tableCoordToLonLat(ci, ri);
this.addLocation(name, lonLat[0], lonLat[1], null);
if (name.length !== 1) throw new Error(util.format('*** node invalid name %s, must be single characters', name));
if (!name.match(/[a-z0-9]/)) throw new Error(util.format('*** invalid node name %s, must me alphanumeric', name));
var lonLat;
if (name.match(/[a-z]/)) {
if (this.nameNodeHash[name]) throw new Error(util.format('*** duplicate node %s', name));
lonLat = this.tableCoordToLonLat(ci, ri);
this.addOSMNode(name, lonLat[0], lonLat[1], null);
} else {
if (this.locationHash[name]) throw new Error(util.format('*** duplicate node %s'), name);
lonLat = this.tableCoordToLonLat(ci, ri);
this.addLocation(name, lonLat[0], lonLat[1], null);
}
}
cb();
@@ -221,13 +228,20 @@ module.exports = function () {
});
this.Given(/^the raster source$/, (data, callback) => {
this.updateFingerprintExtract(data);
fs.writeFile(path.resolve(this.TEST_FOLDER, 'rastersource.asc'), data, callback);
});
this.Given(/^the speed file$/, (data, callback) => {
this.updateFingerprintContract(data);
fs.writeFile(path.resolve(this.TEST_FOLDER, 'speeds.csv'), data, callback);
});
this.Given(/^the turn penalty file$/, (data, callback) => {
this.updateFingerprintContract(data);
fs.writeFile(path.resolve(this.TEST_FOLDER, 'penalties.csv'), data, callback);
});
this.Given(/^the data has been saved to disk$/, (callback) => {
try {
this.reprocess(callback);
@@ -238,9 +252,11 @@ module.exports = function () {
});
this.Given(/^the data has been extracted$/, (callback) => {
this.writeAndExtract((err) => {
if (err) this.processError = err;
callback();
this.osmData.populate(() => {
this.writeAndExtract((err) => {
if (err) this.processError = err;
callback();
});
});
});
+22 -1
View File
@@ -33,7 +33,10 @@ module.exports = function () {
var subMatchings = [],
turns = '',
route = '',
duration = '';
duration = '',
annotation = '',
OSMIDs = '';
if (res.statusCode === 200) {
if (headers.has('matchings')) {
@@ -54,6 +57,16 @@ module.exports = function () {
if (json.matchings.length != 1) throw new Error('*** Checking duration only supported for matchings with one subtrace');
duration = json.matchings[0].duration;
}
if (headers.has('annotation')) {
if (json.matchings.length != 1) throw new Error('*** Checking annotation only supported for matchings with one subtrace');
annotation = this.annotationList(json.matchings[0]);
}
if (headers.has('OSM IDs')) {
if (json.matchings.length != 1) throw new Error('*** CHecking annotation only supported for matchings with one subtrace');
OSMIDs = this.OSMIDList(json.matchings[0]);
}
}
if (headers.has('turns')) {
@@ -68,6 +81,14 @@ module.exports = function () {
got.duration = duration.toString();
}
if (headers.has('annotation')) {
got.annotation = annotation.toString();
}
if (headers.has('OSM IDs')) {
got['OSM IDs'] = OSMIDs;
}
var ok = true;
var encodedResult = '',
extendedTarget = '';
+7 -1
View File
@@ -1,7 +1,8 @@
var assert = require('assert');
var fs = require('fs');
module.exports = function () {
this.When(/^I run "osrm\-routed\s?(.*?)"$/, { timeout: this.SHUTDOWN_TIMEOUT }, (options, callback) => {
this.When(/^I run "osrm\-routed\s?(.*?)"$/, { timeout: this.TIMEOUT }, (options, callback) => {
this.runBin('osrm-routed', options, () => {
callback();
});
@@ -59,6 +60,11 @@ module.exports = function () {
assert.equal(this.stdout.split('\n').length - 1, parseInt(lines));
});
this.Then(/^datasource names should contain "(.+)"$/, (expectedData) => {
var actualData = fs.readFileSync(this.osmData.extractedFile + '.osrm.datasource_names', {encoding:'UTF-8'}).trim().split('\n').join(',');
assert.equal(actualData, expectedData);
});
this.Given(/^the query options$/, (table, callback) => {
table.raw().forEach(tuple => {
this.queryParams[tuple[0]] = tuple[1];
+3 -1
View File
@@ -12,7 +12,8 @@ module.exports = function () {
throw new Error('*** routability table must contain either "forw", "backw" or "bothw" column');
}
this.reprocessAndLoadData(() => {
this.reprocessAndLoadData((e) => {
if (e) callback(e);
var testRow = (row, i, cb) => {
var outputRow = row;
@@ -71,6 +72,7 @@ module.exports = function () {
r.status = res.statusCode === 200 ? 'x' : null;
if (r.status) {
r.route = this.wayList(r.json.routes[0]);
r.summary = r.json.routes[0].legs.map(l => l.summary).join(',');
if (r.route.split(',')[0] === util.format('w%d', i)) {
r.time = r.json.routes[0].duration;
+1 -2
View File
@@ -3,8 +3,7 @@ var d3 = require('d3-queue');
module.exports = function () {
this.When(/^I route I should get$/, this.WhenIRouteIShouldGet);
// This is used to route 100 times; timeout for entire step is therefore set to 100 * STRESS_TIMEOUT
this.When(/^I route (\d+) times I should get$/, { timeout: 30000 }, (n, table, callback) => {
this.When(/^I route (\d+) times I should get$/, { timeout: 100 * this.TIMEOUT }, (n, table, callback) => {
var q = d3.queue(1);
for (var i=0; i<n; i++) {
+2 -2
View File
@@ -46,8 +46,8 @@ module.exports = function () {
if (headers.has('trips')) {
subTrips = json.trips.filter(t => !!t).map(t => t.legs).map(tl => Array.prototype.concat.apply([], tl.map((sl, i) => {
var toAdd = [];
if (i === 0) toAdd.push(sl.steps[0].maneuver.location);
toAdd.push(sl.steps[sl.steps.length-1].maneuver.location);
if (i === 0) toAdd.push(sl.steps[0].intersections[0].location);
toAdd.push(sl.steps[sl.steps.length-1].intersections[0].location);
return toAdd;
})));
}
+26 -14
View File
@@ -19,8 +19,6 @@ module.exports = function () {
this.osmData = new classes.osmData(this);
this.STRESS_TIMEOUT = 300;
this.OSRMLoader = this._OSRMLoader();
this.PREPROCESS_LOG_FILE = path.resolve(this.TEST_FOLDER, 'preprocessing.log');
@@ -52,22 +50,27 @@ module.exports = function () {
};
var hashExtract = (cb) => {
this.hashOfFiles(util.format('%s/osrm-extract%s', this.BIN_PATH, this.EXE), (hash) => {
var files = [ util.format('%s/osrm-extract%s', this.BIN_PATH, this.EXE),
util.format('%s/libosrm_extract%s', this.BIN_PATH, this.LIB) ];
this.hashOfFiles(files, (hash) => {
this.binExtractHash = hash;
cb();
});
};
var hashContract = (cb) => {
this.hashOfFiles(util.format('%s/osrm-contract%s', this.BIN_PATH, this.EXE), (hash) => {
var files = [ util.format('%s/osrm-contract%s', this.BIN_PATH, this.EXE),
util.format('%s/libosrm_contract%s', this.BIN_PATH, this.LIB) ];
this.hashOfFiles(files, (hash) => {
this.binContractHash = hash;
this.fingerprintContract = this.hashString(this.binContractHash);
cb();
});
};
var hashRouted = (cb) => {
this.hashOfFiles(util.format('%s/osrm-routed%s', this.BIN_PATH, this.EXE), (hash) => {
var files = [ util.format('%s/osrm-routed%s', this.BIN_PATH, this.EXE),
util.format('%s/libosrm%s', this.BIN_PATH, this.LIB) ];
this.hashOfFiles(files, (hash) => {
this.binRoutedHash = hash;
this.fingerprintRoute = this.hashString(this.binRoutedHash);
cb();
@@ -81,16 +84,18 @@ module.exports = function () {
.defer(hashContract)
.defer(hashRouted)
.awaitAll(() => {
this.fingerprintExtract = this.hashString([this.profileHash, this.luaLibHash, this.binExtractHash].join('-'));
this.AfterConfiguration(() => {
callback();
});
});
};
this.setProfileBasedHashes = () => {
this.fingerprintExtract = this.hashString([this.profileHash, this.luaLibHash, this.binExtractHash].join('-'));
this.fingerprintContract = this.hashString(this.binContractHash);
this.updateFingerprintExtract = (str) => {
this.fingerprintExtract = this.hashString([this.fingerprintExtract, str].join('-'));
};
this.updateFingerprintContract = (str) => {
this.fingerprintContract = this.hashString([this.fingerprintContract, str].join('-'));
};
this.setProfile = (profile, cb) => {
@@ -99,17 +104,24 @@ module.exports = function () {
this.profile = profile;
this.hashProfile((hash) => {
this.profileHash = hash;
this.setProfileBasedHashes();
this.updateFingerprintExtract(this.profileHash);
cb();
});
} else cb();
} else {
this.updateFingerprintExtract(this.profileHash);
cb();
}
};
this.setExtractArgs = (args) => {
this.setExtractArgs = (args, callback) => {
this.extractArgs = args;
this.updateFingerprintExtract(args);
callback();
};
this.setContractArgs = (args) => {
this.setContractArgs = (args, callback) => {
this.contractArgs = args;
this.updateFingerprintContract(args);
callback();
};
};
+45 -28
View File
@@ -194,8 +194,8 @@ module.exports = function () {
this.extractData = (callback) => {
this.logPreprocessInfo();
this.log(util.format('== Extracting %s.osm...', this.osmData.osmFile), 'preprocess');
var cmd = util.format('%s%s/osrm-extract %s.osm %s --profile %s/%s.lua >>%s 2>&1',
this.LOAD_LIBRARIES, this.BIN_PATH, this.osmData.osmFile, this.extractArgs || '', this.PROFILES_PATH, this.profile, this.PREPROCESS_LOG_FILE);
var cmd = util.format('%s/osrm-extract %s.osm %s --profile %s/%s.lua >>%s 2>&1',
this.BIN_PATH, this.osmData.osmFile, this.extractArgs || '', this.PROFILES_PATH, this.profile, this.PREPROCESS_LOG_FILE);
this.log(cmd);
process.chdir(this.TEST_FOLDER);
exec(cmd, (err) => {
@@ -222,11 +222,12 @@ module.exports = function () {
});
};
['osrm','osrm.names','osrm.restrictions','osrm.ebg','osrm.enw','osrm.edges','osrm.fileIndex','osrm.geometry','osrm.nodes','osrm.ramIndex','osrm.properties'].forEach(file => {
q.defer(rename, file);
});
['osrm', 'osrm.ebg', 'osrm.edges', 'osrm.enw', 'osrm.fileIndex', 'osrm.geometry', 'osrm.icd',
'osrm.names', 'osrm.nodes', 'osrm.properties', 'osrm.ramIndex', 'osrm.restrictions'].forEach(file => {
q.defer(rename, file);
});
['osrm.edge_segment_lookup','osrm.edge_penalties'].forEach(file => {
['osrm.edge_penalties', 'osrm.edge_segment_lookup'].forEach(file => {
q.defer(renameIfExists, file);
});
@@ -241,8 +242,8 @@ module.exports = function () {
this.contractData = (callback) => {
this.logPreprocessInfo();
this.log(util.format('== Contracting %s.osm...', this.osmData.extractedFile), 'preprocess');
var cmd = util.format('%s%s/osrm-contract %s %s.osrm >>%s 2>&1',
this.LOAD_LIBRARIES, this.BIN_PATH, this.contractArgs || '', this.osmData.extractedFile, this.PREPROCESS_LOG_FILE);
var cmd = util.format('%s/osrm-contract %s %s.osrm >>%s 2>&1',
this.BIN_PATH, this.contractArgs || '', this.osmData.extractedFile, this.PREPROCESS_LOG_FILE);
this.log(cmd);
process.chdir(this.TEST_FOLDER);
exec(cmd, (err) => {
@@ -260,6 +261,13 @@ module.exports = function () {
});
};
var renameIfExists = (file, cb) => {
fs.stat([this.osmData.extractedFile, file].join('.'), (doesNotExistErr, exists) => {
if (exists) rename(file, cb);
else cb();
});
};
var copy = (file, cb) => {
this.log(util.format('Copying %s.%s to %s.%s', this.osmData.extractedFile, file, this.osmData.contractedFile, file), 'preprocess');
fs.createReadStream([this.osmData.extractedFile, file].join('.'))
@@ -273,11 +281,17 @@ module.exports = function () {
var q = d3.queue();
['osrm.hsgr','osrm.fileIndex','osrm.geometry','osrm.nodes','osrm.ramIndex','osrm.core','osrm.edges','osrm.datasource_indexes','osrm.datasource_names','osrm.level'].forEach((file) => {
q.defer(rename, file);
['osrm', 'osrm.core', 'osrm.datasource_indexes', 'osrm.datasource_names', 'osrm.ebg','osrm.edges',
'osrm.enw', 'osrm.fileIndex', 'osrm.geometry', 'osrm.hsgr', 'osrm.icd','osrm.level', 'osrm.names',
'osrm.nodes', 'osrm.properties', 'osrm.ramIndex', 'osrm.restrictions'].forEach((file) => {
q.defer(rename, file);
});
['osrm.edge_penalties', 'osrm.edge_segment_lookup'].forEach(file => {
q.defer(renameIfExists, file);
});
['osrm.names','osrm.restrictions','osrm.properties','osrm'].forEach((file) => {
[].forEach((file) => {
q.defer(copy, file);
});
@@ -292,30 +306,33 @@ module.exports = function () {
var noop = (cb) => cb();
this.reprocess = (callback) => {
this.writeAndExtract((e) => {
if (e) return callback(e);
this.osmData.populate(() => {
this.isContracted((isContracted) => {
var contractFn = isContracted ? noop : this.contractData;
if (isContracted) this.log('Already contracted ' + this.osmData.contractedFile, 'preprocess');
contractFn((e) => {
if (e) return callback(e);
this.logPreprocessDone();
if (!isContracted) {
this.writeAndExtract((e) => {
if (e) return callback(e);
this.contractData((e) => {
if (e) return callback(e);
this.logPreprocessDone();
callback();
});
});
} else {
this.log('Already contracted ' + this.osmData.contractedFile, 'preprocess');
callback();
});
}
});
});
};
this.writeAndExtract = (callback) => {
this.osmData.populate(() => {
this.writeInputData((e) => {
if (e) return callback(e);
this.isExtracted((isExtracted) => {
var extractFn = isExtracted ? noop : this.extractData;
if (isExtracted) this.log('Already extracted ' + this.osmData.extractedFile, 'preprocess');
extractFn((e) => {
callback(e);
});
this.writeInputData((e) => {
if (e) return callback(e);
this.isExtracted((isExtracted) => {
var extractFn = isExtracted ? noop : this.extractData;
if (isExtracted) this.log('Already extracted ' + this.osmData.extractedFile, 'preprocess');
extractFn((e) => {
callback(e);
});
});
});
+73 -6
View File
@@ -52,24 +52,91 @@ module.exports = {
match (got, want) {
var matchPercent = want.match(/(.*)\s+~(.+)%$/),
matchAbs = want.match(/(.*)\s+\+\-(.+)$/),
matchRe = want.match(/^\/(.*)\/$/);
matchRe = want.match(/^\/(.*)\/$/),
// we use this for matching before/after bearing
matchBearingListAbs = want.match(/^((\d+)->(\d+))(,(\d+)->(\d+))*\s+\+\-(.+)$/),
matchIntersectionListAbs = want.match(/^(((((true|false):\d+)\s{0,1})+,{0,1})+;{0,1})+\s+\+\-(.+)$/);
function inRange(margin, got, want) {
var fromR = parseFloat(want) - margin,
toR = parseFloat(want) + margin;
return parseFloat(got) >= fromR && parseFloat(got) <= toR;
}
function parseIntersectionString(str) {
return str.split(';')
.map((turn_intersections) => turn_intersections
.split(',')
.map((intersection) => intersection
.split(' ')
.map((entry_bearing_pair) => entry_bearing_pair
.split(':'))));
}
if (got === want) {
return true;
} else if (matchBearingListAbs) {
let want_and_margin = want.split('+-'),
margin = parseFloat(want_and_margin[1].trim()),
want_pairs = want_and_margin[0].trim().split(',').map((pair) => pair.split('->')),
got_pairs = got.split(',').map((pair) => pair.split('->'));
if (want_pairs.length != got_pairs.length)
{
return false;
}
for (var i = 0; i < want_pairs.length; ++i)
{
if (!inRange(margin, got_pairs[i][0], want_pairs[i][0]) ||
!inRange(margin, got_pairs[i][1], want_pairs[i][1]))
{
return false;
}
}
return true;
} else if (matchIntersectionListAbs) {
let margin = parseFloat(want.split('+-')[1]),
want_intersections = parseIntersectionString(want.split('+-')[0].trim()),
got_intersections = parseIntersectionString(got);
if (want_intersections.length != got_intersections.length)
{
return false;
}
for (let step_idx = 0; step_idx < want_intersections.length; ++step_idx)
{
if (want_intersections[step_idx].length != got_intersections[step_idx].length)
{
return false;
}
for (let intersection_idx = 0; intersection_idx < want_intersections[step_idx].length; ++intersection_idx)
{
if (want_intersections[step_idx][intersection_idx].length != got_intersections[step_idx][intersection_idx].length)
{
return false;
}
for (let pair_idx = 0; pair_idx < want_intersections[step_idx][intersection_idx].length; ++pair_idx)
{
let want_pair = want_intersections[step_idx][intersection_idx][pair_idx],
got_pair = got_intersections[step_idx][intersection_idx][pair_idx];
if (got_pair[0] != want_pair[0] ||
!inRange(margin, got_pair[1], want_pair[1]))
{
return false;
}
}
}
}
return true;
} else if (matchPercent) { // percentage range: 100 ~ 5%
var target = parseFloat(matchPercent[1]),
percentage = parseFloat(matchPercent[2]);
if (target === 0) {
return true;
} else {
var ratio = Math.abs(1 - parseFloat(got) / target);
let ratio = Math.abs(1 - parseFloat(got) / target);
return 100 * ratio < percentage;
}
} else if (matchAbs) { // absolute range: 100 +-5
var margin = parseFloat(matchAbs[2]),
fromR = parseFloat(matchAbs[1]) - margin,
toR = parseFloat(matchAbs[1]) + margin;
return parseFloat(got) >= fromR && parseFloat(got) <= toR;
let margin = parseFloat(matchAbs[2]);
return inRange(margin, got, matchAbs[1]);
} else if (matchRe) { // regex: /a,b,.*/
return got.match(matchRe[1]);
} else {
+6 -32
View File
@@ -6,10 +6,9 @@ var d3 = require('d3-queue');
module.exports = function () {
this.initializeEnv = (callback) => {
this.DEFAULT_PORT = 5000;
// OSX builds on Travis hit a timeout of ~2000 from time to time
this.DEFAULT_TIMEOUT = 5000;
this.setDefaultTimeout(this.DEFAULT_TIMEOUT);
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
this.TIMEOUT = process.env.CUCUMBER_TIMEOUT && parseInt(process.env.CUCUMBER_TIMEOUT) || 5000;
this.setDefaultTimeout(this.TIMEOUT);
this.ROOT_FOLDER = process.cwd();
this.OSM_USER = 'osrm';
this.OSM_GENERATOR = 'osrm-test';
@@ -25,25 +24,20 @@ module.exports = function () {
this.BIN_PATH = path.resolve(this.ROOT_FOLDER, 'build');
this.DEFAULT_INPUT_FORMAT = 'osm';
this.DEFAULT_ORIGIN = [1,1];
this.LAUNCH_TIMEOUT = 1000;
this.SHUTDOWN_TIMEOUT = 10000;
this.DEFAULT_LOAD_METHOD = 'datastore';
this.OSRM_ROUTED_LOG_FILE = path.resolve(this.TEST_FOLDER, 'osrm-routed.log');
this.ERROR_LOG_FILE = path.resolve(this.TEST_FOLDER, 'error.log');
// OS X shim to ensure shared libraries from custom locations can be loaded
// This is needed in OS X >= 10.11 because DYLD_LIBRARY_PATH is blocked
// https://forums.developer.apple.com/thread/9233
this.LOAD_LIBRARIES = process.env.OSRM_SHARED_LIBRARY_PATH ? util.format('DYLD_LIBRARY_PATH=%s ', process.env.OSRM_SHARED_LIBRARY_PATH) : '';
// TODO make sure this works on win
if (process.platform.match(/indows.*/)) {
this.TERMSIGNAL = 9;
this.EXE = '.exe';
this.LIB = '.dll';
this.QQ = '"';
} else {
this.TERMSIGNAL = 'SIGTERM';
this.EXE = '';
this.LIB = '.so';
this.QQ = '';
}
@@ -51,26 +45,6 @@ module.exports = function () {
console.info(util.format('Node Version', process.version));
if (parseInt(process.version.match(/v(\d)/)[1]) < 4) throw new Error('*** PLease upgrade to Node 4.+ to run OSRM cucumber tests');
if (process.env.OSRM_PORT) {
this.OSRM_PORT = parseInt(process.env.OSRM_PORT);
// eslint-disable-next-line no-console
console.info(util.format('Port set to %d', this.OSRM_PORT));
} else {
this.OSRM_PORT = this.DEFAULT_PORT;
// eslint-disable-next-line no-console
console.info(util.format('Using default port %d', this.OSRM_PORT));
}
if (process.env.OSRM_TIMEOUT) {
this.OSRM_TIMEOUT = parseInt(process.env.OSRM_TIMEOUT);
// eslint-disable-next-line no-console
console.info(util.format('Timeout set to %d', this.OSRM_TIMEOUT));
} else {
this.OSRM_TIMEOUT = this.DEFAULT_TIMEOUT;
// eslint-disable-next-line no-console
console.info(util.format('Using default timeout %d', this.OSRM_TIMEOUT));
}
fs.exists(this.TEST_FOLDER, (exists) => {
if (!exists) throw new Error(util.format('*** Test folder %s doesn\'t exist.', this.TEST_FOLDER));
callback();
@@ -88,7 +62,7 @@ module.exports = function () {
var binPath = path.resolve(util.format('%s/%s%s', this.BIN_PATH, bin, this.EXE));
fs.exists(binPath, (exists) => {
if (!exists) throw new Error(util.format('%s is missing. Build failed?', binPath));
var helpPath = util.format('%s%s --help > /dev/null 2>&1', this.LOAD_LIBRARIES, binPath);
var helpPath = util.format('%s --help > /dev/null 2>&1', binPath);
exec(helpPath, (err) => {
if (err) {
this.log(util.format('*** Exited with code %d', err.code), 'preprocess');
+9 -3
View File
@@ -6,14 +6,19 @@ var d3 = require('d3-queue');
module.exports = function () {
this.hashOfFiles = (paths, cb) => {
paths = Array.isArray(paths) ? paths : [paths];
var shasum = crypto.createHash('sha1');
var shasum = crypto.createHash('sha1'), hashedFiles = false;
var q = d3.queue(1);
var addFile = (path, cb) => {
fs.readFile(path, (err, data) => {
shasum.update(data);
cb(err);
if (err && err.code === 'ENOENT') cb(); // ignore non-existing files
else if (err) cb(err);
else {
shasum.update(data);
hashedFiles = true;
cb();
}
});
};
@@ -21,6 +26,7 @@ module.exports = function () {
q.awaitAll(err => {
if (err) throw new Error('*** Error reading files:', err);
if (!hashedFiles) throw new Error('*** No files found: [' + paths.join(', ') + ']');
cb(shasum.digest('hex'));
});
};
+8 -4
View File
@@ -20,14 +20,18 @@ module.exports = function () {
this.hasLoggedScenarioInfo = false;
this.setGridSize(this.DEFAULT_GRID_SIZE);
this.setOrigin(this.DEFAULT_ORIGIN);
this.fingerprintExtract = this.hashString([this.luaLibHash, this.binExtractHash].join('-'));
this.fingerprintContract = this.hashString(this.binContractHash);
callback();
});
this.After((scenario, callback) => {
this.setExtractArgs('');
this.setContractArgs('');
if (this.loadMethod === 'directly' && !!this.OSRMLoader.loader) this.OSRMLoader.shutdown(callback);
else callback();
this.setExtractArgs('', () => {
this.setContractArgs('', () => {
if (this.loadMethod === 'directly' && !!this.OSRMLoader.loader) this.OSRMLoader.shutdown(callback);
else callback();
});
});
});
this.Around('@stress', (scenario, callback) => {
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = function () {
};
this.sendRequest = (baseUri, parameters, callback) => {
var limit = Timeout(this.OSRM_TIMEOUT, { err: { statusCode: 408 } });
var limit = Timeout(this.TIMEOUT, { err: { statusCode: 408 } });
var runRequest = (cb) => {
var params = this.paramsToString(parameters);
+22 -21
View File
@@ -1,9 +1,9 @@
'use strict';
var fs = require('fs');
var net = require('net');
var spawn = require('child_process').spawn;
var util = require('util');
var net = require('net');
var Timeout = require('node-timeout');
var OSRMBaseLoader = class {
@@ -12,19 +12,17 @@ var OSRMBaseLoader = class {
}
launch (callback) {
var limit = Timeout(this.scope.LAUNCH_TIMEOUT, { err: this.scope.RoutedError('Launching osrm-routed timed out.') });
var limit = Timeout(this.scope.TIMEOUT, { err: this.scope.RoutedError('Launching osrm-routed timed out.') });
var runLaunch = (cb) => {
this.osrmUp(() => {
this.waitForConnection(cb);
});
this.osrmUp(() => { this.waitForConnection(cb); });
};
runLaunch(limit((e) => { if (e) callback(e); else callback(); }));
}
shutdown (callback) {
var limit = Timeout(this.scope.SHUTDOWN_TIMEOUT, { err: this.scope.RoutedError('Shutting down osrm-routed timed out.')});
var limit = Timeout(this.scope.TIMEOUT, { err: this.scope.RoutedError('Shutting down osrm-routed timed out.')});
var runShutdown = (cb) => {
this.osrmDown(cb);
@@ -46,18 +44,21 @@ var OSRMBaseLoader = class {
}
waitForConnection (callback) {
net.connect({
port: this.scope.OSRM_PORT,
host: '127.0.0.1'
})
.on('connect', () => {
callback();
})
.on('error', (e) => {
setTimeout(() => {
callback(e);
}, 100);
});
var retryCount = 0;
var connectWithRetry = () => {
net.connect({ port: this.scope.OSRM_PORT, host: '127.0.0.1' })
.on('connect', () => { callback(); })
.on('error', () => {
if (retryCount < 2) {
retryCount++;
setTimeout(connectWithRetry, 100);
} else {
callback(new Error('Could not connect to osrm-routed after three retires'));
}
});
};
connectWithRetry();
}
waitForShutdown (callback) {
@@ -86,7 +87,7 @@ var OSRMDirectLoader = class extends OSRMBaseLoader {
fs.appendFile(this.scope.OSRM_ROUTED_LOG_FILE, data, (err) => { if (err) throw err; });
};
var child = spawn(util.format('%s%s/osrm-routed', this.scope.LOAD_LIBRARIES, this.scope.BIN_PATH), [this.inputFile, util.format('-p%d', this.scope.OSRM_PORT)]);
var child = spawn(util.format('%s/osrm-routed', this.scope.BIN_PATH), [this.inputFile, util.format('-p%d', this.scope.OSRM_PORT)]);
this.scope.pid = child.pid;
child.stdout.on('data', writeToLog);
child.stderr.on('data', writeToLog);
@@ -122,7 +123,7 @@ var OSRMDatastoreLoader = class extends OSRMBaseLoader {
fs.appendFile(this.scope.OSRM_ROUTED_LOG_FILE, data, (err) => { if (err) throw err; });
};
var child = spawn(util.format('%s%s/osrm-routed', this.scope.LOAD_LIBRARIES, this.scope.BIN_PATH), ['--shared-memory=1', util.format('-p%d', this.scope.OSRM_PORT)]);
var child = spawn(util.format('%s/osrm-routed', this.scope.BIN_PATH), ['--shared-memory=1', util.format('-p%d', this.scope.OSRM_PORT)]);
this.child = child;
this.scope.pid = child.pid;
child.stdout.on('data', writeToLog);
@@ -148,7 +149,7 @@ module.exports = {
this.loader = new OSRMDirectLoader(this.scope);
this.loader.load(inputFile, callback);
} else {
throw new Error('*** Unknown load method ' + method);
callback(new Error('*** Unknown load method ' + method));
}
}
+53 -2
View File
@@ -1,3 +1,5 @@
'use strict';
var Timeout = require('node-timeout');
var request = require('request');
@@ -15,7 +17,7 @@ module.exports = function () {
this.requestUrl = (path, callback) => {
var uri = this.query = [this.HOST, path].join('/'),
limit = Timeout(this.OSRM_TIMEOUT, { err: { statusCode: 408 } });
limit = Timeout(this.TIMEOUT, { err: { statusCode: 408 } });
function runRequest (cb) {
request(uri, cb);
@@ -127,12 +129,43 @@ module.exports = function () {
}
};
this.summary = (instructions) => {
if (instructions) {
return instructions.legs.map(l => l.summary).join(',');
}
};
this.wayList = (instructions) => {
return this.extractInstructionList(instructions, s => s.name);
};
this.pronunciationList = (instructions) => {
return this.extractInstructionList(instructions, s => s.pronunciation || '');
};
this.destinationsList = (instructions) => {
return this.extractInstructionList(instructions, s => s.destinations || '');
};
this.bearingList = (instructions) => {
return this.extractInstructionList(instructions, s => s.maneuver.bearing_after);
return this.extractInstructionList(instructions, s => s.maneuver.bearing_before + '->' + s.maneuver.bearing_after);
};
this.annotationList = (instructions) => {
function zip(list_1, list_2)
{
let pairs = [];
for (let i = 0; i < list_1.length; ++i) {
pairs.push([list_1[i], list_2[i]]);
}
return pairs;
}
return instructions.legs.map(l => {return zip(l.annotation.duration, l.annotation.distance).map(p => { return p.join(':'); }).join(','); }).join(',');
};
this.OSMIDList = (instructions) => {
// OSM node IDs also come from the annotation list
return instructions.legs.map(l => l.annotation.nodes.map(n => n.toString()).join(',')).join(',');
};
this.turnList = (instructions) => {
@@ -142,6 +175,9 @@ module.exports = function () {
case 'depart':
case 'arrive':
return v.maneuver.type;
case 'on ramp':
case 'off ramp':
return v.maneuver.type + ' ' + v.maneuver.modifier;
case 'roundabout':
return 'roundabout-exit-' + v.maneuver.exit;
case 'rotary':
@@ -149,6 +185,8 @@ module.exports = function () {
return v.rotary_name + '-exit-' + v.maneuver.exit;
else
return 'rotary-exit-' + v.maneuver.exit;
case 'roundabout turn':
return v.maneuver.type + ' ' + v.maneuver.modifier + ' exit-' + v.maneuver.exit;
// FIXME this is a little bit over-simplistic for merge/fork instructions
default:
return v.maneuver.type + ' ' + v.maneuver.modifier;
@@ -157,6 +195,19 @@ module.exports = function () {
.join(',');
};
this.intersectionList = (instructions) => {
return instructions.legs.reduce((m, v) => m.concat(v.steps), [])
.map( v => {
return v.intersections
.map( intersection => {
var string = intersection.entry[0]+':'+intersection.bearings[0], i;
for( i = 1; i < intersection.bearings.length; ++i )
string = string + ' ' + intersection.entry[i]+':'+intersection.bearings[i];
return string;
}).join(',');
}).join(';');
};
this.modeList = (instructions) => {
return this.extractInstructionList(instructions, s => s.mode);
};
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = function () {
opts = opts.replace('{profile}', [this.PROFILES_PATH, this.profile + '.lua'].join('/'));
}
var cmd = util.format('%s%s%s/%s%s%s %s 2>%s', this.QQ, this.LOAD_LIBRARIES, this.BIN_PATH, bin, this.EXE, this.QQ, opts, this.ERROR_LOG_FILE);
var cmd = util.format('%s%s/%s%s%s %s 2>%s', this.QQ, this.BIN_PATH, bin, this.EXE, this.QQ, opts, this.ERROR_LOG_FILE);
process.chdir(this.TEST_FOLDER);
exec(cmd, (err, stdout, stderr) => {
this.stdout = stdout.toString();
+19 -3
View File
@@ -1,3 +1,5 @@
'use strict';
var util = require('util');
var assert = require('assert');
@@ -31,19 +33,23 @@ module.exports = function () {
var afterRequest = (err, res, body) => {
if (err) return cb(err);
if (body && body.length) {
var instructions, bearings, turns, modes, times, distances;
let destinations, pronunciations, instructions, bearings, turns, modes, times, distances, summary, intersections;
var json = JSON.parse(body);
let json = JSON.parse(body);
var hasRoute = json.code === 'Ok';
let hasRoute = json.code === 'Ok';
if (hasRoute) {
instructions = this.wayList(json.routes[0]);
pronunciations = this.pronunciationList(json.routes[0]);
destinations = this.destinationsList(json.routes[0]);
bearings = this.bearingList(json.routes[0]);
turns = this.turnList(json.routes[0]);
intersections = this.intersectionList(json.routes[0]);
modes = this.modeList(json.routes[0]);
times = this.timeList(json.routes[0]);
distances = this.distanceList(json.routes[0]);
summary = this.summary(json.routes[0]);
}
if (headers.has('status')) {
@@ -66,6 +72,10 @@ module.exports = function () {
if (headers.has('route')) {
got.route = (instructions || '').trim();
if (headers.has('summary')) {
got.summary = (summary || '').trim();
}
if (headers.has('alternative')) {
// TODO examine more than first alternative?
got.alternative ='';
@@ -103,6 +113,10 @@ module.exports = function () {
}
}
if (headers.has('intersections')) {
got.intersections = (intersections || '').trim();
}
var putValue = (key, value) => {
if (headers.has(key)) got[key] = instructions ? value : '';
};
@@ -112,6 +126,8 @@ module.exports = function () {
putValue('modes', modes);
putValue('times', times);
putValue('distances', distances);
putValue('pronunciations', pronunciations);
putValue('destinations', destinations);
}
var ok = true;
+3 -2
View File
@@ -3,6 +3,7 @@ Feature: Alternative route
Background:
Given the profile "testbot"
And a grid size of 200 meters
And the node map
| | b | c | d | | |
@@ -17,11 +18,11 @@ Feature: Alternative route
| dz |
| ag |
| gh |
| ck |
| kh |
| hi |
| ij |
| jz |
| ck |
| kh |
Scenario: Enabled alternative
Given the query options
+1 -1
View File
@@ -56,7 +56,7 @@ Feature: Basic Routing
Scenario: Two ways connected in a straight line
Given the node map
| a | b | c |
| a | | b | | c |
And the ways
| nodes |
+73 -73
View File
@@ -14,8 +14,8 @@ Feature: Compass bearing
| ab |
When I route I should get
| from | to | route | bearing |
| a | b | ab,ab | 315,0 |
| from | to | route | bearing |
| a | b | ab,ab | 0->315,315->0|
Scenario: Bearing when going west
Given the node map
@@ -26,8 +26,8 @@ Feature: Compass bearing
| ab |
When I route I should get
| from | to | route | bearing |
| a | b | ab,ab | 270,0 |
| from | to | route | bearing |
| a | b | ab,ab | 0->270,270->0|
Scenario: Bearing af 45 degree intervals
Given the node map
@@ -48,14 +48,14 @@ Feature: Compass bearing
When I route I should get
| from | to | route | bearing |
| x | a | xa,xa | 0,0 |
| x | b | xb,xb | 315,0 |
| x | c | xc,xc | 270,0 |
| x | d | xd,xd | 225,0 |
| x | e | xe,xe | 180,0 |
| x | f | xf,xf | 135,0 |
| x | g | xg,xg | 90,0 |
| x | h | xh,xh | 45,0 |
| x | a | xa,xa | 0->0,0->0|
| x | b | xb,xb | 0->315,315->0|
| x | c | xc,xc | 0->270,270->0|
| x | d | xd,xd | 0->225,225->0|
| x | e | xe,xe | 0->180,180->0|
| x | f | xf,xf | 0->135,135->0|
| x | g | xg,xg | 0->90,90->0|
| x | h | xh,xh | 0->45,45->0|
Scenario: Bearing in a roundabout
Given the node map
@@ -76,9 +76,9 @@ Feature: Compass bearing
| ha | yes |
When I route I should get
| from | to | route | bearing |
| c | b | cd,de,ef,fg,gh,ha,ab,ab | 270,225,180,135,90,45,0,0 |
| g | f | gh,ha,ab,bc,cd,de,ef,ef | 90,45,0,315,270,225,180,0 |
| from | to | route | bearing |
| c | b | cd,de,ef,fg,gh,ha,ab,ab | 0->270,270->225,225->180,180->135,135->90,90->45,45->0,0->0 |
| g | f | gh,ha,ab,bc,cd,de,ef,ef | 0->90,90->45,45->0,0->315,315->270,270->225,225->180,180->0 |
Scenario: Bearing should stay constant when zig-zagging
Given the node map
@@ -97,7 +97,7 @@ Feature: Compass bearing
When I route I should get
| from | to | route | bearing |
| a | h | ab,bc,cd,de,ef,fg,gh,gh | 0,135,0,135,0,135,0,0 |
| a | h | ab,bc,cd,de,ef,fg,gh,gh | 0->0,0->135,135->0,0->135,135->0,0->135,135->0,0->0 |
Scenario: Bearings on an east-west way.
Given the node map
@@ -108,37 +108,37 @@ Feature: Compass bearing
| abcdef |
When I route I should get
| from | to | route | bearing |
| a | b | abcdef,abcdef | 90,0 |
| a | c | abcdef,abcdef | 90,0 |
| a | d | abcdef,abcdef | 90,0 |
| a | e | abcdef,abcdef | 90,0 |
| a | f | abcdef,abcdef | 90,0 |
| b | a | abcdef,abcdef | 270,0 |
| b | c | abcdef,abcdef | 90,0 |
| b | d | abcdef,abcdef | 90,0 |
| b | e | abcdef,abcdef | 90,0 |
| b | f | abcdef,abcdef | 90,0 |
| c | a | abcdef,abcdef | 270,0 |
| c | b | abcdef,abcdef | 270,0 |
| c | d | abcdef,abcdef | 90,0 |
| c | e | abcdef,abcdef | 90,0 |
| c | f | abcdef,abcdef | 90,0 |
| d | a | abcdef,abcdef | 270,0 |
| d | b | abcdef,abcdef | 270,0 |
| d | c | abcdef,abcdef | 270,0 |
| d | e | abcdef,abcdef | 90,0 |
| d | f | abcdef,abcdef | 90,0 |
| e | a | abcdef,abcdef | 270,0 |
| e | b | abcdef,abcdef | 270,0 |
| e | c | abcdef,abcdef | 270,0 |
| e | d | abcdef,abcdef | 270,0 |
| e | f | abcdef,abcdef | 90,0 |
| f | a | abcdef,abcdef | 270,0 |
| f | b | abcdef,abcdef | 270,0 |
| f | c | abcdef,abcdef | 270,0 |
| f | d | abcdef,abcdef | 270,0 |
| f | e | abcdef,abcdef | 270,0 |
| from | to | route | bearing |
| a | b | abcdef,abcdef | 0->90,90->0 |
| a | c | abcdef,abcdef | 0->90,90->0 |
| a | d | abcdef,abcdef | 0->90,90->0 |
| a | e | abcdef,abcdef | 0->90,90->0 |
| a | f | abcdef,abcdef | 0->90,90->0 |
| b | a | abcdef,abcdef | 0->270,270->0 |
| b | c | abcdef,abcdef | 0->90,90->0 |
| b | d | abcdef,abcdef | 0->90,90->0 |
| b | e | abcdef,abcdef | 0->90,90->0 |
| b | f | abcdef,abcdef | 0->90,90->0 |
| c | a | abcdef,abcdef | 0->270,270->0 |
| c | b | abcdef,abcdef | 0->270,270->0 |
| c | d | abcdef,abcdef | 0->90,90->0 |
| c | e | abcdef,abcdef | 0->90,90->0 |
| c | f | abcdef,abcdef | 0->90,90->0 |
| d | a | abcdef,abcdef | 0->270,270->0 |
| d | b | abcdef,abcdef | 0->270,270->0 |
| d | c | abcdef,abcdef | 0->270,270->0 |
| d | e | abcdef,abcdef | 0->90,90->0 |
| d | f | abcdef,abcdef | 0->90,90->0 |
| e | a | abcdef,abcdef | 0->270,270->0 |
| e | b | abcdef,abcdef | 0->270,270->0 |
| e | c | abcdef,abcdef | 0->270,270->0 |
| e | d | abcdef,abcdef | 0->270,270->0 |
| e | f | abcdef,abcdef | 0->90,90->0 |
| f | a | abcdef,abcdef | 0->270,270->0 |
| f | b | abcdef,abcdef | 0->270,270->0 |
| f | c | abcdef,abcdef | 0->270,270->0 |
| f | d | abcdef,abcdef | 0->270,270->0 |
| f | e | abcdef,abcdef | 0->270,270->0 |
Scenario: Bearings at high latitudes
# The coordinas below was calculated using http://www.movable-type.co.uk/scripts/latlong.html,
@@ -161,19 +161,19 @@ Feature: Compass bearing
| bd |
When I route I should get
| from | to | route | bearing |
| a | b | ab,ab | 0,0 |
| b | c | bc,bc | 90,0 |
| c | d | cd,cd | 180,0 |
| d | a | da,da | 270,0 |
| b | a | ab,ab | 180,0 |
| c | b | bc,bc | 270,0 |
| d | c | cd,cd | 0,0 |
| a | d | da,da | 90,0 |
| a | c | ac,ac | 45,0 |
| c | a | ac,ac | 225,0 |
| b | d | bd,bd | 135,0 |
| d | b | bd,bd | 315,0 |
| from | to | route | bearing |
| a | b | ab,ab | 0->0,0->0 |
| b | c | bc,bc | 0->90,90->0 |
| c | d | cd,cd | 0->180,180->0 |
| d | a | da,da | 0->270,270->0 |
| b | a | ab,ab | 0->180,180->0 |
| c | b | bc,bc | 0->270,270->0 |
| d | c | cd,cd | 0->0,0->0 |
| a | d | da,da | 0->90,90->0 |
| a | c | ac,ac | 0->45,45->0 |
| c | a | ac,ac | 0->225,225->0 |
| b | d | bd,bd | 0->135,135->0 |
| d | b | bd,bd | 0->315,315->0 |
Scenario: Bearings at high negative latitudes
# The coordinas below was calculated using http://www.movable-type.co.uk/scripts/latlong.html,
@@ -196,16 +196,16 @@ Feature: Compass bearing
| bd |
When I route I should get
| from | to | route | bearing |
| a | b | ab,ab | 180,0 |
| b | c | bc,bc | 90,0 |
| c | d | cd,cd | 0,0 |
| d | a | da,da | 270,0 |
| b | a | ab,ab | 0,0 |
| c | b | bc,bc | 270,0 |
| d | c | cd,cd | 180,0 |
| a | d | da,da | 90,0 |
| a | c | ac,ac | 135,0 |
| c | a | ac,ac | 315,0 |
| b | d | bd,bd | 45,0 |
| d | b | bd,bd | 225,0 |
| from | to | route | bearing |
| a | b | ab,ab | 0->180,180->0 |
| b | c | bc,bc | 0->90,90->0 |
| c | d | cd,cd | 0->0,0->0 |
| d | a | da,da | 0->270,270->0 |
| b | a | ab,ab | 0->0,0->0 |
| c | b | bc,bc | 0->270,270->0 |
| d | c | cd,cd | 0->180,180->0 |
| a | d | da,da | 0->90,90->0 |
| a | c | ac,ac | 0->135,135->0 |
| c | a | ac,ac | 0->315,315->0 |
| b | d | bd,bd | 0->45,45->0 |
| d | b | bd,bd | 0->225,225->0 |
+44 -40
View File
@@ -15,11 +15,11 @@ Feature: Bearing parameter
When I route I should get
| from | to | bearings | route | bearing |
| b | c | 90 90 | ad,ad | 90,0 |
| b | c | 90 90 | ad,ad | 0->90,90->0|
| b | c | 180 90 | | |
| b | c | 80 100 | ad,ad | 90,0 |
| b | c | 80 100 | ad,ad | 0->90,90->0|
| b | c | 79 100 | | |
| b | c | 79,11 100 | ad,ad | 90,0 |
| b | c | 79,11 100 | ad,ad | 0->90,90->0|
Scenario: Testbot - Intial bearing in simple case
Given the node map
@@ -35,16 +35,16 @@ Feature: Bearing parameter
When I route I should get
| from | to | bearings | route | bearing |
| 0 | c | 0 0 | | |
| 0 | c | 45 45 | bc,bc | 45 ~3% |
| 0 | c | 45 45 | bc,bc | 0->44,44->0 +- 1|
| 0 | c | 85 85 | | |
| 0 | c | 95 95 | | |
| 0 | c | 135 135 | ac,ac | 135 ~1% |
| 0 | c | 135 135 | ac,ac | 0->135,135->0 +- 1|
| 0 | c | 180 180 | | |
Scenario: Testbot - Initial bearing on split way
Given the node map
| d | | | | | 1 | | | | | c |
| a | | | | | 0 | | | | | b |
| g | d | | | | | 1 | | | | | c | f |
| h | a | | | | | 0 | | | | | b | e |
And the ways
| nodes | oneway |
@@ -52,22 +52,26 @@ Feature: Bearing parameter
| bc | yes |
| cd | yes |
| da | yes |
| be | yes |
| fc | yes |
| dg | yes |
| ha | yes |
When I route I should get
| from | to | bearings | route | bearing |
| 0 | b | 10 10 | bc,bc | 0,0 |
| 0 | b | 90 90 | ab,ab | 90,0 |
| 0 | b | 10 10 | bc,bc | 0->0,0->0 |
| 0 | b | 90 90 | ab,ab | 0->90,90->0 |
# The returned bearing is wrong here, it's based on the snapped
# coordinates, not the acutal edge bearing. This should be
# fixed one day, but it's only a problem when we snap two vias
# to the same point - DP
#| 0 | b | 170 170 | da | 180 |
#| 0 | b | 189 189 | da | 180 |
| 0 | 1 | 90 270 | ab,bc,cd,cd | 90,0,270,0 |
| 1 | d | 10 10 | bc,bc | 0,0 |
| 1 | d | 90 90 | ab,bc,cd,da,da | 90,0,270,180,0 |
| 1 | 0 | 189 189 | da,da | 180,0 |
| 1 | d | 270 270 | cd,cd | 270,0 |
| 0 | 1 | 90 270 | ab,bc,cd,cd | 0->90,90->0,0->270,270->0 |
| 1 | d | 10 10 | bc,bc | 0->0,0->0 |
| 1 | d | 90 90 | ab,bc,cd,da,da | 0->90,90->0,0->270,270->180,180->0 |
| 1 | 0 | 189 189 | da,da | 0->180,180->0 |
| 1 | d | 270 270 | cd,cd | 0->270,270->0 |
| 1 | d | 349 349 | | |
Scenario: Testbot - Initial bearing in all direction
@@ -81,31 +85,31 @@ Feature: Bearing parameter
| f | | | e | | | d |
And the ways
| nodes | oneway |
| ia | yes |
| jb | yes |
| kc | yes |
| ld | yes |
| me | yes |
| nf | yes |
| og | yes |
| ph | yes |
| ab | yes |
| bc | yes |
| cd | yes |
| de | yes |
| ef | yes |
| fg | yes |
| gh | yes |
| ha | yes |
| nodes | oneway | name |
| ia | yes | ia |
| jb | yes | jb |
| kc | yes | kc |
| ld | yes | ld |
| me | yes | me |
| nf | yes | nf |
| og | yes | og |
| ph | yes | ph |
| ab | yes | ring |
| bc | yes | ring |
| cd | yes | ring |
| de | yes | ring |
| ef | yes | ring |
| fg | yes | ring |
| gh | yes | ring |
| ha | yes | ring |
When I route I should get
| from | to | bearings | route | bearing |
| 0 | q | 0 90 | ia,ab,bc,cd,de,ef,fg,gh,ha,ha | 0,90,180,180,270,270,0,0,90,0 |
| 0 | a | 45 90 | jb,bc,cd,de,ef,fg,gh,ha,ha | 45,180,180,270,270,0,0,90,0 |
| 0 | q | 90 90 | kc,cd,de,ef,fg,gh,ha,ha | 90,180,270,270,0,0,90,0 |
| 0 | a | 135 90 | ld,de,ef,fg,gh,ha,ha | 135,270,270,0,0,90,0 |
| 0 | a | 180 90 | me,ef,fg,gh,ha,ha | 180,270,0,0,90,0 |
| 0 | a | 225 90 | nf,fg,gh,ha,ha | 225,0,0,90,0 |
| 0 | a | 270 90 | og,gh,ha,ha | 270,0,90,0 |
| 0 | a | 315 90 | ph,ha,ha | 315,90,0 |
| from | to | bearings | route | bearing |
| 0 | q | 0 90 | ia,ring,ring,ring,ring,ring | 0->0,0->90,180->270,270->0,0->90,90->0 |
| 0 | a | 45 90 | jb,ring,ring,ring,ring,ring | 0->45,45->180,180->270,270->0,0->90,90->0 |
| 0 | q | 90 90 | kc,ring,ring,ring,ring | 0->90,90->180,270->0,0->90,90->0 |
| 0 | a | 135 90 | ld,ring,ring,ring,ring | 0->135,135->270,270->0,0->90,90->0 |
| 0 | a | 180 90 | me,ring,ring,ring | 0->180,180->270,0->90,90->0 |
| 0 | a | 225 90 | nf,ring,ring,ring | 0->225,225->0,0->90,90->0 |
| 0 | a | 270 90 | og,ring,ring | 0->270,270->0,90->0 |
| 0 | a | 315 90 | ph,ring,ring | 0->315,315->90,90->0 |
+2 -2
View File
@@ -18,5 +18,5 @@ Feature: Geometry Compression
When I route I should get
| from | to | route | distance | speed |
| b | e | abcdef,abcdef | 589m | 36 km/h |
| e | b | abcdef,abcdef | 589m | 36 km/h |
| b | e | abcdef,abcdef | 588.8m | 36 km/h |
| e | b | abcdef,abcdef | 588.8m | 36 km/h |
@@ -0,0 +1,93 @@
@routing @continue_straight @via @testbot
Feature: U-turns at via points
Background:
Given the profile "testbot"
Given a grid size of 100 meters
Scenario: Continue straight at waypoints enabled by default
Given the node map
| a | b | c | d |
| | e | f | g |
And the ways
| nodes |
| ab |
| bc |
| cd |
| be |
| dg |
| ef |
| fg |
When I route I should get
| waypoints | route |
| a,e,c | ab,be,be,ef,fg,dg,cd,cd |
Scenario: Query parameter to disallow changing direction at all waypoints
Given the node map
| a | b | c | d |
| | e | f | g |
And the query options
| continue_straight | false |
And the ways
| nodes |
| ab |
| bc |
| cd |
| be |
| dg |
| ef |
| fg |
When I route I should get
| waypoints | route |
| a,e,c | ab,be,be,be,bc,bc |
Scenario: Instructions at waypoints at u-turns
Given the node map
| a | b | c | d |
| | e | f | g |
And the query options
| continue_straight | false |
And the ways
| nodes |
| ab |
| bc |
| cd |
| be |
| dg |
| ef |
| fg |
When I route I should get
| waypoints | route |
| a,e,c | ab,be,be,be,bc,bc |
Scenario: u-turn mixed with non-uturn vias
Given the node map
| a | 1 | b | 3 | c | 5 | d |
| | | 2 | | | | 4 |
| | | e | | f | | g |
And the query options
| continue_straight | false |
And the ways
| nodes | oneway |
| ab | no |
| bc | no |
| cd | no |
| be | yes |
| dg | no |
| ef | no |
| fg | no |
When I route I should get
| waypoints | route |
| 1,2,3,4,5 | ab,be,be,be,ef,fg,dg,cd,bc,bc,bc,cd,dg,dg,dg,cd,cd |
+24
View File
@@ -104,3 +104,27 @@ Feature: Basic Map Matching
| trace | matchings |
| dcba | hg,gf,fe |
| efgh | ab,bc,cd |
Scenario: Testbot - Duration details
Given the query options
| annotations | true |
Given the node map
| a | b | c | d | e | | g | h |
| | | i | | | | | |
And the ways
| nodes | oneway |
| abcdegh | no |
| ci | no |
When I match I should get
| trace | matchings | annotation |
| abeh | abcedgh | 1:9.897633,0:0,1:10.008842,1:10.008842,1:10.008842,0:0,2:20.017685,1:10.008842 |
| abci | abc,ci | 1:9.897633,0:0,1:10.008842,0:0.111209,1:10.010367 |
# The following is the same as the above, but separated for readability (line length)
When I match I should get
| trace | matchings | OSM IDs |
| abeh | abcedgh | 1,2,3,2,3,4,5,4,5,6,7 |
| abci | abc,ci | 1,2,3,2,3,8,3,8 |
+7 -13
View File
@@ -11,8 +11,8 @@ Feature: Testbot - Travel mode
Background:
Given the profile "testbot"
Given a grid size of 200 meters
@mokob @2166
Scenario: Testbot - Always announce mode change
Given the node map
| a | b | c | d |
@@ -28,7 +28,6 @@ Feature: Testbot - Travel mode
| a | d | foo,foo,foo,foo | driving,river downstream,driving,driving |
| b | d | foo,foo,foo | river downstream,driving,driving |
@mokob @2166
Scenario: Testbot - Compressed Modes
Given the node map
| a | b | c | d | e | f | g |
@@ -44,7 +43,6 @@ Feature: Testbot - Travel mode
| a | g | road,liquid,solid,solid | driving,river downstream,driving,driving |
| c | g | liquid,solid,solid | river downstream,driving,driving |
@mokob @2166
Scenario: Testbot - Modes in each direction, different forward/backward speeds
Given the node map
| | 0 | 1 | |
@@ -75,11 +73,11 @@ Feature: Testbot - Travel mode
| ab | steps |
When I route I should get
| from | to | route | modes | time |
| 0 | 1 | ab,ab | steps down,steps down | 60s +-1 |
| 1 | 0 | ab,ab | steps up,steps up | 60s +-1 |
| from | to | route | modes | time |
| 0 | 1 | ab,ab | steps down,steps down | 120s +-1 |
| 1 | 0 | ab,ab | steps up,steps up | 120s +-1 |
@oneway @mokob @2166
@oneway
Scenario: Testbot - Modes for oneway, different forward/backward speeds
Given the node map
| a | b |
@@ -107,7 +105,7 @@ Feature: Testbot - Travel mode
| a | b | ab,ab | steps down,steps down |
| b | a | | |
@oneway @mokob @2166
@oneway
Scenario: Testbot - Modes for reverse oneway, different forward/backward speeds
Given the node map
| a | b |
@@ -135,7 +133,7 @@ Feature: Testbot - Travel mode
| a | b | | |
| b | a | ab,ab | steps up,steps up |
@via @mokob @2166
@via
Scenario: Testbot - Mode should be set at via points
Given the node map
| a | 1 | b |
@@ -149,7 +147,6 @@ Feature: Testbot - Travel mode
| a,1,b | ab,ab,ab,ab | river downstream,river downstream,river downstream,river downstream |
| b,1,a | ab,ab,ab,ab | river upstream,river upstream,river upstream,river upstream |
@mokob @2166
Scenario: Testbot - Starting at a tricky node
Given the node map
| | a | | | |
@@ -164,7 +161,6 @@ Feature: Testbot - Travel mode
| from | to | route | modes |
| b | a | ab,ab | river upstream,river upstream |
@mokob @2166
Scenario: Testbot - Mode changes on straight way without name change
Given the node map
| a | 1 | b | 2 | c |
@@ -204,7 +200,6 @@ Feature: Testbot - Travel mode
| b | d | bc,cd,cd | route,driving,driving |
| a | f | ab,bc,cd,de,ef,ef | driving,route,driving,driving,driving,driving |
@mokob @2166
Scenario: Testbot - Modes, triangle map
Given the node map
| | | | | | | d |
@@ -239,7 +234,6 @@ Feature: Testbot - Travel mode
| a | d | abc,cd,cd | driving,driving,driving |
| d | a | de,ce,abc,abc | driving,river upstream,driving,driving |
@mokob @2166
Scenario: Testbot - River in the middle
Given the node map
| a | b | c | | |
+6 -6
View File
@@ -24,12 +24,12 @@ Feature: Projection to nearest point on road
Scenario: Projection onto way at high latitudes, 1km distance
When I route I should get
| from | to | route | bearing | distance |
| b | a | abc,abc | 225,0 +-1 | 1000m +- 7 |
| b | c | abc,abc | 45,0 +-1 | 1000m +- 7 |
| a | d | abc,abc | 45,0 +-1 | 1000m +- 7 |
| d | a | abc,abc | 225,0 +-1 | 1000m +- 7 |
| c | d | abc,abc | 225,0 +-1 | 1000m +- 8 |
| d | c | abc,abc | 45 +-1 | 1000m +- 8 |
| b | a | abc,abc | 0->225,225->0 | 1000m +- 7 |
| b | c | abc,abc | 0->45,45->0 | 1000m +- 7 |
| a | d | abc,abc | 0->45,45->0 | 1000m +- 7 |
| d | a | abc,abc | 0->225,225->0 | 1000m +- 7 |
| c | d | abc,abc | 0->225,224->0 | 1000m +- 8 |
| d | c | abc,abc | 0->44,45->0 | 1000m +- 8 |
Scenario: Projection onto way at high latitudes, no distance
When I route I should get
+9 -9
View File
@@ -55,13 +55,13 @@ Feature: Status messages
| ? | 400 | URL string malformed close to position 1: "/?" |
| route/v1/driving | 400 | URL string malformed close to position 17: "ing" |
| route/v1/driving/ | 400 | URL string malformed close to position 18: "ng/" |
| route/v1/driving/1 | 400 | Query string malformed close to position 1 |
| route/v1/driving/1 | 400 | Query string malformed close to position 19 |
| route/v1/driving/1,1 | 400 | Number of coordinates needs to be at least two. |
| route/v1/driving/1,1,1 | 400 | Query string malformed close to position 3 |
| route/v1/driving/x | 400 | Query string malformed close to position 0 |
| route/v1/driving/x,y | 400 | Query string malformed close to position 0 |
| route/v1/driving/1,1; | 400 | Query string malformed close to position 3 |
| route/v1/driving/1,1;1 | 400 | Query string malformed close to position 5 |
| route/v1/driving/1,1;1,1,1 | 400 | Query string malformed close to position 7 |
| route/v1/driving/1,1;x | 400 | Query string malformed close to position 3 |
| route/v1/driving/1,1;x,y | 400 | Query string malformed close to position 3 |
| route/v1/driving/1,1,1 | 400 | Query string malformed close to position 21 |
| route/v1/driving/x | 400 | Query string malformed close to position 18 |
| route/v1/driving/x,y | 400 | Query string malformed close to position 18 |
| route/v1/driving/1,1; | 400 | Query string malformed close to position 21 |
| route/v1/driving/1,1;1 | 400 | Query string malformed close to position 23 |
| route/v1/driving/1,1;1,1,1 | 400 | Query string malformed close to position 25 |
| route/v1/driving/1,1;x | 400 | Query string malformed close to position 21 |
| route/v1/driving/1,1;x,y | 400 | Query string malformed close to position 21 |
+79
View File
@@ -0,0 +1,79 @@
@routing @basic @testbot
Feature: Basic Routing
Background:
Given the profile "testbot"
Given a grid size of 200 meters
@smallest
Scenario: Checking
Given the node map
| a | b | 1 | c | d | e |
And the ways
| nodes |
| ab |
| bc |
| cd |
| de |
When I route I should get
| from | to | route | summary |
| a | e | ab,bc,cd,de,de | ab, bc |
| e | a | de,cd,bc,ab,ab | de, bc |
| a | b | ab,ab | ab |
| b | d | bc,cd,cd | bc, cd |
| 1 | c | bc,bc | bc |
@smallest
Scenario: Check handling empty values
Given the node map
| a | b | | c | | d | f |
| | | | | | e |
And the ways
| nodes | name |
| ab | ab |
| bc | bc |
| cd | |
| de | de |
| df | df |
When I route I should get
| from | to | route | summary |
| e | a | de,,bc,ab,ab | de, bc |
@smallest @todo
Scenario: Summaries when routing on a simple network
Given the node map
| a | b |
And the ways
| nodes |
| ab |
When I route I should get
| from | to | route | summary |
| a | b | ab,ab | ab |
| b | a | ab,ab | ab |
@repeated
Scenario: Check handling empty values
Given the node map
| f | | | x | | |
| b | c | d | e | 1 | g |
| a | | | y | | |
And the ways
| nodes | name | # |
| ab | first | |
| bc | first | |
| cd | first | |
| deg | second | |
| bf | third | |
| xey | cross |we need this because phantom node segments are not considered for the summary |
When I route I should get
| from | to | route | summary |
| a | 1 | first,first,second,second | first, second |
@@ -0,0 +1,37 @@
@routing @speed @traffic
Feature: Traffic - turn penalties applied to turn onto which a phantom node snaps
Background: Simple map with phantom nodes
Given the node map
| | 1 | | 2 | | 3 | |
| a:1 | | b:2 | | c:3 | | d:4 |
| | | | | | | |
| | | e:5 | | f:6 | | g:7 |
And the ways
| nodes | highway |
| ab | primary |
| bc | primary |
| cd | primary |
| be | primary |
| cf | primary |
| dg | primary |
And the profile "testbot"
# Since testbot doesn't have turn penalties, a penalty from file of 0 should produce a neutral effect
And the extract extra arguments "--generate-edge-lookup"
Scenario: Weighting based on turn penalty file, with an extreme negative value -- clamps and does not fail
Given the turn penalty file
"""
1,2,5,0
3,4,7,-20
"""
And the contract extra arguments "--turn-penalty-file penalties.csv"
When I route I should get
| from | to | route | speed | time |
| a | e | ab,be,be | 36 km/h | 40s +-1 |
| 1 | e | ab,be,be | 36 km/h | 30s +-1 |
| b | f | bc,cf,cf | 36 km/h | 40s +-1 |
| 2 | f | bc,cf,cf | 36 km/h | 30s +-1 |
| c | g | cd,dg,dg | 71 km/h | 20s +-1 |
| 3 | g | cd,dg,dg | 54 km/h | 20s +-1 |
+41 -1
View File
@@ -46,7 +46,6 @@ Feature: Via points
| a,d,c | abc,bd,bd,bd,abc,abc |
| c,d,a | abc,bd,bd,bd,abc,abc |
@mokob
Scenario: Multiple via points
Given the node map
| a | | | | e | f | g | |
@@ -149,6 +148,47 @@ Feature: Via points
| a,d,c | abc,bd,bd,bd,abc,abc |
| c,d,a | abc,bd,bd,bd,abc,abc |
# See issue #2349
Scenario: Via point at a dead end with oneway
Given the node map
| a | b | c |
| | d | |
| | e | |
And the ways
| nodes | oneway |
| abc | no |
| bd | no |
| ed | yes |
When I route I should get
| waypoints | route |
| a,d,c | abc,bd,bd,bd,abc,abc |
| c,d,a | abc,bd,bd,bd,abc,abc |
# See issue #2349
@bug
Scenario: Via point at a dead end with oneway
Given the node map
| a | b | c |
| | d | |
| | e | g |
| | f | |
And the ways
| nodes | oneway |
| abc | no |
| bd | no |
| ed | yes |
| dg | yes |
| ef | no |
| fg | yes |
When I route I should get
| waypoints | route |
| a,d,c | abc,bd,bd,bd,abc,abc |
| c,d,a | abc,bd,bd,bd,abc,abc |
# See issue #1896
Scenario: Via point at a dead end with barrier
Given the profile "car"
+3 -2
View File
@@ -32,11 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "contractor/query_edge.hpp"
#include "extractor/edge_based_edge.hpp"
#include "extractor/edge_based_node.hpp"
#include "util/typedefs.hpp"
#include "util/deallocating_vector.hpp"
#include "util/typedefs.hpp"
#include <vector>
#include <string>
#include <vector>
#include <cstddef>
@@ -84,6 +84,7 @@ class Contractor
const std::string &edge_segment_lookup_path,
const std::string &edge_penalty_path,
const std::vector<std::string> &segment_speed_path,
const std::vector<std::string> &turn_penalty_path,
const std::string &nodes_filename,
const std::string &geometry_filename,
const std::string &datasource_names_filename,
+1
View File
@@ -81,6 +81,7 @@ struct ContractorConfig
double core_factor;
std::vector<std::string> segment_speed_lookup_paths;
std::vector<std::string> turn_penalty_lookup_paths;
std::string datasource_indexes_path;
std::string datasource_names_path;
};
+8 -8
View File
@@ -17,9 +17,9 @@ namespace contractor
class IteratorbasedCRC32
{
public:
bool using_hardware() const { return use_hardware_implementation; }
bool UsingHardware() const { return use_hardware_implementation; }
IteratorbasedCRC32() : crc(0) { use_hardware_implementation = detect_hardware_support(); }
IteratorbasedCRC32() : crc(0) { use_hardware_implementation = DetectHardwareSupport(); }
template <class Iterator> unsigned operator()(Iterator iter, const Iterator end)
{
@@ -31,11 +31,11 @@ class IteratorbasedCRC32
if (use_hardware_implementation)
{
crc = compute_in_hardware(data, sizeof(value_type));
crc = ComputeInHardware(data, sizeof(value_type));
}
else
{
crc = compute_in_software(data, sizeof(value_type));
crc = ComputeInSoftware(data, sizeof(value_type));
}
++iter;
}
@@ -43,7 +43,7 @@ class IteratorbasedCRC32
}
private:
bool detect_hardware_support() const
bool DetectHardwareSupport() const
{
static const int sse42_bit = 0x00100000;
const unsigned ecx = cpuid();
@@ -51,14 +51,14 @@ class IteratorbasedCRC32
return sse42_found;
}
unsigned compute_in_software(const char *str, unsigned len)
unsigned ComputeInSoftware(const char *str, unsigned len)
{
crc_processor.process_bytes(str, len);
return crc_processor.checksum();
}
// adapted from http://byteworm.com/2010/10/13/crc32/
unsigned compute_in_hardware(const char *str, unsigned len)
unsigned ComputeInHardware(const char *str, unsigned len)
{
#if defined(__x86_64__)
unsigned q = len / sizeof(unsigned);
@@ -114,7 +114,7 @@ struct RangebasedCRC32
return crc32(std::begin(iterable), std::end(iterable));
}
bool using_hardware() const { return crc32.using_hardware(); }
bool UsingHardware() const { return crc32.UsingHardware(); }
private:
IteratorbasedCRC32 crc32;
+103 -84
View File
@@ -1,17 +1,17 @@
#ifndef GRAPH_CONTRACTOR_HPP
#define GRAPH_CONTRACTOR_HPP
#include "contractor/query_edge.hpp"
#include "util/binary_heap.hpp"
#include "util/deallocating_vector.hpp"
#include "util/dynamic_graph.hpp"
#include "util/percent.hpp"
#include "contractor/query_edge.hpp"
#include "util/xor_fast_hash.hpp"
#include "util/xor_fast_hash_storage.hpp"
#include "util/integer_range.hpp"
#include "util/percent.hpp"
#include "util/simple_logger.hpp"
#include "util/timing_util.hpp"
#include "util/typedefs.hpp"
#include "util/xor_fast_hash.hpp"
#include "util/xor_fast_hash_storage.hpp"
#include <boost/assert.hpp>
@@ -115,7 +115,7 @@ class GraphContractor
{
explicit ThreadDataContainer(int number_of_nodes) : number_of_nodes(number_of_nodes) {}
inline ContractorThreadData *getThreadData()
inline ContractorThreadData *GetThreadData()
{
bool exists = false;
auto &ref = data.local(exists);
@@ -165,14 +165,22 @@ class GraphContractor
<< static_cast<unsigned int>(diter->target);
}
#endif
edges.emplace_back(diter->source, diter->target,
static_cast<unsigned int>(std::max(diter->weight, 1)), 1,
diter->edge_id, false, diter->forward ? true : false,
edges.emplace_back(diter->source,
diter->target,
static_cast<unsigned int>(std::max(diter->weight, 1)),
1,
diter->edge_id,
false,
diter->forward ? true : false,
diter->backward ? true : false);
edges.emplace_back(diter->target, diter->source,
static_cast<unsigned int>(std::max(diter->weight, 1)), 1,
diter->edge_id, false, diter->backward ? true : false,
edges.emplace_back(diter->target,
diter->source,
static_cast<unsigned int>(std::max(diter->weight, 1)),
1,
diter->edge_id,
false,
diter->backward ? true : false,
diter->forward ? true : false);
}
// clear input vector
@@ -276,8 +284,7 @@ class GraphContractor
std::vector<RemainingNodeData> remaining_nodes(number_of_nodes);
// initialize priorities in parallel
tbb::parallel_for(tbb::blocked_range<int>(0, number_of_nodes, InitGrainSize),
[this, &remaining_nodes](const tbb::blocked_range<int> &range)
{
[this, &remaining_nodes](const tbb::blocked_range<int> &range) {
for (int x = range.begin(), end = range.end(); x != end; ++x)
{
remaining_nodes[x].id = x;
@@ -299,10 +306,9 @@ class GraphContractor
std::cout << "initializing elimination PQ ..." << std::flush;
tbb::parallel_for(tbb::blocked_range<int>(0, number_of_nodes, PQGrainSize),
[this, &node_priorities, &node_depth,
&thread_data_list](const tbb::blocked_range<int> &range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
[this, &node_priorities, &node_depth, &thread_data_list](
const tbb::blocked_range<int> &range) {
ContractorThreadData *data = thread_data_list.GetThreadData();
for (int x = range.begin(), end = range.end(); x != end; ++x)
{
node_priorities[x] =
@@ -342,7 +348,8 @@ class GraphContractor
// remaining graph
std::vector<NodeID> new_node_id_from_orig_id_map(number_of_nodes, SPECIAL_NODEID);
for (const auto new_node_id : util::irange<std::size_t>(0UL, remaining_nodes.size()))
for (const auto new_node_id :
util::irange<std::size_t>(0UL, remaining_nodes.size()))
{
auto &node = remaining_nodes[new_node_id];
BOOST_ASSERT(node_priorities.size() > node.id);
@@ -352,7 +359,8 @@ class GraphContractor
}
// build forward and backward renumbering map and remap ids in remaining_nodes
for (const auto new_node_id : util::irange<std::size_t>(0UL, remaining_nodes.size()))
for (const auto new_node_id :
util::irange<std::size_t>(0UL, remaining_nodes.size()))
{
auto &node = remaining_nodes[new_node_id];
// create renumbering maps in both directions
@@ -378,7 +386,8 @@ class GraphContractor
// node is not yet contracted.
// add (renumbered) outgoing edges to new util::DynamicGraph.
ContractorEdge new_edge = {new_node_id_from_orig_id_map[source],
new_node_id_from_orig_id_map[target], data};
new_node_id_from_orig_id_map[target],
data};
new_edge.data.is_original_via_node_ID = true;
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_node_id_from_orig_id_map[source],
@@ -421,10 +430,9 @@ class GraphContractor
tbb::parallel_for(
tbb::blocked_range<std::size_t>(0, remaining_nodes.size(), IndependentGrainSize),
[this, &node_priorities, &remaining_nodes,
&thread_data_list](const tbb::blocked_range<std::size_t> &range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
[this, &node_priorities, &remaining_nodes, &thread_data_list](
const tbb::blocked_range<std::size_t> &range) {
ContractorThreadData *data = thread_data_list.GetThreadData();
// determine independent node set
for (auto i = range.begin(), end = range.end(); i != end; ++i)
{
@@ -436,8 +444,7 @@ class GraphContractor
// sort all remaining nodes to the beginning of the sequence
const auto begin_independent_nodes = stable_partition(
remaining_nodes.begin(), remaining_nodes.end(), [](RemainingNodeData node_data)
{
remaining_nodes.begin(), remaining_nodes.end(), [](RemainingNodeData node_data) {
return !node_data.is_independent;
});
auto begin_independent_nodes_idx =
@@ -448,11 +455,10 @@ class GraphContractor
{
// write out contraction level
tbb::parallel_for(
tbb::blocked_range<std::size_t>(begin_independent_nodes_idx,
end_independent_nodes_idx, ContractGrainSize),
[this, remaining_nodes, flushed_contractor,
current_level](const tbb::blocked_range<std::size_t> &range)
{
tbb::blocked_range<std::size_t>(
begin_independent_nodes_idx, end_independent_nodes_idx, ContractGrainSize),
[this, remaining_nodes, flushed_contractor, current_level](
const tbb::blocked_range<std::size_t> &range) {
if (flushed_contractor)
{
for (int position = range.begin(), end = range.end(); position != end;
@@ -475,27 +481,25 @@ class GraphContractor
}
// contract independent nodes
tbb::parallel_for(tbb::blocked_range<std::size_t>(begin_independent_nodes_idx,
end_independent_nodes_idx,
ContractGrainSize),
[this, &remaining_nodes,
&thread_data_list](const tbb::blocked_range<std::size_t> &range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
for (int position = range.begin(), end = range.end();
position != end; ++position)
{
const NodeID x = remaining_nodes[position].id;
this->ContractNode<false>(data, x);
}
});
tbb::parallel_for(
tbb::blocked_range<std::size_t>(
begin_independent_nodes_idx, end_independent_nodes_idx, ContractGrainSize),
[this, &remaining_nodes, &thread_data_list](
const tbb::blocked_range<std::size_t> &range) {
ContractorThreadData *data = thread_data_list.GetThreadData();
for (int position = range.begin(), end = range.end(); position != end;
++position)
{
const NodeID x = remaining_nodes[position].id;
this->ContractNode<false>(data, x);
}
});
tbb::parallel_for(
tbb::blocked_range<int>(begin_independent_nodes_idx, end_independent_nodes_idx,
DeleteGrainSize),
[this, &remaining_nodes, &thread_data_list](const tbb::blocked_range<int> &range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
tbb::blocked_range<int>(
begin_independent_nodes_idx, end_independent_nodes_idx, DeleteGrainSize),
[this, &remaining_nodes, &thread_data_list](const tbb::blocked_range<int> &range) {
ContractorThreadData *data = thread_data_list.GetThreadData();
for (int position = range.begin(), end = range.end(); position != end;
++position)
{
@@ -507,8 +511,7 @@ class GraphContractor
// make sure we really sort each block
tbb::parallel_for(
thread_data_list.data.range(),
[&](const ThreadDataContainer::EnumerableThreadData::range_type &range)
{
[&](const ThreadDataContainer::EnumerableThreadData::range_type &range) {
for (auto &data : range)
tbb::parallel_sort(data->inserted_edges.begin(),
data->inserted_edges.end());
@@ -542,12 +545,12 @@ class GraphContractor
if (!use_cached_node_priorities)
{
tbb::parallel_for(
tbb::blocked_range<int>(begin_independent_nodes_idx, end_independent_nodes_idx,
tbb::blocked_range<int>(begin_independent_nodes_idx,
end_independent_nodes_idx,
NeighboursGrainSize),
[this, &node_priorities, &remaining_nodes, &node_depth,
&thread_data_list](const tbb::blocked_range<int> &range)
{
ContractorThreadData *data = thread_data_list.getThreadData();
[this, &node_priorities, &remaining_nodes, &node_depth, &thread_data_list](
const tbb::blocked_range<int> &range) {
ContractorThreadData *data = thread_data_list.GetThreadData();
for (int position = range.begin(), end = range.end(); position != end;
++position)
{
@@ -561,7 +564,7 @@ class GraphContractor
number_of_contracted_nodes += end_independent_nodes_idx - begin_independent_nodes_idx;
remaining_nodes.resize(begin_independent_nodes_idx);
p.printStatus(number_of_contracted_nodes);
p.PrintStatus(number_of_contracted_nodes);
++current_level;
}
@@ -570,8 +573,7 @@ class GraphContractor
if (orig_node_id_from_new_node_id_map.size() > 0)
{
tbb::parallel_for(tbb::blocked_range<int>(0, remaining_nodes.size(), InitGrainSize),
[this, &remaining_nodes](const tbb::blocked_range<int> &range)
{
[this, &remaining_nodes](const tbb::blocked_range<int> &range) {
for (int x = range.begin(), end = range.end(); x != end; ++x)
{
const auto orig_id = remaining_nodes[x].id;
@@ -583,8 +585,7 @@ class GraphContractor
else
{
tbb::parallel_for(tbb::blocked_range<int>(0, remaining_nodes.size(), InitGrainSize),
[this, &remaining_nodes](const tbb::blocked_range<int> &range)
{
[this, &remaining_nodes](const tbb::blocked_range<int> &range) {
for (int x = range.begin(), end = range.end(); x != end; ++x)
{
const auto orig_id = remaining_nodes[x].id;
@@ -627,7 +628,7 @@ class GraphContractor
Edge new_edge;
for (const auto node : util::irange(0u, number_of_nodes))
{
p.printStatus(node);
p.PrintStatus(node);
for (auto edge : contractor_graph->GetAdjacentEdgeRange(node))
{
const NodeID target = contractor_graph->GetTarget(edge);
@@ -710,9 +711,9 @@ class GraphContractor
inline void Dijkstra(const int max_distance,
const unsigned number_of_targets,
const int maxNodes,
const int max_nodes,
ContractorThreadData &data,
const NodeID middleNode)
const NodeID middle_node)
{
ContractorHeap &heap = data.heap;
@@ -723,7 +724,7 @@ class GraphContractor
{
const NodeID node = heap.DeleteMin();
const auto distance = heap.GetKey(node);
if (++nodes > maxNodes)
if (++nodes > max_nodes)
{
return;
}
@@ -742,7 +743,7 @@ class GraphContractor
}
}
RelaxNode(node, middleNode, distance, heap);
RelaxNode(node, middle_node, distance, heap);
}
}
@@ -843,15 +844,25 @@ class GraphContractor
// guarantees that source is not connected to another node that is
// contracted
node_weights[source] = path_distance; // make sure to prune better
inserted_edges.emplace_back(
source, target, path_distance,
out_data.originalEdges + in_data.originalEdges, node, SHORTCUT_ARC,
FORWARD_DIRECTION_ENABLED, REVERSE_DIRECTION_DISABLED);
inserted_edges.emplace_back(source,
target,
path_distance,
out_data.originalEdges +
in_data.originalEdges,
node,
SHORTCUT_ARC,
FORWARD_DIRECTION_ENABLED,
REVERSE_DIRECTION_DISABLED);
inserted_edges.emplace_back(
target, source, path_distance,
out_data.originalEdges + in_data.originalEdges, node, SHORTCUT_ARC,
FORWARD_DIRECTION_DISABLED, REVERSE_DIRECTION_ENABLED);
inserted_edges.emplace_back(target,
source,
path_distance,
out_data.originalEdges +
in_data.originalEdges,
node,
SHORTCUT_ARC,
FORWARD_DIRECTION_DISABLED,
REVERSE_DIRECTION_ENABLED);
}
}
continue;
@@ -867,8 +878,8 @@ class GraphContractor
if (RUNSIMULATION)
{
const int constexpr SIMULATION_SEARCH_SPACE_SIZE = 1000;
Dijkstra(max_distance, number_of_targets, SIMULATION_SEARCH_SPACE_SIZE, *data,
node);
Dijkstra(
max_distance, number_of_targets, SIMULATION_SEARCH_SPACE_SIZE, *data, node);
}
else
{
@@ -898,14 +909,22 @@ class GraphContractor
}
else
{
inserted_edges.emplace_back(source, target, path_distance,
inserted_edges.emplace_back(source,
target,
path_distance,
out_data.originalEdges + in_data.originalEdges,
node, SHORTCUT_ARC, FORWARD_DIRECTION_ENABLED,
node,
SHORTCUT_ARC,
FORWARD_DIRECTION_ENABLED,
REVERSE_DIRECTION_DISABLED);
inserted_edges.emplace_back(target, source, path_distance,
inserted_edges.emplace_back(target,
source,
path_distance,
out_data.originalEdges + in_data.originalEdges,
node, SHORTCUT_ARC, FORWARD_DIRECTION_DISABLED,
node,
SHORTCUT_ARC,
FORWARD_DIRECTION_DISABLED,
REVERSE_DIRECTION_ENABLED);
}
}
@@ -1032,7 +1051,7 @@ class GraphContractor
}
// tie breaking
if (std::abs(priority - target_priority) < std::numeric_limits<float>::epsilon() &&
bias(node, target))
Bias(node, target))
{
return false;
}
@@ -1061,7 +1080,7 @@ class GraphContractor
}
// tie breaking
if (std::abs(priority - target_priority) < std::numeric_limits<float>::epsilon() &&
bias(node, target))
Bias(node, target))
{
return false;
}
@@ -1071,7 +1090,7 @@ class GraphContractor
}
// This bias function takes up 22 assembly instructions in total on X86
inline bool bias(const NodeID a, const NodeID b) const
inline bool Bias(const NodeID a, const NodeID b) const
{
const unsigned short hasha = fast_hash(a);
const unsigned short hashb = fast_hash(b);
+6 -6
View File
@@ -37,11 +37,10 @@ class BaseAPI
waypoints.values[0] = MakeWaypoint(segment_end_coordinates.front().source_phantom);
auto out_iter = std::next(waypoints.values.begin());
boost::range::transform(segment_end_coordinates, out_iter,
[this](const PhantomNodes &phantom_pair)
{
return MakeWaypoint(phantom_pair.target_phantom);
});
boost::range::transform(
segment_end_coordinates, out_iter, [this](const PhantomNodes &phantom_pair) {
return MakeWaypoint(phantom_pair.target_phantom);
});
return waypoints;
}
@@ -49,7 +48,8 @@ class BaseAPI
// protected:
util::json::Object MakeWaypoint(const PhantomNode &phantom) const
{
return json::makeWaypoint(phantom.location, facade.GetNameForID(phantom.name_id),
return json::makeWaypoint(phantom.location,
facade.GetNameForID(phantom.name_id),
Hint{phantom, facade.GetCheckSum()});
}
+5 -5
View File
@@ -28,14 +28,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ENGINE_API_BASE_PARAMETERS_HPP
#define ENGINE_API_BASE_PARAMETERS_HPP
#include "engine/hint.hpp"
#include "engine/bearing.hpp"
#include "engine/hint.hpp"
#include "util/coordinate.hpp"
#include <boost/optional.hpp>
#include <vector>
#include <algorithm>
#include <vector>
namespace osrm
{
@@ -72,9 +72,9 @@ struct BaseParameters
return (hints.empty() || hints.size() == coordinates.size()) &&
(bearings.empty() || bearings.size() == coordinates.size()) &&
(radiuses.empty() || radiuses.size() == coordinates.size()) &&
std::all_of(bearings.begin(), bearings.end(),
[](const boost::optional<Bearing> bearing_and_range)
{
std::all_of(bearings.begin(),
bearings.end(),
[](const boost::optional<Bearing> bearing_and_range) {
if (bearing_and_range)
{
return bearing_and_range->IsValid();
+27 -12
View File
@@ -3,12 +3,12 @@
#include "extractor/guidance/turn_instruction.hpp"
#include "extractor/travel_mode.hpp"
#include "engine/polyline_compressor.hpp"
#include "engine/guidance/leg_geometry.hpp"
#include "engine/guidance/route.hpp"
#include "engine/guidance/route_leg.hpp"
#include "engine/guidance/route_step.hpp"
#include "engine/guidance/step_maneuver.hpp"
#include "engine/guidance/route_leg.hpp"
#include "engine/guidance/route.hpp"
#include "engine/guidance/leg_geometry.hpp"
#include "engine/polyline_compressor.hpp"
#include "util/coordinate.hpp"
#include "util/json_container.hpp"
@@ -33,8 +33,8 @@ namespace json
namespace detail
{
std::string instructionTypeToString(extractor::guidance::TurnType type);
std::string instructionModifierToString(extractor::guidance::DirectionModifier modifier);
std::string instructionTypeToString(extractor::guidance::TurnType::Enum type);
std::string instructionModifierToString(extractor::guidance::DirectionModifier::Enum modifier);
util::json::Array coordinateToLonLat(const util::Coordinate coordinate);
@@ -48,13 +48,27 @@ template <typename ForwardIter> util::json::String makePolyline(ForwardIter begi
}
template <typename ForwardIter>
util::json::Object makeGeoJSONLineString(ForwardIter begin, ForwardIter end)
util::json::Object makeGeoJSONGeometry(ForwardIter begin, ForwardIter end)
{
auto num_coordinates = std::distance(begin, end);
BOOST_ASSERT(num_coordinates != 0);
util::json::Object geojson;
geojson.values["type"] = "LineString";
util::json::Array coordinates;
std::transform(begin, end, std::back_inserter(coordinates.values), &detail::coordinateToLonLat);
geojson.values["coordinates"] = std::move(coordinates);
if (num_coordinates > 1)
{
geojson.values["type"] = "LineString";
util::json::Array coordinates;
coordinates.values.reserve(num_coordinates);
std::transform(
begin, end, std::back_inserter(coordinates.values), &detail::coordinateToLonLat);
geojson.values["coordinates"] = std::move(coordinates);
}
else if (num_coordinates > 0)
{
geojson.values["type"] = "Point";
util::json::Array coordinates;
coordinates.values.push_back(detail::coordinateToLonLat(*begin));
geojson.values["coordinates"] = std::move(coordinates);
}
return geojson;
}
@@ -73,7 +87,8 @@ makeWaypoint(const util::Coordinate location, std::string name, const Hint &hint
util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps);
util::json::Array makeRouteLegs(std::vector<guidance::RouteLeg> legs,
std::vector<util::json::Value> step_geometries);
std::vector<util::json::Value> step_geometries,
std::vector<util::json::Object> annotations);
}
}
} // namespace engine
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef ENGINE_API_MATCH_HPP
#define ENGINE_API_MATCH_HPP
#include "engine/api/route_api.hpp"
#include "engine/api/match_parameters.hpp"
#include "engine/api/route_api.hpp"
#include "engine/datafacade/datafacade_base.hpp"
+1
View File
@@ -52,6 +52,7 @@ struct MatchParameters : public RouteParameters
{
MatchParameters()
: RouteParameters(false,
false,
false,
RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified,
+3 -3
View File
@@ -34,10 +34,10 @@ class NearestAPI final : public BaseAPI
util::json::Array waypoints;
waypoints.values.resize(phantom_nodes.front().size());
std::transform(phantom_nodes.front().begin(), phantom_nodes.front().end(),
std::transform(phantom_nodes.front().begin(),
phantom_nodes.front().end(),
waypoints.values.begin(),
[this](const PhantomNodeWithDistance &phantom_with_distance)
{
[this](const PhantomNodeWithDistance &phantom_with_distance) {
auto waypoint = MakeWaypoint(phantom_with_distance.phantom_node);
waypoint.values["distance"] = phantom_with_distance.distance;
return waypoint;
+74 -16
View File
@@ -42,14 +42,16 @@ class RouteAPI : public BaseAPI
auto number_of_routes = raw_route.has_alternative() ? 2UL : 1UL;
util::json::Array routes;
routes.values.resize(number_of_routes);
routes.values[0] =
MakeRoute(raw_route.segment_end_coordinates, raw_route.unpacked_path_segments,
raw_route.source_traversed_in_reverse, raw_route.target_traversed_in_reverse);
routes.values[0] = MakeRoute(raw_route.segment_end_coordinates,
raw_route.unpacked_path_segments,
raw_route.source_traversed_in_reverse,
raw_route.target_traversed_in_reverse);
if (raw_route.has_alternative())
{
std::vector<std::vector<PathData>> wrapped_leg(1);
wrapped_leg.front() = std::move(raw_route.unpacked_alternative);
routes.values[1] = MakeRoute(raw_route.segment_end_coordinates, wrapped_leg,
routes.values[1] = MakeRoute(raw_route.segment_end_coordinates,
wrapped_leg,
raw_route.alt_source_traversed_in_reverse,
raw_route.alt_target_traversed_in_reverse);
}
@@ -69,7 +71,7 @@ class RouteAPI : public BaseAPI
}
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
return json::makeGeoJSONLineString(begin, end);
return json::makeGeoJSONGeometry(begin, end);
}
util::json::Object MakeRoute(const std::vector<PhantomNodes> &segment_end_coordinates,
@@ -93,14 +95,23 @@ class RouteAPI : public BaseAPI
auto leg_geometry = guidance::assembleGeometry(
BaseAPI::facade, path_data, phantoms.source_phantom, phantoms.target_phantom);
auto leg = guidance::assembleLeg(path_data, leg_geometry, phantoms.source_phantom,
phantoms.target_phantom, reversed_target);
auto leg = guidance::assembleLeg(facade,
path_data,
leg_geometry,
phantoms.source_phantom,
phantoms.target_phantom,
reversed_target,
parameters.steps);
if (parameters.steps)
{
auto steps = guidance::assembleSteps(
BaseAPI::facade, path_data, leg_geometry, phantoms.source_phantom,
phantoms.target_phantom, reversed_source, reversed_target);
auto steps = guidance::assembleSteps(BaseAPI::facade,
path_data,
leg_geometry,
phantoms.source_phantom,
phantoms.target_phantom,
reversed_source,
reversed_target);
/* Perform step-based post-processing.
*
@@ -132,7 +143,10 @@ class RouteAPI : public BaseAPI
guidance::trimShortSegments(steps, leg_geometry);
leg.steps = guidance::postProcess(std::move(steps));
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps), leg_geometry,
leg.steps = guidance::collapseTurns(std::move(leg.steps));
leg.steps = guidance::buildIntersections(std::move(leg.steps));
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps),
leg_geometry,
phantoms.source_phantom,
phantoms.target_phantom);
leg_geometry = guidance::resyncGeometry(std::move(leg_geometry), leg.steps);
@@ -159,8 +173,13 @@ class RouteAPI : public BaseAPI
for (const auto idx : util::irange<std::size_t>(0UL, legs.size()))
{
auto &leg_geometry = leg_geometries[idx];
step_geometries.reserve(step_geometries.size() + legs[idx].steps.size());
std::transform(
legs[idx].steps.begin(), legs[idx].steps.end(), std::back_inserter(step_geometries),
legs[idx].steps.begin(),
legs[idx].steps.end(),
std::back_inserter(step_geometries),
[this, &leg_geometry](const guidance::RouteStep &step) {
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
{
@@ -169,15 +188,54 @@ class RouteAPI : public BaseAPI
leg_geometry.locations.begin() + step.geometry_end));
}
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
return static_cast<util::json::Value>(json::makeGeoJSONLineString(
return static_cast<util::json::Value>(json::makeGeoJSONGeometry(
leg_geometry.locations.begin() + step.geometry_begin,
leg_geometry.locations.begin() + step.geometry_end));
});
}
return json::makeRoute(route,
json::makeRouteLegs(std::move(legs), std::move(step_geometries)),
std::move(json_overview));
std::vector<util::json::Object> annotations;
if (parameters.annotations)
{
for (const auto idx : util::irange<std::size_t>(0UL, leg_geometries.size()))
{
util::json::Array durations;
util::json::Array distances;
util::json::Array nodes;
auto &leg_geometry = leg_geometries[idx];
durations.values.reserve(leg_geometry.annotations.size());
distances.values.reserve(leg_geometry.annotations.size());
nodes.values.reserve(leg_geometry.osm_node_ids.size());
std::for_each(
leg_geometry.annotations.begin(),
leg_geometry.annotations.end(),
[this, &durations, &distances](const guidance::LegGeometry::Annotation &step) {
durations.values.push_back(step.duration);
distances.values.push_back(step.distance);
});
std::for_each(leg_geometry.osm_node_ids.begin(),
leg_geometry.osm_node_ids.end(),
[this, &nodes](const OSMNodeID &node_id) {
nodes.values.push_back(static_cast<std::uint64_t>(node_id));
});
util::json::Object annotation;
annotation.values["distance"] = std::move(distances);
annotation.values["duration"] = std::move(durations);
annotation.values["nodes"] = std::move(nodes);
annotations.push_back(std::move(annotation));
}
}
auto result = json::makeRoute(route,
json::makeRouteLegs(std::move(legs),
std::move(step_geometries),
std::move(annotations)),
std::move(json_overview));
return result;
}
const RouteParameters &parameters;
+4 -1
View File
@@ -72,17 +72,20 @@ struct RouteParameters : public BaseParameters
template <typename... Args>
RouteParameters(const bool steps_,
const bool alternatives_,
const bool annotations_,
const GeometriesType geometries_,
const OverviewType overview_,
const boost::optional<bool> continue_straight_,
Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}
annotations{annotations_}, geometries{geometries_}, overview{overview_},
continue_straight{continue_straight_}
{
}
bool steps = false;
bool alternatives = false;
bool annotations = false;
GeometriesType geometries = GeometriesType::Polyline;
OverviewType overview = OverviewType::Simplified;
boost::optional<bool> continue_straight;
+14 -14
View File
@@ -2,15 +2,15 @@
#define ENGINE_API_TABLE_HPP
#include "engine/api/base_api.hpp"
#include "engine/api/table_parameters.hpp"
#include "engine/api/json_factory.hpp"
#include "engine/api/table_parameters.hpp"
#include "engine/datafacade/datafacade_base.hpp"
#include "engine/guidance/assemble_leg.hpp"
#include "engine/guidance/assemble_route.hpp"
#include "engine/guidance/assemble_geometry.hpp"
#include "engine/guidance/assemble_leg.hpp"
#include "engine/guidance/assemble_overview.hpp"
#include "engine/guidance/assemble_route.hpp"
#include "engine/guidance/assemble_steps.hpp"
#include "engine/internal_route_result.hpp"
@@ -78,11 +78,10 @@ class TableAPI final : public BaseAPI
json_waypoints.values.reserve(phantoms.size());
BOOST_ASSERT(phantoms.size() == parameters.coordinates.size());
boost::range::transform(phantoms, std::back_inserter(json_waypoints.values),
[this](const PhantomNode &phantom)
{
return BaseAPI::MakeWaypoint(phantom);
});
boost::range::transform(
phantoms,
std::back_inserter(json_waypoints.values),
[this](const PhantomNode &phantom) { return BaseAPI::MakeWaypoint(phantom); });
return json_waypoints;
}
@@ -91,9 +90,9 @@ class TableAPI final : public BaseAPI
{
util::json::Array json_waypoints;
json_waypoints.values.reserve(indices.size());
boost::range::transform(indices, std::back_inserter(json_waypoints.values),
[this, phantoms](const std::size_t idx)
{
boost::range::transform(indices,
std::back_inserter(json_waypoints.values),
[this, phantoms](const std::size_t idx) {
BOOST_ASSERT(idx < phantoms.size());
return BaseAPI::MakeWaypoint(phantoms[idx]);
});
@@ -111,9 +110,10 @@ class TableAPI final : public BaseAPI
auto row_begin_iterator = values.begin() + (row * number_of_columns);
auto row_end_iterator = values.begin() + ((row + 1) * number_of_columns);
json_row.values.resize(number_of_columns);
std::transform(row_begin_iterator, row_end_iterator, json_row.values.begin(),
[](const EdgeWeight duration)
{
std::transform(row_begin_iterator,
row_end_iterator,
json_row.values.begin(),
[](const EdgeWeight duration) {
if (duration == INVALID_EDGE_WEIGHT)
{
return util::json::Value(util::json::Null());
+1 -4
View File
@@ -89,10 +89,7 @@ struct TableParameters : public BaseParameters
return false;
// 3/ 0 <= index < len(locations)
const auto not_in_range = [this](const std::size_t x)
{
return x >= coordinates.size();
};
const auto not_in_range = [this](const std::size_t x) { return x >= coordinates.size(); };
if (std::any_of(begin(sources), end(sources), not_in_range))
return false;
+1 -2
View File
@@ -79,8 +79,7 @@ class TripAPI final : public RouteAPI
std::vector<TripIndex> input_idx_to_trip_idx(parameters.coordinates.size());
for (auto sub_trip_index : util::irange<unsigned>(0u, sub_trips.size()))
{
for (auto point_index :
util::irange<unsigned>(0u, sub_trips[sub_trip_index].size()))
for (auto point_index : util::irange<unsigned>(0u, sub_trips[sub_trip_index].size()))
{
input_idx_to_trip_idx[sub_trips[sub_trip_index][point_index]] =
TripIndex{sub_trip_index, point_index};
+9 -9
View File
@@ -1,20 +1,23 @@
#ifndef OSRM_BASE64_HPP
#define OSRM_BASE64_HPP
#include <string>
#include <vector>
#include <iterator>
#include <string>
#include <type_traits>
#include <vector>
#include <cstddef>
#include <climits>
#include <cstddef>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/range/algorithm/copy.hpp>
namespace osrm
{
// RFC 4648 "The Base16, Base32, and Base64 Data Encodings"
// See: https://tools.ietf.org/html/rfc4648
@@ -36,9 +39,6 @@ using BinaryFromBase64 = boost::archive::iterators::transform_width<
6 // from a sequence of 6 bit
>;
} // ns detail
namespace osrm
{
namespace engine
{

Some files were not shown because too many files have changed in this diff Show More