Compare commits

...

229 Commits

Author SHA1 Message Date
6ab6564d42
fix arch on normal build
Some checks failed
Build and Publish Docker Image / publish (debian) (release) Failing after 21s
Build and Publish Docker Image / publish (alpine) (release) Failing after 3h14m36s
2025-02-15 14:29:51 -05:00
513966056b
remove 2 32bit unsupported arch
Some checks failed
Build and Publish Docker Image / publish (alpine) (release) Failing after 1h38m5s
Build and Publish Docker Image / publish (debian) (release) Failing after 22s
2025-02-15 12:28:08 -05:00
2c91c0c259
update image name
Some checks failed
Build and Publish Docker Image / publish (alpine) (release) Failing after 1m49s
Build and Publish Docker Image / publish (debian) (release) Failing after 21s
2025-02-15 12:21:44 -05:00
Matt Robinson
c59ad69d6a
Correct Docker FromAsCasing warning (#7064) 2025-02-10 19:22:09 +01:00
Alexander Farber
61464fc2bd
Fix no member named 'construct' in 'optional<type-parameter-0-0 &>' error in sol.hpp with Clang 19 (#7098) 2025-01-25 07:09:37 +00:00
Alexander Farber
6f235cca15
Use libtbb-dev/libtbb12 packages in Dockerfile-debian, sort packages alphabetically in both Dockerfiles (#7095)
* - Use libtbb-dev in builder stage and libtbb12 package in the runstage instead of building oneTBB v2021.12.0 from source code
- Remove wget package from builder stage, because it is not used
- Uppercase "FROM ... as" -> "FROM ... AS" to silence a "docker build" warning
- Sort packages alphabetically and put them on separate lines for easier comparison

* - Fix the warning "FromAsCasing: 'as' and 'FROM' keywords' casing do not match"
- Sort packages alphabetically and put them on separate lines for easier comparison

* Revert  -Wno-stringop-overflow

* Update the link to multi staged builds in the comment

* Update alpine:3.20.0 -> alpine:3.20.5
2025-01-12 16:28:56 +00:00
Siarhei Fedartsou
3614af7f64
Use std::string_view for key type in json::Object (#7062) 2024-11-03 18:23:23 +01:00
Siarhei Fedartsou
48e8382785
Remove unused bearing::get function (#7040)
* Remove unused bearing::get function

* Remove unused bearing::get function

* Remove unused bearing::get function

* Remove unused bearing::get function
2024-10-20 19:46:49 +02:00
Frédéric Rodrigo
becfd8a56d
Add optional support of cargo bike exclusion and width to bicyle profile (#7044) 2024-10-01 15:19:44 +03:00
Siarhei Fedartsou
4f1c62a768
Bump version of protozero to 1.7.1 (#6999) 2024-09-28 20:35:20 +02:00
Siarhei Fedartsou
09a716a9e5
Bump osmium to version 2.20.0 (#6997) 2024-09-28 20:35:05 +02:00
Siarhei Fedartsou
676f6d4704
Use std::popcount instead of __builtin_popcount (#7026) 2024-09-28 20:34:39 +02:00
Siarhei Fedartsou
f636dbfd44
Use std::countl_zero instead of __builtin_clzll (#7025) 2024-09-28 20:34:23 +02:00
Siarhei Fedartsou
5f67e715af
Add std::vector<...>::reserve in ContiguousInternalMemoryDataFacadeBase::GetOverridesThatStartAt (#7024) 2024-09-28 20:33:33 +02:00
Siarhei Fedartsou
203314b1aa
Remove unused middle_nodes_table vector (#7012) 2024-08-03 22:32:37 +02:00
Siarhei Fedartsou
e5e25a1aca
Configure self-hosted runner for benchmarks job (#6975) 2024-07-26 21:19:47 +02:00
Siarhei Fedartsou
84f12c7c6d
Add NodeJs bindings benchmarks (#7004) 2024-07-26 19:36:43 +02:00
Siarhei Fedartsou
7802f86bd6
Measure peak RAM in benchmarks (#6995) 2024-07-25 21:27:37 +02:00
Siarhei Fedartsou
43afec3b39
Move flatbuffers non-generated files back to include/engine/api/flatbuffers/ (#6996) 2024-07-13 13:43:56 +02:00
Dennis Luxen
2da7ca5338
Route pedestrians over highway=platform (#6993) 2024-07-12 20:12:19 +02:00
Dennis Luxen
8ae9abaa63
Fix parsing on feature files on other gherkin parser (#6992) 2024-07-12 17:35:44 +02:00
Siarhei Fedartsou
d3638ace59
Use thread_local instead of boost::thread_specific_ptr (#6991) 2024-07-11 23:53:22 +02:00
Siarhei Fedartsou
c2f877eb9d
Remove unused MapStorage and GenerationArrayStorage (#6990) 2024-07-11 23:10:14 +02:00
Siarhei Fedartsou
825132eec7
Bump flatbuffers to v24.3.25 version (#6968) 2024-07-10 20:44:36 +02:00
Dennis Luxen
7436835244
Remove corech options, redundant tests (#6989)
* Remove corech options, redundant tests

* Small fix
2024-07-10 16:28:07 +02:00
Siarhei Fedartsou
5e6fdda16b
Add NOTE: label to comment in stale.yml (#6987) 2024-07-09 21:27:46 +02:00
Siarhei Fedartsou
f5598efcff
Add .reserve(...) to assembleGeometry function (#6983) 2024-07-09 20:12:47 +02:00
Siarhei Fedartsou
ab771c6142
Do not trigger stale bot on each PR (#6986) 2024-07-09 19:58:03 +02:00
Siarhei Fedartsou
f1510b758d
Increase number of GitHub operations allowed in stale bot (#6985) 2024-07-09 19:32:03 +02:00
Siarhei Fedartsou
4930d2ef05
Use clang 18/17/16 instead of 15/14/13 (#6978) 2024-07-03 20:02:44 +02:00
Siarhei Fedartsou
57b792c768
Get rid of boost::optional leftovers (#6977) 2024-07-02 22:37:09 +02:00
Siarhei Fedartsou
d0ed29adb7
Use Link Time Optimisation whenever possible (#6967) 2024-06-30 21:07:49 +02:00
Siarhei Fedartsou
bdc6ed8a53
Use struct instead of tuple to define UnpackedPath (#6974) 2024-06-29 21:34:43 +02:00
Siarhei Fedartsou
93c0e1dab3
Micro performance optimisation in map matching (#6976) 2024-06-29 19:59:08 +02:00
Siarhei Fedartsou
cacb1b23f9
Fix calculation of best ops/sec in benchmarks (#6973) 2024-06-29 10:31:23 +02:00
Siarhei Fedartsou
0e17869e21
Re-use priority queue in StaticRTree (#6952) 2024-06-25 18:58:48 +02:00
Siarhei Fedartsou
5a48ce85b3
Use tmpfs for running benchmarks (#6966) 2024-06-25 17:49:41 +02:00
Siarhei Fedartsou
7d72dfebf7
Optimise encodePolyline function (#6940) 2024-06-22 20:04:32 +02:00
Siarhei Fedartsou
3d01d96036
Avoid reallocations in base64 encoding (#6951) 2024-06-22 08:50:18 +02:00
Siarhei Fedartsou
e8da3d9231
Calculate confidence interval for benchmark measurements (#6950) 2024-06-21 21:43:27 +02:00
Siarhei Fedartsou
d9ce9cf780
Get rid of unused Boost dependencies (#6960) 2024-06-21 19:04:34 +02:00
Siarhei Fedartsou
3285ce3b2f
Configure stale bot (#6963) 2024-06-21 08:51:56 +02:00
Dennis Luxen
f1eabc3ecc
Replace boost::filesystem with std (#6432) 2024-06-20 21:44:28 +02:00
knowname
c3f2a6cdb9
Add CI job for building Alpine-based Docker image (#6959) 2024-06-20 09:08:57 +02:00
knowname
97f676d5a3
add alpine dockerfile (#6958) 2024-06-19 14:15:23 +02:00
Siarhei Fedartsou
7ffc08be28
Bump versions of TBB, Expat and Lua installed via Conan (#6957) 2024-06-19 07:46:56 +02:00
Siarhei Fedartsou
feb9389436
Apply micro-optimisation for Table & Trip APIs (#6949) 2024-06-15 18:57:26 +02:00
Siarhei Fedartsou
a0eda3e7d7
Apply micro-optimisation for Route API (#6948) 2024-06-15 18:56:40 +02:00
Siarhei Fedartsou
7652f6ca6b
Apply micro-optimisation for Match API (#6945) 2024-06-14 16:04:19 +02:00
Siarhei Fedartsou
aa4e6b1cf3
Apply micro-optimisation for Nearest API (#6944) 2024-06-13 18:18:36 +02:00
Siarhei Fedartsou
de2f392960
Avoid copy of intersection in totalTurnAngle (#6938) 2024-06-10 22:40:37 +02:00
Siarhei Fedartsou
0188d2bccd
Use std::unordered_map::emplace instead of operator[] when producing JSONs (#6936) 2024-06-10 21:29:31 +02:00
Siarhei Fedartsou
054161fc7e
Avoid copy of vectors in MakeRoute function (#6939) 2024-06-10 20:06:43 +02:00
Siarhei Fedartsou
89435aa87f
Add new randomized benchmarks (#6929) 2024-06-09 17:03:24 +02:00
Siarhei Fedartsou
0cbb23abe1
Fix Windows CI: update conan.cmake and disable unit tests as temporary workaround for OOM issues (#6930) 2024-06-09 09:24:02 +02:00
Siarhei Fedartsou
a2915f78c5
Make e2e benchmarks more stable (#6927) 2024-06-08 22:27:12 +02:00
Siarhei Fedartsou
99cb17aed3
Fix bugprone-unused-return-value clang-tidy warning (#6934) 2024-06-08 14:33:24 +02:00
Siarhei Fedartsou
8fd8d0c24a
Fix performance-noexcept-move-constructor clang-tidy warning (#6933) 2024-06-08 08:33:54 +02:00
Siarhei Fedartsou
c57b0d28b0
Fix performance-noexcept-swap clang-tidy warning (#6931) 2024-06-07 16:18:10 +02:00
Siarhei Fedartsou
523ee762f0
Upgrade to clang-tidy 18 (#6919) 2024-06-06 22:20:38 +02:00
Siarhei Fedartsou
feeed75cf1
Add simple benchmarks for osrm-* tools (#6925) 2024-06-06 21:01:34 +02:00
Siarhei Fedartsou
c7ee1a59eb
Implement end to end benchmark (#6910) 2024-06-05 21:39:10 +02:00
Dennis Luxen
2725202771
Use Lemire's fast check whether to escape a JSON string (#6923) 2024-05-31 19:58:57 +02:00
Siarhei Fedartsou
42fafdcdfe
Use custom struct instead of std::pair in QueryHeap (#6921) 2024-05-31 07:06:58 +02:00
Siarhei Fedartsou
c8de759cd6
Use std::string_view::starts_with instead of boost::starts_with (#6918) 2024-05-30 21:55:25 +02:00
Siarhei Fedartsou
fb9d1cefcc
Get rid of boost::math::constants::* and M_PI in favor of std::numbers (#6916) 2024-05-30 19:40:56 +02:00
Dennis Luxen
a9b1bd88d3
Remove all core-CH left-overs (#6920)
* Remove all core-CH left-overs

* Fix formatting

* Update CHANGELOG.md
2024-05-30 17:13:44 +02:00
Siarhei Fedartsou
1ff096ac5c
Make constants in PackedVector constexpr (#6917) 2024-05-30 15:12:42 +02:00
Dennis Luxen
0ea757ed02
Remove unused header file (#6913) 2024-05-29 09:13:13 +02:00
Dennis Luxen
42cbca0ff0
Move Sol2 to canonical path (#6912) 2024-05-28 21:23:51 +02:00
Siarhei Fedartsou
c1ed73126d
Use std::variant instead of mapbox::util::variant (#6903) 2024-05-28 18:52:49 +02:00
Siarhei Fedartsou
01b1673c8a
Fix CCache usage in GitHub Actions (#6911) 2024-05-28 08:43:23 +02:00
Siarhei Fedartsou
d4dc297f75
Add CI job with GCC 14 (#6905) 2024-05-27 09:31:13 +02:00
Siarhei Fedartsou
9aaab7a53f
Enable readability-container-contains clang-tidy check (#6909) 2024-05-27 08:33:26 +02:00
Siarhei Fedartsou
1a6f4c44e7
Fix performance-type-promotion-in-math-fn clang-tidy warning (#6908) 2024-05-27 08:33:05 +02:00
Siarhei Fedartsou
163a2cfe3c
Bump rapidjson version (#6906) 2024-05-27 08:31:59 +02:00
Siarhei Fedartsou
667fd198ac
Use the latest Debian version in Dockerfile (#6904) 2024-05-27 08:30:44 +02:00
Siarhei Fedartsou
b7a990d0b5
Use C++20 (#6877) 2024-05-25 18:25:13 +02:00
Dennis Luxen
8306ed8ae3
Remove superflous iostreams include from header files (#6901) 2024-05-25 09:17:45 +02:00
Dennis Luxen
640df69aa1
Remove dead CRC32 processor code (#6900) 2024-05-24 22:43:03 +02:00
Siarhei Fedartsou
8b48e2ccc6
Bump mapbox/variant to version 1.2.0 (#6898) 2024-05-24 20:39:45 +02:00
Dennis Luxen
babdced52f
Replace GCC-specific attribute with [[nodiscard]] attribute (#6899) 2024-05-24 20:34:04 +02:00
Siarhei Fedartsou
21607e0cb2
Optimise getNetworkDistance in MLD even more (#6884) 2024-05-23 20:46:13 +02:00
Dennis Luxen
24646aada9
Remove outdated warnings (#6894) 2024-05-23 19:39:00 +02:00
Dennis Luxen
51b74a99aa
Avoid copy of std::function-based callback in path unpacking (#6895)
* Avoid copy of std::function-based callback in path unpacking

* Fix formatting

* Update CHANGELOG.md
2024-05-23 18:51:51 +02:00
Dennis Luxen
ed5003b502
Upgrade CI actions to latest versions (#6893)
* Upgrade actions

* Update remaining actions

* Update CHANGELOG.md

* Update CHANGELOG.md
2024-05-23 14:40:47 +02:00
Dennis Luxen
46dc660801
Replace boost::hash by std::hash (#6892)
* Replace boost::hash by std::hash

* Fix formatting

* Update CHANGELOG.md
2024-05-23 14:35:56 +02:00
Siarhei Fedartsou
73fb53cf36
Add benchmark for route (#6890) 2024-05-23 14:27:43 +02:00
Mugr Rex
efe6840d08
Replace boost::optional with std::optional (#6611) 2024-05-22 14:58:07 +02:00
Siarhei Fedartsou
d259848456
Optimise R-tree queries in the case of map matching (#6881) 2024-05-20 12:32:40 +02:00
Siarhei Fedartsou
8a82d3929c
Improve map matching benchmark (#6885) 2024-05-20 11:15:55 +02:00
Siarhei Fedartsou
89fce286a7
Fix benchmark script for the case if PR has empty description (#6887) 2024-05-20 09:16:53 +02:00
Siarhei Fedartsou
11c7ddc84d
Fix failing gcc-13 based CI jobs (#6886)
* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs
2024-05-19 19:30:24 +02:00
Siarhei Fedartsou
54e50a67a8
Add benchmarks comparison job (#6880) 2024-05-14 17:14:59 +02:00
Bart Louwers
c00c157479
Replace dead link with archive.org link (#6882) 2024-05-14 11:49:49 +02:00
Siarhei Fedartsou
ee8e0f890a
Optimise path distance calculation in MLD map matching (#6876) 2024-05-11 16:30:43 +02:00
Dennis Luxen
1e2ffee97c
Update Makefile: fix typo (#6878) 2024-05-11 09:13:17 +02:00
Michael Bell
ffc39b8ad2
Clarify use of forcing routing steps (#6866)
The change clarifies the conditions for forcing routing steps and
simplifies the codebase to support it.

- Makes explicity  the search runtime condition for forcing a routing
step. Namely, the node is a source of the forward and reverse searches,
and it's one of the pre-identified nodes that requires a step to
be forced.
- Consolidate the two lists of force nodes into one. Not only is there
no algorithmic value in separating the nodes by geometric direction,
the  improvements to via-routes with u-turns mean atleast one of these
lists will be empty for any search.
- Rename 'force loop' to 'force step'. This moves the code away
from the original CH-specific language for checking for self-loops
in the case where this condition is met. MLD does not have loops.

Additional cucumber tests are added to cover the logic related to
negative search weights and forcing routing steps on via-route
paths.
2024-05-10 22:00:24 +01:00
Dennis Luxen
70969186f6
Migrate GCC CI jobs to run on GCC 11, 12, and 13 (#6865) 2024-05-10 20:38:32 +02:00
Dennis Luxen
dff76d31d5
Remove dead code branches (#6875) 2024-05-10 20:21:41 +02:00
Siarhei Fedartsou
3254686933
Use M1 runner to build arm64 macOS builds (#6868) 2024-05-08 21:08:11 +02:00
Siarhei Fedartsou
a6dfff725b
Configure GitHub Actions concurrency (#6870) 2024-05-08 10:06:04 +02:00
Dennis Luxen
10237b8761
Update vendored vtzero dependency to v1.1.0 (#6871) 2024-05-07 22:19:48 +02:00
Dennis Luxen
79de092bb2
Upgrade fmt dependency to v10.2.1 (#6869)
* Put fmt into version agnostic subdir

* Add fmt to dependency update script

* Remove manually added fmt

* Squashed 'third_party/fmt/' content from commit e69e5f977

git-subtree-dir: third_party/fmt
git-subtree-split: e69e5f977d458f2650bb346dadf2ad30c5320281
2024-05-07 20:55:55 +02:00
Dennis Luxen
82aa369db3
Remove dead code modernization script (#6863) 2024-05-06 19:09:10 +02:00
Dennis Luxen
0583582772
Remove include that breaks compilation for Boost v1.85.0 (#6856)
* Remove include that breaks compilation for Boost v1.85.0

* Update CHANGELOG.md

* Fix typo

* Fix issues found by newer clang-tidy version

* Add include to boost filesystem to satisfy Windows compiler
2024-05-06 18:52:40 +02:00
Dennis Luxen
99809e105c
Upgrade clang compiler in CI builds (#6861) 2024-05-06 18:12:17 +02:00
Dennis Luxen
6d361ced41
Set Windows build to quiet (#6862)
The normal flag generates 290 megabytes of log output for a regular build. Setting it to quiet will reduce this and still print errors.
2024-05-06 17:31:58 +02:00
Dennis Luxen
790fa901c7
Remove stale AppVeyor files (#6860)
* Drop left-overs from deprecated AppVeyor CI build

* Update CHANGELOG.md
2024-05-06 13:48:24 +02:00
Dennis Luxen
7f9d591ab7
Upgrade clang-format to version 15 (#6859) 2024-05-06 09:14:46 +02:00
Michael Bell
b503e96a98
Remove force-loop checks for routes with u-turns (#6858)
Each leg of a via-route supporting u-turns does not need to consider
force-loops. Negative weight checks are sufficient to prevent
incorrect results when waypoints are on the same edge.
2024-05-05 21:56:01 +01:00
Dennis Luxen
d691af4860
Remove outdated/deprecated CMake policy (#6854) 2024-05-05 22:08:40 +02:00
Dennis Luxen
befd9dc5ae
Merge pull request #6857 from DennisOSRM/upgrade_js_dependencies
Drop support for NodeJS <= v16
2024-05-05 20:29:16 +02:00
Dennis Luxen
4968d7f9d9 Disable codecov.io upload run since it consistently fails 2024-05-05 16:40:21 +02:00
Dennis Luxen
c26f0612d1 Fix typo 2024-05-05 15:24:56 +02:00
Dennis Luxen
de41299eda Update CHANGELOG.md 2024-05-05 15:03:12 +02:00
Dennis Luxen
c37bbfd07a Migrate GitHub actions from {16, 18} to {28, 20} 2024-05-05 15:01:41 +02:00
Dennis Luxen
0fd1fb2904 Update minimum NodeJS dependency to 18 2024-05-05 14:51:56 +02:00
Matthew Wigginton Bhagat-Conway
7ebd21f39e
pass flags into process_segment (#6658)
* pass flags into process_segment

---------

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-04-06 09:27:42 +01:00
Michael Bell
8ef366e061
Add support for opposite approach request parameter (#6842)
* Added approach on the opposite side of the road.

* Additional test and docs coverage for opposite approach

---------

Co-authored-by: Aleksandrs Saveljevs <Aleksandrs.Saveljevs@gmail.com>
2024-04-03 19:59:15 +01:00
rezashokry
367933fc1a
Fix manuever overrides finding bug (#6739)
* sort manuever overrides vector after partition

---------

Co-authored-by: rshokri <reza.shokri@tapsi.cab>
Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-24 21:48:28 +00:00
Damiaan Twelker
c28ba66039
Increment feature id in tile speed layer (#6726)
* actually increment feature id in tile speed layer

---------

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-24 21:23:36 +00:00
Michael Bell
d0e3e2af23
Extract prerelease/build information from package semver (#6839)
* Extract prerelease/build information from package semver

Currently we only extract the major.minor.patch identifiers from
the semver label stored in package.json.

This leads to version information in executables incorrectly
reporting a release version is running on prereleases and special builds.

This commit is a quickfix to extract this information and report it
in version strings.

CMake regex parsing is not sophisticated enough to handle the full semver
regex, so we might need to explore other CMake modules if we want to
strictly parse the label.
2024-03-24 18:33:07 +00:00
martin
8526cc7d45
Replace deprecated std::is_pod (#6717)
* Replace deprecated std::is_pod
2024-03-17 11:49:55 +00:00
Trivikram Kamat
016440fc7e
Remove unused AWS SDK for JavaScript v2 (#6730) 2024-03-17 11:37:51 +00:00
Monday
6e77d53946
Correctly handle compressed traffic signals (#6724)
Unidirectional traffic signal segments are currently not compressed.
This means traffic signals which are not on turns can be missed and
not applied the correct penalty.

This commit changes this behaviour to correctly handle the graph
compression. Additional tests are added to ensure there is no
regression for other cases (turns, restrictions).

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-17 11:32:10 +00:00
Frédéric Rodrigo
99875b4d24
Set Maxspeed for Philippines (#6776) 2024-03-16 11:35:25 +00:00
Michael Bell
c315a586f7
Delete .github/ISSUE_TEMPLATE/question.md (#6827)
With Discussions now enabled, remove the question issue template to encourage Q&A interaction in the more appropriate place.
2024-03-15 09:35:09 +00:00
Daniel Spasojevic
69c38401bc
Update osrm-backend-docker link to point to github hosted repo (#6831) 2024-03-15 10:29:39 +01:00
Michael Bell
e219eb9442
Pin Conan revisions correctly (#6828)
* Pin Conan revisions correctly

Conan dependencies are not pinned correctly. This means we're
pulling in a newer onetbb recipe that no longer has a shared
library option.

Following other examples of how to pin revisions with cmake
for conan v1, we correctly pin the expected revisions.

Longer term we should look into
- upgrading to conan v2
- defining the conan config separately from cmakelists.txt
- understanding the need for disabling onetbb shared library support

but for the purposes of reviving CI, this will be sufficient.

* Fix macos CI builds
2024-03-15 09:27:59 +00:00
Daniel Patterson
31e31a63d0
Fix some compilation issues on modern macOS systems (#6709)
* Fix various compiler warnings generated by Apple clang 15, and workaround some boost 1.8 bugs

* Fix formatting.
2023-10-12 23:04:39 +02:00
danieldegroot2
b437ce5b33
Update debug_way.lua (#6713) 2023-10-12 23:03:35 +02:00
Frédéric Rodrigo
5723eaaa6a
Added motorway speed limits for Bulgaria (original fix by pl71) (#6698) 2023-09-13 22:01:36 +02:00
Frédéric Rodrigo
0f7b86b099
Install data directory (geojson files) like the profiles directory (#6699) 2023-09-13 22:01:06 +02:00
fenwuyaoji
14dcf91812
add keepalive_timeout flag (#6674)
* add keepalive_timeout flag
2023-08-30 19:06:39 +01:00
Lasse Liehu
d234c7246c
Don't route on proposed ways (#6615) 2023-08-20 10:17:30 +01:00
Whytro
3f9347cfb2
Fix operator overload on RouteParameters (#6646)
* Fix operator overload on RouteParameters
2023-08-19 21:48:15 +01:00
Michael Bell
db7946d762
Add support for disabling feature datasets (#6666)
This change adds support for disabling datasets, such that specific
files are not loaded into memory when running OSRM. This enables users
to not pay the memory cost for features they do not intend to use.

Initially, there are two options:
- ROUTE_GEOMETRY, for disabling overview, steps, annotations and waypoints.
- ROUTE_STEPS, for disabling steps only.

Attempts to query features for which the datasets are disabled will
lead to a DisabledDatasetException being returned.
2023-08-04 18:43:37 +01:00
Michael Bell
522d0f066e
Add 'load directly' mode to default Cucumber test suite (#6664)
Currently `npm test` runs the Cucumber suite with a matrix
configuration for selecting the algorithm (CH, MLD) and data loading
(shared-memory, mmap) options.

However, there is a third data loading option, 'load directly',
which is to directly load the datasets into the osrm-routed process memory.

The code paths for each data loading option are distinct:

Storage::Run + SharedMemoryAllocator
MMapMemoryAllocator
ProcessMemoryAllocator

This commit adds direct data loading as part of the Cucumber
configuration matrix.

This will ensure optional dataset support can be added without any
regressions.
2023-08-01 09:24:51 +01:00
Michael Bell
3bb82ce1e2
Minor fixes (#6655)
* Ensure required file check in osrm-routed is correctly enforced.

The storage module had a stricter check. This keeps the IOConfig
check in sync.

* Correct HTTP docs to reflect summary output dependency on steps parameter.

There is no summary parameter.

* npm audit fix
2023-07-18 20:23:23 +01:00
Debarshi Kundu
62e11fd5db
Corrected README with 'echo' command (#6638) 2023-06-13 10:07:15 +02:00
Brad Smith
503d558e90
Fix building on OpenBSD (#6637)
Only utilize librt if its presence is detected.
2023-06-06 07:04:51 +02:00
Lasse Liehu
af59a9cfae
Fix build with GCC 13 (#6632)
Building with GCC 13 failed because for example std::int32_t
was not found. Porting guide [1] suggested to add explicit includes
for <cstdint> if necessary, so did just that.

[1]: https://gcc.gnu.org/gcc-13/porting_to.html
2023-05-31 07:53:04 +02:00
Whytro
72da455185
Allow -1.0 as unlimited for default_radius value (#6599) 2023-05-31 07:52:35 +02:00
Al
0ca913132a
Added block_counter variable to a preprocessor check, minor bug. (#6596) 2023-04-16 23:22:30 +02:00
Nils
134da91fa8
keep libosrm* (#6602) 2023-04-15 16:27:51 +02:00
Whytro
d51631401e
Add support for a default_bearing_radius flag (#6575) 2023-03-24 16:49:33 +01:00
Matthew Wigginton Bhagat-Conway
d6afe91d8f
print tracebacks and line numbers for Lua runtime errors (#6564)
* print tracebacks and line numbers for Lua runtime errors

* revert format changes

* update changelog with lua traceback, #6564

* revert using protected_function for old GetStringListFromFunction and source_function #6564

* add unit test for line numbers in tracebacks, #6564

* apply clang-format (#6564)

* remove unused test helper function, #6564

* suppress leaksanitizer warnings in extract-tests, #6564

When the extractor encounters a lua runtime error, some osmium objects are not freed. In production this doesn't matter because these errors bring down OSRM. In the tests we catch them to ensure they occur, and the leaksanitizer flags them.
2023-03-23 19:18:58 +01:00
Pratik Rajput
192d077ada
Addressing grammatical nits and fixing typo in testing.md (#6550) 2023-03-15 17:16:51 +01:00
Samuel Brucksch
82b73ed9ab
fix oneway handling in get_forward_backward_by_key (#6569) 2023-03-09 17:48:15 +01:00
Jingchen Ye
0e7c3d8ad4
Move TarjanSCC from extractor to util (#6562) 2023-03-09 17:47:28 +01:00
Pratik Rajput
a63ba91c8f
Fix typo in api.md (#6567)
* Fix typo in api.md

Signed-off-by: Pratik <pratikrajput1199@gmail.com>
Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com>
2023-03-09 17:10:42 +01:00
Patrick Fitzgerald
51e04209e3
Fixing discord link (#6536) 2023-02-10 15:28:34 +01:00
Pratik Rajput
56ed2cb196
Fixed typo in profiles.md (#6538) 2023-02-10 15:28:02 +01:00
zephyr
ebd9ab4548
fix(json_render): json_render is not accurate enough for extremely sm… (#6531) 2023-02-02 18:58:25 +01:00
Siarhei Fedartsou
376282d946
Update README.md (#6529) 2023-01-29 09:56:02 +01:00
Pratik Rajput
53295760ac
Fixed typo and grammatical mistakes in developing.md (#6520) 2023-01-28 00:22:29 +01:00
Jeremiah
e590dae5f6
Fix boost header deprecation warning (#6515) 2023-01-21 08:47:05 +01:00
Samuel Brucksch
d9df33dd0a
fix typo (#6491) 2023-01-11 00:46:42 +01:00
Dennis Luxen
95c4523987
Merge pull request #6480 from Project-OSRM/nested_namespace
Nested namespace
2022-12-21 18:27:13 +01:00
Dennis Luxen
26987f9049 Fix conditionally built tool 2022-12-21 15:52:09 +01:00
Dennis Luxen
7c06726a35 Fix formatting 2022-12-20 18:00:11 +01:00
Dennis Luxen
d7c44f0bc0 Merge remote-tracking branch 'origin/master' into nested_namespace 2022-12-11 10:25:13 +01:00
Dennis Luxen
a4aa153ba4 Use nested namespace
It's a mechanical change to modernize the code base
2022-12-11 10:17:17 +01:00
Dennis Luxen
1204b746d5
Merge pull request #6477 from Project-OSRM/update_cmakelists
Update CMakeLists
2022-12-11 10:15:41 +01:00
Dennis Luxen
076cbd7018
Merge pull request #6479 from Project-OSRM/dl_fix_cmake_warning
Fix CMake warning
2022-12-11 10:15:33 +01:00
Dennis Luxen
afd340da44
Merge pull request #6478 from Project-OSRM/dluxen_less_dependencies
Less dependencies by inner sourcing cheap-ruler
2022-12-11 10:15:14 +01:00
Dennis Luxen
898cbe8da4 Install PkgConfig on Docker build image 2022-12-10 21:50:24 +01:00
Dennis Luxen
16c6f23791 Fix CMake warning
CMake Warning (dev) at /usr/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PkgConfig)
  does not match the name of the calling package (Lua).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/share/cmake-3.24/Modules/FindPkgConfig.cmake:99 (find_package_handle_standard_args)
  cmake/FindLua.cmake:39 (include)
  CMakeLists.txt:571 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.
2022-12-10 20:50:32 +01:00
Dennis Luxen
612ca82a06 Fix formatting 2022-12-10 20:01:16 +01:00
Dennis Luxen
1215062e4c Port the used bits from CheapRuler, drop dependencies 2022-12-10 19:54:51 +01:00
Dennis Luxen
5292172770 One more place where version is listed 2022-12-10 18:58:25 +01:00
Dennis Luxen
6e5f0d74bd Use cmake 3.18 instead of 3.20 because of debian support 2022-12-10 18:50:37 +01:00
Dennis Luxen
5bab68c737 Update CMakeLists
- remove GOLD linker special case handling
- bump minimum cmake version to 3.20
- simplify LTO detection
- remove outdated way to check for compiler flags
- remove outdated compiler version gates (rely on CXX version)
- remove outdated Apple platform handling
- disable compiler-specific CXX extensions
- require boost 1.70 in all builds
- remove unused variable
2022-12-10 18:25:58 +01:00
Dennis Luxen
152a52bc1a
Merge pull request #6444 from Project-OSRM/dl_using_keyword
[CPP17] Modernize: Replace typedef with using statements
2022-12-10 18:14:43 +01:00
Dennis Luxen
c605b1db38 Fix typo 2022-12-10 16:28:03 +01:00
Dennis Luxen
f4189d9487 Fix formatting 2022-12-10 16:08:22 +01:00
Dennis Luxen
f983d626ac Merge remote-tracking branch 'origin/master' into dl_using_keyword 2022-12-10 16:02:53 +01:00
Siarhei Fedartsou
73b2a86a95
Move vector in CSVFilesParser instead copying it (#6470) 2022-12-03 17:53:56 +01:00
Siarhei Fedartsou
2044398dfd
Add CI job which builds OSRM with gcc 12 (#6455) 2022-11-28 16:29:43 +01:00
Siarhei Fedartsou
095b726a92
Use <boost/iterator/function_output_iterator.hpp> instead of deprecated <boost/function_output_iterator.hpp> (#6458) 2022-11-16 21:09:54 +01:00
Siarhei Fedartsou
18dcd27a9b
Use node-api instead of NAN (#6452) 2022-11-16 15:44:36 +01:00
Frédéric Rodrigo
a1b3efe260
Remove at:urban maxspeed, partial revert of 2bbb347f57 (#6450) 2022-11-11 21:52:54 +01:00
Siarhei Fedartsou
6d10523440
Upgrade to clang-tidy 15 (#6439) 2022-11-06 22:45:35 +01:00
Frédéric Rodrigo
2bbb347f57
Car profile, add new specific country speed limit at:urban, ca-on:rural and es:trunk (#6443) 2022-11-06 21:27:03 +01:00
Siarhei Fedartsou
5f82d0c9ba
Get rid of unused functions in util/json_util.hpp (#6446) 2022-11-06 21:13:04 +01:00
Dennis Luxen
aeaf5e0735
Merge pull request #6433 from Project-OSRM/replace_boost_stringref
Replace boost::string_ref with std::string_view
2022-11-06 15:54:18 +01:00
Siarhei Fedartsou
8a186e6f49
Remove C++14 references from README and package.json (#6438) 2022-11-06 15:20:47 +01:00
Dennis Luxen
2ea168c26c
Merge pull request #6445 from Project-OSRM/dl_drop_gcc7
Drop GCC7 support
2022-11-06 15:08:14 +01:00
Dennis Luxen
a12625afac Drop GCC7 support 2022-11-06 13:33:10 +01:00
Dennis Luxen
8bff55cd85 [CPP17] Modernize: Replace typedef with using statements 2022-11-06 13:21:45 +01:00
Dennis Luxen
bb4fd93fab Fix formatting 2022-11-06 12:26:37 +01:00
Dennis Luxen
b13820f520 Use std::back_inserter 2022-11-06 12:19:32 +01:00
Dennis Luxen
fc12b6c365
Merge pull request #6441 from Project-OSRM/python2_deprecation 2022-11-06 08:21:16 +01:00
Dennis Luxen
cb515ba42f Merge remote-tracking branch 'origin/master' into replace_boost_stringref 2022-11-05 17:31:06 +01:00
Dennis Luxen
634e7fe392 Merge remote-tracking branch 'origin/master' into python2_deprecation 2022-11-05 17:29:57 +01:00
Siarhei Fedartsou
6ab8728807
Apply workaround for Conan installation issue on CI (#6442) 2022-11-05 16:56:16 +01:00
Siarhei Fedartsou
0ae5190937
Fix npm audit warnings in NPM package (#6437) 2022-11-04 12:19:39 +01:00
Dennis Luxen
a1c1fefd6e Fix formatting, pass by value 2022-11-04 11:49:54 +01:00
Dennis Luxen
6fa7bd8abd Upgrade check_tackinfo.py to Python3 2022-11-04 11:47:40 +01:00
Dennis Luxen
7359d6a21b Merge remote-tracking branch 'origin/master' into replace_boost_stringref 2022-11-04 11:43:41 +01:00
Dennis Luxen
5dda33fa88 More efficient toLower implementation 2022-11-04 11:42:37 +01:00
Dennis Luxen
5280ca4e16 Pass string_view by value 2022-11-04 11:41:02 +01:00
Dennis Luxen
2c02d4e5ab Update CHANGELOG.md 2022-11-01 12:10:48 +01:00
Siarhei Fedartsou
54d486ae12
Drop support of Node 12 & 14 (#6431) 2022-11-01 08:23:08 +01:00
Siarhei Fedartsou
afe34456b9
Delete CloudFormation templates (#6435)
There is no need in them - it seems they were needed to manage some Mapbox S3 bucket which we have no access to anyway.
2022-10-31 13:22:13 +01:00
Dennis Luxen
2f75d6f22b
Merge pull request #6429 from Project-OSRM/less_boost_unordered
Replace boost::unordered_{map/set} with std, also remove code duplication
2022-10-30 22:17:48 +01:00
Dennis Luxen
85e6a854aa Fix missing includes (on Windows) 2022-10-30 22:08:29 +01:00
Dennis Luxen
12f49d6f24 Stray whitespace 2022-10-30 20:11:36 +01:00
Dennis Luxen
7149547645 Fix formatting 2022-10-30 20:10:09 +01:00
Dennis Luxen
565959b389 Remove util/string_view header 2022-10-30 20:01:46 +01:00
Dennis Luxen
5c9d0d152c Remove usage of StringView typedef 2022-10-30 19:53:26 +01:00
Dennis Luxen
274dcc58a5 Remove superflous std::hash specialization 2022-10-30 19:21:06 +01:00
Dennis Luxen
d06b23d819 More fixes 2022-10-30 14:08:17 +01:00
Dennis Luxen
91e9623b31 Fix formatting 2022-10-30 14:06:19 +01:00
Dennis Luxen
0021ccef59 Replace boost::string_ref with std::string_view 2022-10-30 13:59:59 +01:00
Dennis Luxen
061f0a1f14 Fix includes 2022-10-30 11:43:28 +01:00
Dennis Luxen
60e283312c
Fix typo historgram -> histogram (#6427) 2022-10-30 08:34:00 +01:00
Dennis Luxen
f97e18d285 Fix formatting 2022-10-29 23:01:38 +02:00
Dennis Luxen
7b73b977ff Replace boost::unordered_{map/set} with std, also remove code duplication 2022-10-29 22:57:14 +02:00
Michael Bell
5d468f2897
Make edge metrics strongly typed (#6421)
This change takes the existing typedefs for weight, duration and
distance, and makes them proper types, using the existing Alias
functionality.

Primarily this is to prevent bugs where the metrics are switched,
but it also adds additional documentation. For example, it now
makes it clear (despite the naming of variables) that most of the
trip algorithm is running on the duration metric.

I've not made any changes to the casts performed between metrics
and numeric types, they now just more explicit.
2022-10-28 15:16:12 +01:00
Siarhei Fedartsou
16685d0de9
Add link to Discord server (#6422) 2022-10-26 11:22:28 +02:00
Siarhei Fedartsou
82897791d1
Update actions/cache to v3 (#6420) 2022-10-24 00:52:15 +02:00
Michael Bell
9ad432c5b2
Fix adding traffic signal penalties during compression (#6419)
Weight and duration penalties are flipped in the lambda function
that applies penalties from traffic signals.

Duration is in deciseconds, whilst weight is multipled by
10^weight_precision, with weight_precision being 1 by default.

Therefore, for default routability profile, the penalties end up
being the same, hence why no tests picked this up.

If distance weight is used however, it will incorrectly apply an
additional penalty to the weight, and not add the traffic signal
delay to the duration in the routing graph.

To confuse things further, in some API responses the values are
correct because they use geometry data instead, but it's still
possible that a sub-optimal route was selected.

However, given the distance weight is in meters, and the additional
penalty per traffic light would be 20, it's unlikely this would
have changed the routing results.

In any case, we correct the function to apply the arguments correctly.
2022-10-23 14:59:12 +01:00
Siarhei Fedartsou
c1d2c15995
Handle snapping parameter for all plugins in NodeJs bindings, but not for Route only (#6417) 2022-10-22 16:49:35 +02:00
Siarhei Fedartsou
fb1bb7a15b
Fix annotations=true handling in NodeJS bindings & libosrm (#6415) 2022-10-19 08:35:18 +02:00
Siarhei Fedartsou
d65e8c7d1e
Fix bindings compilation on latest Node (#6416) 2022-10-18 21:59:39 +02:00
Michael Bell
5e5f1f4add
5.27.1 release (#6409)
* Bookkeeping for 5.27.1 release

* Reset for next release
2022-10-14 23:04:41 +01:00
Siarhei Fedartsou
9d160a9b5d
Revert back to using custom HTTP parser instead of Boost.Beast (#6407) 2022-10-14 14:37:33 +02:00
2501 changed files with 130637 additions and 208872 deletions

View File

@ -13,6 +13,11 @@ Checks: >
-bugprone-forward-declaration-namespace,
-bugprone-sizeof-expression,
-bugprone-throw-keyword-missing,
-bugprone-chained-comparison,
-bugprone-incorrect-enable-if,
-bugprone-switch-missing-default-case,
-bugprone-empty-catch,
-bugprone-unchecked-optional-access,
-clang-analyzer-*,
-clang-diagnostic-deprecated-declarations,
-clang-diagnostic-constant-conversion,
@ -42,15 +47,20 @@ Checks: >
-llvm-twine-local,
misc-*,
-misc-argument-comment,
-misc-const-correctness,
-misc-non-private-member-variables-in-classes,
-misc-unconventional-assign-operator,
-misc-no-recursion,
-misc-misplaced-const,
-misc-definitions-in-headers,
-misc-unused-parameters,
-misc-include-cleaner,
modernize-concat-nested-namespaces,
modernize-use-using,
performance-*,
-performance-noexcept-move-constructor,
-performance-no-int-to-ptr,
-performance-enum-size,
-performance-avoid-endl,
readability-*,
-readability-avoid-const-params-in-decls,
-readability-braces-around-statements,
@ -79,6 +89,10 @@ Checks: >
-readability-make-member-function-const,
-readability-redundant-string-init,
-readability-non-const-parameter,
-readability-redundant-inline-specifier,
-readability-avoid-nested-conditional-operator,
-readability-avoid-return-with-void-value,
-readability-redundant-casting,
-readability-static-accessed-through-instance
WarningsAsErrors: '*'

View File

@ -0,0 +1,65 @@
name: Build and Publish Docker Image
on:
release:
types: [published, prereleased]
env:
IMAGE_NAME: openharbor/osrm-backend
jobs:
publish:
strategy:
matrix:
docker-base-image: ["debian", "alpine"]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
- name: Docker meta - debug
id: metadebug
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
flavor: |
latest=true
suffix=-debug,onlatest=true
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Build and push debug image
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.metadebug.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags) }}-${{ matrix.docker-base-image }}
- name: Build and push normal image
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.meta.outputs.tags) }}-${{ matrix.docker-base-image }}

View File

@ -1,5 +0,0 @@
---
name: Question
about: Ask a question about OSRM
labels: question
---

View File

@ -6,6 +6,9 @@ on:
jobs:
publish:
strategy:
matrix:
docker-base-image: ["debian", "alpine"]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
@ -53,10 +56,10 @@ jobs:
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.metadebug.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags ) }}
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags ) }}-${{ matrix.docker-base-image }}
- name: Build container image - assertions
@ -64,10 +67,10 @@ jobs:
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.metaassertions.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.metaassertions.outputs.tags ) }}
DOCKER_TAG=${{ join(steps.metaassertions.outputs.tags ) }}-${{ matrix.docker-base-image }}
# build and publish "normal" image as last to get it listed on top
- name: Build container image - normal
@ -75,10 +78,7 @@ jobs:
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.meta.outputs.tags ) }}
DOCKER_TAG=${{ join(steps.meta.outputs.tags ) }}-${{ matrix.docker-base-image }}

File diff suppressed because it is too large Load Diff

29
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: 'Close stale issues'
on:
# NOTE: uncomment if you want to test changes to this file in PRs CI
# pull_request:
# branches:
# - master
schedule:
- cron: '30 1 * * *' # every day at 1:30am
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-24.04
steps:
- uses: actions/stale@v9
with:
operations-per-run: 3000
stale-issue-message: 'This issue seems to be stale. It will be closed in 30 days if no further activity occurs.'
stale-pr-message: 'This PR seems to be stale. Is it still relevant?'
days-before-issue-stale: 180 # 6 months
days-before-issue-close: 30 # 1 month
days-before-pr-stale: 180 # 6 months
days-before-pr-close: -1 # never close PRs
exempt-issue-labels: 'Do Not Stale,Feature Request,Performance,Bug Report,CI,Starter Task,Refactor,Guidance'

2
.gitignore vendored
View File

@ -46,7 +46,6 @@ Thumbs.db
/example/build/
/test/data/monaco.osrm*
/test/data/ch
/test/data/corech
/test/data/mld
/cmake/postinst
@ -105,3 +104,4 @@ debug.lua
# node-osrm artifacts
lib/binding

View File

@ -1,6 +1,103 @@
# Unreleased
- Changes from 5.27.1
- Features
- ADDED: Route pedestrians over highway=platform [#6993](https://github.com/Project-OSRM/osrm-backend/pull/6993)
- REMOVED: Remove all core-CH left-overs [#6920](https://github.com/Project-OSRM/osrm-backend/pull/6920)
- ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674)
- ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575)
- ADDED: Add support for disabling feature datasets. [#6666](https://github.com/Project-OSRM/osrm-backend/pull/6666)
- ADDED: Add support for opposite approach request parameter. [#6842](https://github.com/Project-OSRM/osrm-backend/pull/6842)
- ADDED: Add support for accessing edge flags in `process_segment` [#6658](https://github.com/Project-OSRM/osrm-backend/pull/6658)
- Build:
- CHANGED: Upgrade clang-format to version 15. [#6919](https://github.com/Project-OSRM/osrm-backend/pull/6919)
- CHANGED: Use Debian Bookworm as base Docker image [#6904](https://github.com/Project-OSRM/osrm-backend/pull/6904)
- CHANGED: Upgrade CI actions to latest versions [#6893](https://github.com/Project-OSRM/osrm-backend/pull/6893)
- CHANGED: Remove outdated warnings #6894 [#6894](https://github.com/Project-OSRM/osrm-backend/pull/6894)
- ADDED: Add CI job which builds OSRM with gcc 12. [#6455](https://github.com/Project-OSRM/osrm-backend/pull/6455)
- CHANGED: Upgrade to clang-tidy 15. [#6439](https://github.com/Project-OSRM/osrm-backend/pull/6439)
- CHANGED: Update actions/cache to v3. [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
- REMOVED: Drop support of Node 12 & 14. [#6431](https://github.com/Project-OSRM/osrm-backend/pull/6431)
- ADDED: Add 'load directly' mode to default Cucumber test suite. [#6663](https://github.com/Project-OSRM/osrm-backend/pull/6663)
- CHANGED: Fix compilation for Boost 1.85.0 [#6856](https://github.com/Project-OSRM/osrm-backend/pull/6856)
- CHANGED: Drop support for Node 16 [#6855](https://github.com/Project-OSRM/osrm-backend/pull/6855)
- REMOVED: Remove unused AppVeyor files [#6860](https://github.com/Project-OSRM/osrm-backend/pull/6860)
- CHANGED: Upgrade clang-format to version 15 [#6859](https://github.com/Project-OSRM/osrm-backend/pull/6859)
- NodeJS:
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc:
- CHANGED: Use std::string_view for key type in json::Object. [#7062](https://github.com/Project-OSRM/osrm-backend/pull/7062)
- CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991)
- CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988)
- CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983)
- CHANGED: Get rid of boost::optional leftovers. [#6977](https://github.com/Project-OSRM/osrm-backend/pull/6977)
- CHANGED: Use Link Time Optimisation whenever possible. [#6967](https://github.com/Project-OSRM/osrm-backend/pull/6967)
- CHANGED: Use struct instead of tuple to define UnpackedPath. [#6974](https://github.com/Project-OSRM/osrm-backend/pull/6974)
- CHANGED: Micro performance optimisation in map matching. [#6976](https://github.com/Project-OSRM/osrm-backend/pull/6976)
- CHANGED: Re-use priority queue in StaticRTree. [#6952](https://github.com/Project-OSRM/osrm-backend/pull/6952)
- CHANGED: Optimise encodePolyline function. [#6940](https://github.com/Project-OSRM/osrm-backend/pull/6940)
- CHANGED: Avoid reallocations in base64 encoding. [#6951](https://github.com/Project-OSRM/osrm-backend/pull/6951)
- CHANGED: Get rid of unused Boost dependencies. [#6960](https://github.com/Project-OSRM/osrm-backend/pull/6960)
- CHANGED: Apply micro-optimisation for Table & Trip APIs. [#6949](https://github.com/Project-OSRM/osrm-backend/pull/6949)
- CHANGED: Apply micro-optimisation for Route API. [#6948](https://github.com/Project-OSRM/osrm-backend/pull/6948)
- CHANGED: Apply micro-optimisation for Match API. [#6945](https://github.com/Project-OSRM/osrm-backend/pull/6945)
- CHANGED: Apply micro-optimisation for Nearest API. [#6944](https://github.com/Project-OSRM/osrm-backend/pull/6944)
- CHANGED: Avoid copy of intersection in totalTurnAngle. [#6938](https://github.com/Project-OSRM/osrm-backend/pull/6938)
- CHANGED: Use std::unordered_map::emplace instead of operator[] when producing JSONs. [#6936](https://github.com/Project-OSRM/osrm-backend/pull/6936)
- CHANGED: Avoid copy of vectors in MakeRoute function. [#6939](https://github.com/Project-OSRM/osrm-backend/pull/6939)
- FIXED: Fix bugprone-unused-return-value clang-tidy warning. [#6934](https://github.com/Project-OSRM/osrm-backend/pull/6934)
- FIXED: Fix performance-noexcept-move-constructor clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6933)
- FIXED: Fix performance-noexcept-swap clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6931)
- CHANGED: Use custom struct instead of std::pair in QueryHeap. [#6921](https://github.com/Project-OSRM/osrm-backend/pull/6921)
- CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918)
- CHANGED: Get rid of boost::math::constants::* and M_PI in favor of std::numbers. [#6916](https://github.com/Project-OSRM/osrm-backend/pull/6916)
- CHANGED: Make constants in PackedVector constexpr. [#6917](https://github.com/Project-OSRM/osrm-backend/pull/6917)
- CHANGED: Use std::variant instead of mapbox::util::variant. [#6903](https://github.com/Project-OSRM/osrm-backend/pull/6903)
- CHANGED: Bump rapidjson to version f9d53419e912910fd8fa57d5705fa41425428c35 [#6906](https://github.com/Project-OSRM/osrm-backend/pull/6906)
- CHANGED: Bump mapbox/variant to version 1.2.0 [#6898](https://github.com/Project-OSRM/osrm-backend/pull/6898)
- CHANGED: Avoid copy of std::function-based callback in path unpacking [#6895](https://github.com/Project-OSRM/osrm-backend/pull/6895)
- CHANGED: Replace boost::hash by std::hash [#6892](https://github.com/Project-OSRM/osrm-backend/pull/6892)
- CHANGED: Partial fix migration from boost::optional to std::optional [#6551](https://github.com/Project-OSRM/osrm-backend/issues/6551)
- CHANGED: Replace boost::filesystem with std::filesystem [#6432](https://github.com/Project-OSRM/osrm-backend/pull/6432)
- CHANGED: Update Conan Boost version to 1.85.0. [#6868](https://github.com/Project-OSRM/osrm-backend/pull/6868)
- FIXED: Fix an error in a RouteParameters AnnotationsType operator overload. [#6646](https://github.com/Project-OSRM/osrm-backend/pull/6646)
- ADDED: Add support for "unlimited" to be passed as a value for the default-radius and max-matching-radius flags. [#6599](https://github.com/Project-OSRM/osrm-backend/pull/6599)
- CHANGED: Allow -1.0 as unlimited for default_radius value. [#6599](https://github.com/Project-OSRM/osrm-backend/pull/6599)
- CHANGED: keep libosrm* in the docker image for downstream linking [#6602](https://github.com/Project-OSRM/osrm-backend/pull/6602)
- CHANGED: Move vector in CSVFilesParser instead copying it. [#6470](https://github.com/Project-OSRM/osrm-backend/pull/6470)
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
- FIXED: Fix `npm audit` warnings in NPM package. [#6437](https://github.com/Project-OSRM/osrm-backend/pull/6437)
- FIXED: Handle snapping parameter for all plugins in NodeJs bindings, but not for Route only. [#6417](https://github.com/Project-OSRM/osrm-backend/pull/6417)
- FIXED: Fix annotations=true handling in NodeJS bindings & libosrm. [#6415](https://github.com/Project-OSRM/osrm-backend/pull/6415/)
- FIXED: Fix bindings compilation issue on the latest Node. Update NAN to 2.17.0. [#6416](https://github.com/Project-OSRM/osrm-backend/pull/6416)
- CHANGED: Make edge metrics strongly typed [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
- FIXED: Typo in file name src/util/timed_historgram.cpp -> src/util/timed_histogram.cpp [#6428](https://github.com/Project-OSRM/osrm-backend/issues/6428)
- CHANGED: Replace boost::string_ref with std::string_view [#6433](https://github.com/Project-OSRM/osrm-backend/pull/6433)
- ADDED: Print tracebacks for Lua runtime errors [#6564](https://github.com/Project-OSRM/osrm-backend/pull/6564)
- FIXED: Added a variable to preprocessor guard in file osrm-backend/include/util/range_table.hpp to solve build error. [#6596](https://github.com/Project-OSRM/osrm-backend/pull/6596)
- FIXED: Ensure required file check in osrm-routed is correctly enforced. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
- FIXED: Correct HTTP docs to reflect summary output dependency on steps parameter. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
- ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839)
- Profiles:
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
- ADDED: Add optional support of cargo bike exclusion and width to bicyle profile [#7044](https://github.com/Project-OSRM/osrm-backend/pull/7044)
- Routing:
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
- FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739)
- FIXED: Remove force-loop checks for routes with u-turns [#6858](https://github.com/Project-OSRM/osrm-backend/pull/6858)
- FIXED: Correctly check runtime search conditions for forcing routing steps [#6866](https://github.com/Project-OSRM/osrm-backend/pull/6866)
- Map Matching:
- CHANGED: Optimise path distance calculation in MLD map matching even more. [#6884](https://github.com/Project-OSRM/osrm-backend/pull/6884)
- CHANGED: Optimise path distance calculation in MLD map matching. [#6876](https://github.com/Project-OSRM/osrm-backend/pull/6876)
- CHANGED: Optimise R-tree queries in the case of map matching. [#6881](https://github.com/Project-OSRM/osrm-backend/pull/6876)
- Debug tiles:
- FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726)
# 5.27.1
- Changes from 5.27.0
- Misc:
- FIXED: Revert back to using custom HTTP parser instead of Boost.Beast. [#6407](https://github.com/Project-OSRM/osrm-backend/pull/6407)
- FIXED: Fix bug with large HTTP requests leading to Bad Request in osrm-routed. [#6403](https://github.com/Project-OSRM/osrm-backend/pull/6403)
- Routing:
- CHANGED: Add support for surface=metal,grass_paver,woodchips in bicyle profile. [#6395](https://github.com/Project-OSRM/osrm-backend/pull/6395)

View File

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
cmake_minimum_required(VERSION 3.18)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed.
@ -31,36 +31,48 @@ option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
option(ENABLE_LTO "Use LTO if available" OFF)
option(ENABLE_LTO "Use Link Time Optimisation" ON)
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
if (ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
else()
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*;--header-filter=.*")
endif()
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# be compatible with version handling before cmake 3.x
if (POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
endif()
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
if (POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
project(OSRM C CXX)
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
include(CheckIPOSupported)
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
if(LTO_SUPPORTED)
message(STATUS "IPO / LTO enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(FATAL_ERROR "IPO / LTO not supported: <${error}>")
endif()
endif()
# add @loader_path/$ORIGIN to rpath to make binaries relocatable
if (APPLE)
set(CMAKE_BUILD_RPATH "@loader_path")
@ -74,14 +86,17 @@ include(JSONParser)
file(READ "package.json" packagejsonraw)
sbeParseJson(packagejson packagejsonraw)
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)")
# This regex is not strict enough, but the correct one is too complicated for cmake matching.
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)([-+][0-9a-zA-Z.-]+)?$")
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
set(OSRM_VERSION_PRERELEASE_BUILD ${CMAKE_MATCH_4})
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
set(OSRM_VERSION packagejson.version)
else()
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible X.Y.Z, but found ${packagejson.version}")
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible label, but found ${packagejson.version}")
endif()
if (MSVC)
@ -113,35 +128,18 @@ include(CheckCXXCompilerFlag)
include(FindPackageHandleStandardArgs)
include(GNUInstallDirs)
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bitness 64)
message(STATUS "Building on a 64 bit system")
else()
message(STATUS "Building on a 32 bit system")
endif()
if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif()
# Strictly require GCC>=5.0 and Clang>=3.4 - GCC 4.8 is already too old for C++14.
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
message(FATAL_ERROR "Clang>=3.4 required. In case you are on Ubuntu upgrade via http://apt.llvm.org")
endif()
message(FATAL_ERROR "Building on a 32 bit system is not supported")
endif()
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2-3.3.0/include)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/variant/include)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/generated/include/)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/include)
set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework)
set(BOOST_COMPONENTS date_time iostreams program_options thread unit_test_framework)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/util/version.hpp.in
@ -190,26 +188,6 @@ add_library(osrm_customize src/osrm/customizer.cpp $<TARGET_OBJECTS:CUSTOMIZER>
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
if(ENABLE_GOLD_LINKER)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
message(STATUS "Using GNU gold as linker.")
# Issue 2785: check gold binutils version and don't use gc-sections for versions prior 2.25
string(REGEX REPLACE ".*\\(GNU Binutils[^\\)0-9]+([0-9]+\\.[0-9]+)[^\\)]*\\).*" "\\1" GOLD_BINUTILS_VERSION "${LD_VERSION}")
if ("${GOLD_BINUTILS_VERSION}" VERSION_LESS "2.26")
message(STATUS "Disabling gc-sections on gold binutils < 2.26, see: https://sourceware.org/bugzilla/show_bug.cgi?id=17639")
set(LD_AVOID_GC_SECTIONS TRUE)
endif()
else()
message(WARNING "GNU gold linker isn't available.")
set(ENABLE_GOLD_LINKER OFF)
endif()
endif()
# Explicitly set the build type to Release if no other type is specified
# on the command line. Without this, cmake defaults to an unoptimized,
# non-debug build, which almost nobody wants.
@ -247,78 +225,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
endif()
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "Configuring release mode optimizations")
# Check if LTO is available
check_cxx_compiler_flag("-Wl,-flto" LTO_AVAILABLE)
if(ENABLE_LTO AND LTO_AVAILABLE)
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# GCC in addition allows parallelizing LTO
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
include(ProcessorCount)
ProcessorCount(NPROC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=${NPROC}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
endif()
set(CHECK_LTO_SRC "int main(){return 0;}")
check_cxx_source_compiles("${CHECK_LTO_SRC}" LTO_WORKS)
if(LTO_WORKS)
message(STATUS "LTO working")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -flto")
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -flto")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -flto")
else()
message(STATUS "LTO broken")
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
set(ENABLE_LTO Off)
endif()
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT MINGW)
find_program(GCC_AR gcc-ar)
find_program(GCC_RANLIB gcc-ranlib)
if ("${GCC_AR}" STREQUAL "GCC_AR-NOTFOUND" OR "${GCC_RANLIB}" STREQUAL "GCC_RANLIB-NOTFOUND")
message(WARNING "GCC specific binutils not found. In case of linker issues export env vars: AR=gcc-ar, NM=gcc-nm, RANLIB=gcc-ranlib")
else()
message(STATUS "Using GCC specific binutils for LTO:")
message(STATUS " ${GCC_AR}")
message(STATUS " ${GCC_RANLIB}")
set(CMAKE_AR ${GCC_AR})
set(CMAKE_RANLIB ${GCC_RANLIB})
endif()
endif()
# Same for clang LTO requires their own toolchain
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
find_program(LLVM_AR llvm-ar)
find_program(LLVM_RANLIB llvm-ranlib)
if ("${LLVM_AR}" STREQUAL "LLVM_AR-NOTFOUND" OR "${LLVM_RANLIB}" STREQUAL "LLVM_RANLIB-NOTFOUND")
message(WARNING "LLVM specific binutils not found.")
else()
message(STATUS "Using LLVM specific binutils for LTO:")
message(STATUS " ${LLVM_AR}")
message(STATUS " ${LLVM_RANLIB}")
set(CMAKE_AR ${LLVM_AR})
set(CMAKE_RANLIB ${LLVM_RANLIB})
endif()
endif()
endif()
endif()
# TODO: this was added for Mason, we are not sure if it is true after migration to Conan
if(UNIX AND NOT APPLE AND ENABLE_CONAN AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
message(WARNING "ENABLE_CONAN and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
endif()
set(MAYBE_COVERAGE_LIBRARIES "")
if (ENABLE_COVERAGE)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
message(ERROR "ENABLE_COVERAGE=ON only makes sense with a Debug build")
endif()
message(STATUS "Enabling coverage")
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
@ -352,14 +262,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_dependency_defines(-DWIN32)
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
endif()
# -fpermissive is required for parallel_do Intel TBB internal issue with GCC < 5
# https://github.com/Project-OSRM/osrm-backend/pull/3603#issuecomment-277688589
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(STATUS "Adding -fpermissive for GCC version < 5 bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51048). See #3603.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
# using Intel C++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
@ -370,58 +272,18 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
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()
# Configuring linker
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ERROR_QUIET OUTPUT_VARIABLE LINKER_VERSION)
# For ld.gold and ld.bfs (the GNU linkers) we optimize hard
if("${LINKER_VERSION}" MATCHES "GNU gold" OR "${LINKER_VERSION}" MATCHES "GNU ld")
message(STATUS "Setting linker optimizations")
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR "${LD_AVOID_GC_SECTIONS}"))
# Tell compiler to put every function in separate section, linker can then match sections and functions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
# Tell linker to do dead code and data eminination during link time discarding sections
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--gc-sections")
endif()
# Default linker optimization flags
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common")
else()
message(STATUS "Using unknown linker, not setting linker optimizations")
endif ()
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} ${LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# Activate C++1y
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++17")
endif()
# Configuring other platform dependencies
if(APPLE)
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(OSXLIBSTD)
message(STATUS "linking against ${OSXLIBSTD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=${OSXLIBSTD}")
elseif(DARWIN_VERSION GREATER 12)
message(STATUS "linking against libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
if(UNIX AND NOT APPLE)
find_library(RT_LIB rt)
if (RT_LIB)
set(MAYBE_RT_LIBRARY -lrt)
endif()
endif()
find_package(Threads REQUIRED)
@ -432,13 +294,9 @@ include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
set(MBXGEOM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/geometry.hpp-0.9.2/include")
include_directories(SYSTEM ${MBXGEOM_INCLUDE_DIR})
set(CHEAPRULER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cheap-ruler-cpp-2778eb8/include")
include_directories(SYSTEM ${CHEAPRULER_INCLUDE_DIR})
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
target_no_warning(MICROTAR unused-variable)
target_no_warning(MICROTAR format)
@ -456,7 +314,7 @@ add_subdirectory(${FLATBUFFERS_SRC_DIR}
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
EXCLUDE_FROM_ALL)
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt-9.1.0/include")
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt/include")
add_compile_definitions(FMT_HEADER_ONLY)
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
@ -475,22 +333,16 @@ if(ENABLE_CONAN)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
set(CONAN_BOOST_VERSION "1.79.0#96e4902111a2e343a8ba0aa95391bb58")
set(CONAN_BZIP2_VERSION "1.0.8#d1b2d5816f25865acf978501dff1f897")
set(CONAN_EXPAT_VERSION "2.2.10#916908d4a570ad839edd25322c3268cd")
set(CONAN_LUA_VERSION "5.4.4#3ec62efc37cd0a5d80b9e5cb35277360")
set(CONAN_TBB_VERSION "2021.3.0#507ec17cbd51a84167e143b20d170eea")
conan_check(REQUIRED)
set(CONAN_BOOST_VERSION "1.85.0@#14265ec82b25d91305bbb3b30d3357f8")
set(CONAN_BZIP2_VERSION "1.0.8@#d1b2d5816f25865acf978501dff1f897")
set(CONAN_EXPAT_VERSION "2.6.2@#2d385d0d50eb5561006a7ff9e356656b")
set(CONAN_LUA_VERSION "5.4.6@#658d6089093cf01992c2737ab2e96763")
set(CONAN_TBB_VERSION "2021.12.0@#e56e5b44be8d690530585dd3634c0106")
set(CONAN_SYSTEM_INCLUDES ON)
# TODO:
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
# with exit code = -1073741515, which means that program cannot load required DLL.
if (MSVC)
set(TBB_SHARED False)
else()
set(TBB_SHARED True)
endif()
set(CONAN_ARGS
REQUIRES
@ -503,11 +355,16 @@ if(ENABLE_CONAN)
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
KEEP_RPATHS
NO_OUTPUT_DIRS
OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake
onetbb:shared=${TBB_SHARED}
boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
OPTIONS boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
BUILD missing
)
# Enable revisions in the conan config
execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1 RESULT_VARIABLE RET_CODE)
if(NOT "${RET_CODE}" STREQUAL "0")
message(FATAL_ERROR "Error setting revisions for Conan: '${RET_CODE}'")
endif()
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
@ -527,14 +384,10 @@ if(ENABLE_CONAN)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
set(Boost_DATE_TIME_LIBRARY "${Boost_date_time_LIB_TARGETS}")
set(Boost_CHRONO_LIBRARY "${Boost_chrono_LIB_TARGETS}")
set(Boost_PROGRAM_OPTIONS_LIBRARY "${Boost_program_options_LIB_TARGETS}")
set(Boost_FILESYSTEM_LIBRARY "${Boost_filesystem_LIB_TARGETS}")
set(Boost_IOSTREAMS_LIBRARY "${Boost_iostreams_LIB_TARGETS}")
set(Boost_THREAD_LIBRARY "${Boost_thread_LIB_TARGETS}")
set(Boost_SYSTEM_LIBRARY "${Boost_system_LIB_TARGETS}")
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
@ -550,12 +403,7 @@ if(ENABLE_CONAN)
# expat and bzip2 are used from conan rather than the system
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
else()
if (BUILD_ROUTED)
# osrm-routed requires newer boost:asio
find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
else()
find_package(Boost 1.60 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
endif()
add_dependency_includes(${Boost_INCLUDE_DIRS})
find_package(TBB REQUIRED)
@ -602,7 +450,6 @@ if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILE
message(STATUS "Using ccache to speed up incremental builds")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set(ENV{CCACHE_CPP2} "true")
endif()
endif()
@ -613,18 +460,17 @@ add_dependency_includes(${ZLIB_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)
# Workaround for https://github.com/boostorg/phoenix/issues/111
add_dependency_defines(-DBOOST_PHOENIX_STL_TUPLE_H_)
add_definitions(${OSRM_DEFINES})
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
set(BOOST_BASE_LIBRARIES
${Boost_DATE_TIME_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_SYSTEM_LIBRARY})
${Boost_THREAD_LIBRARY})
set(BOOST_ENGINE_LIBRARIES
${Boost_ZLIB_LIBRARY}
@ -643,7 +489,6 @@ endif()
set(EXTRACTOR_LIBRARIES
${BZIP2_LIBRARIES}
${Boost_REGEX_LIBRARY}
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${EXPAT_LIBRARIES}
@ -748,7 +593,6 @@ if (BUILD_ROUTED)
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h)
file(GLOB LibraryGlob include/osrm/*.hpp)
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
@ -768,7 +612,6 @@ install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
install(FILES ${LibraryGlob} DESTINATION include/osrm)
install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
install(FILES ${ApiHeader} DESTINATION include/osrm/engine/api)
install(FILES ${VariantGlob} DESTINATION include/mapbox)
install(FILES ${FlatbuffersGlob} DESTINATION include/flatbuffers)
install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-partition DESTINATION bin)
@ -792,6 +635,10 @@ install(TARGETS osrm_guidance DESTINATION lib)
set(DefaultProfilesDir profiles)
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
# Install data geojson files to /usr/local/share/osrm/data by default
set(DefaultProfilesDir data)
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
# Setup exporting variables for pkgconfig and subproject
#

View File

@ -10,7 +10,7 @@ You can add a :+1: emoji reaction to the issue if you want to express interest i
# Developer
We use `clang-format` version `3.8` to consistently format the code base. There is a helper script under `scripts/format.sh`.
We use `clang-format` version `15` to consistently format the code base. There is a helper script under `scripts/format.sh`.
The format is automatically checked by the `mason-linux-release` job of a Travis CI build.
To save development time a local hook `.git/hooks/pre-push`
```

View File

@ -1,10 +1,9 @@
## Open Source Routing Machine
| Linux / macOS / Windows | Code Coverage |
| ----------------------- | ------------- |
| [![osrm-backend CI](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml/badge.svg)](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) | [![Codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) |
High performance routing engine written in C++14 designed to run on OpenStreetMap data.
[![osrm-backend CI](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml/badge.svg)](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) [![Codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) [![Discord](https://img.shields.io/discord/1034487840219860992)](https://discord.gg/es9CdcCXcb)
High performance routing engine written in C++ designed to run on OpenStreetMap data.
The following services are available via HTTP API, C++ library interface and NodeJs wrapper:
- Nearest - Snaps coordinates to the street network and returns the nearest matches
@ -16,12 +15,12 @@ The following services are available via HTTP API, C++ library interface and Nod
To quickly try OSRM use our [demo server](http://map.project-osrm.org) which comes with both the backend and a frontend on top.
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [this guide about mapping for navigation](https://www.mapbox.com/mapping/mapping-for-navigation/).
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [the OSM wiki on routing](https://wiki.openstreetmap.org/wiki/Routing) or [this guide about mapping for navigation](https://web.archive.org/web/20221206013651/https://labs.mapbox.com/mapping/mapping-for-navigation/).
Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
- [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images
- [osrm-backend-docker](https://github.com/project-osrm/osrm-backend/pkgs/container/osrm-backend) - Ready to use Docker images
## Documentation
@ -33,6 +32,7 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
## Contact
- Discord: [join](https://discord.gg/es9CdcCXcb)
- IRC: `irc.oftc.net`, channel: `#osrm` ([Webchat](https://webchat.oftc.net))
- Mailinglist: `https://lists.openstreetmap.org/listinfo/osrm-talk`
@ -58,12 +58,12 @@ Download OpenStreetMap extracts for example from [Geofabrik](http://download.geo
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf || echo "osrm-extract failed"
The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host.
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm || echo "osrm-partition failed"
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-customize /data/berlin-latest.osrm || echo "osrm-customize failed"
Note there is no `berlin-latest.osrm` file, but multiple `berlin-latest.osrm.*` files, i.e. `berlin-latest.osrm` is not file path, but "base" path referring to set of files and there is an option to omit this `.osrm` suffix completely(e.g. `osrm-partition /data/berlin-latest`).

View File

@ -1,15 +0,0 @@
os: Visual Studio 2019
# clone directory
clone_folder: c:\projects\osrm
platform: x64
# no-op for the time being until someone with access to GitHub checks settings will remove integration with AppVeyor
# https://github.com/Project-OSRM/osrm-backend/pull/6312#issuecomment-1217237055
build_script:
- EXIT 0
branches:
only:
- master

View File

@ -1,32 +0,0 @@
@ECHO OFF
SETLOCAL
SET EL=0
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET PLATFORM=x64
SET CONFIGURATION=Release
::SET LOCAL_DEV=1
FOR /F "tokens=*" %%i in ('git rev-parse --abbrev-ref HEAD') do SET APPVEYOR_REPO_BRANCH=%%i
ECHO APPVEYOR_REPO_BRANCH^: %APPVEYOR_REPO_BRANCH%
SET PATH=C:\Program Files\7-Zip;%PATH%
powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
CALL appveyor-build.bat
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO DONE
:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%
:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EXIT /b %EL%

View File

@ -1,75 +0,0 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "user for publishing to s3://mapbox-node-binary/osrm",
"Resources": {
"User": {
"Type": "AWS::IAM::User",
"Properties": {
"Policies": [
{
"PolicyName": "list",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mapbox-node-binary",
"Condition": {
"StringLike": {
"s3:prefix": [
"osrm/*"
]
}
}
}
]
}
},
{
"PolicyName": "publish",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mapbox-node-binary/osrm/*"
}
]
}
}
]
}
},
"AccessKey": {
"Type": "AWS::IAM::AccessKey",
"Properties": {
"UserName": {
"Ref": "User"
}
}
}
},
"Outputs": {
"AccessKeyId": {
"Value": {
"Ref": "AccessKey"
}
},
"SecretAccessKey": {
"Value": {
"Fn::GetAtt": [
"AccessKey",
"SecretAccessKey"
]
}
}
}
}

View File

@ -1,59 +0,0 @@
var cf = require('@mapbox/cloudfriend');
var package_json = require('../package.json')
module.exports = {
AWSTemplateFormatVersion: '2010-09-09',
Description: 'user for publishing to s3://mapbox-node-binary/' + package_json.name,
Resources: {
User: {
Type: 'AWS::IAM::User',
Properties: {
Policies: [
{
PolicyName: 'list',
PolicyDocument: {
Statement: [
{
Action: ['s3:ListBucket'],
Effect: 'Allow',
Resource: 'arn:aws:s3:::mapbox-node-binary',
Condition : {
StringLike : {
"s3:prefix": [ package_json.name + "/*"]
}
}
}
]
}
},
{
PolicyName: 'publish',
PolicyDocument: {
Statement: [
{
Action: ['s3:DeleteObject', 's3:GetObject', 's3:GetObjectAcl', 's3:PutObject', 's3:PutObjectAcl'],
Effect: 'Allow',
Resource: 'arn:aws:s3:::mapbox-node-binary/' + package_json.name + '/*'
}
]
}
}
]
}
},
AccessKey: {
Type: 'AWS::IAM::AccessKey',
Properties: {
UserName: cf.ref('User')
}
}
},
Outputs: {
AccessKeyId: {
Value: cf.ref('AccessKey')
},
SecretAccessKey: {
Value: cf.getAtt('AccessKey', 'SecretAccessKey')
}
}
};

View File

@ -1,29 +0,0 @@
# - Check whether the CXX compiler supports a given flag.
# CHECK_CXX_COMPILER_FLAG(<flag> <var>)
# <flag> - the compiler flag
# <var> - variable to store the result
# This internally calls the check_cxx_source_compiles macro. See help
# for CheckCXXSourceCompiles for a listing of variables that can
# modify the build.
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCXXSourceCompiles)
MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "unrecognized .*option" # GNU
FAIL_REGEX "ignoring unknown option" # MSVC
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_CXX_COMPILER_FLAG)

View File

@ -36,7 +36,10 @@
# This is because, the lua location is not standardized and may exist in
# locations other than lua/
include(FindPkgConfig)
if(NOT PKG_CONFIG_FOUND)
include(CMakeFindDependencyMacro)
find_dependency(PkgConfig)
endif()
unset(_lua_include_subdirs)
unset(_lua_library_names)

View File

@ -1,7 +1,7 @@
# https://github.com/sbellus/json-cmake/blob/9913da8800b95322d393894d3525d634568f305e/JSONParser.cmake
# MIT Licensed - https://github.com/sbellus/json-cmake/blob/master/LICENSE
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.18)
if (DEFINED JSonParserGuard)
return()

View File

@ -55,7 +55,7 @@ function(_get_msvc_ide_version result)
set(${result} 15 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930)
set(${result} 16 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940)
elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1950)
set(${result} 17 PARENT_SCOPE)
else()
message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]")

View File

@ -50,9 +50,7 @@ add_warning(all)
add_warning(extra)
add_warning(pedantic)
add_warning(error) # treat all warnings as errors
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_warning(strict-overflow=2)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_warning(strict-overflow=1)
endif()
add_warning(suggest-override)
@ -66,7 +64,6 @@ add_warning(init-self)
add_warning(bool-compare)
add_warning(logical-not-parentheses)
add_warning(logical-op)
add_warning(maybe-uninitialized)
add_warning(misleading-indentation)
# `no-` prefix is part of warning name(i.e. doesn't mean we are disabling it)
add_warning(no-return-local-addr)
@ -79,15 +76,13 @@ add_warning(sizeof-array-argument)
add_warning(switch-bool)
add_warning(tautological-compare)
add_warning(trampolines)
no_warning(c++17-extensions)
# TODO: these warnings are not enabled by default, but we consider them as useful and good to enable in the future
no_warning(implicit-int-conversion)
no_warning(implicit-float-conversion)
no_warning(unused-member-function)
no_warning(old-style-cast)
no_warning(non-virtual-dtor)
no_warning(float-conversion)
no_warning(sign-conversion)
no_warning(shorten-64-to-32)
no_warning(padded)
no_warning(missing-noreturn)
# these warnings are not enabled by default
# no_warning(name-of-warning)
no_warning(deprecated-comma-subscript)
no_warning(comma-subscript)
no_warning(ambiguous-reversed-operator)
no_warning(restrict)
no_warning(free-nonheap-object)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
no_warning(stringop-overflow)
endif()

View File

@ -1,6 +1,6 @@
module.exports = {
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only --require features/support --require features/step_definitions',
verify: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only -f progress --require features/support --require features/step_definitions',
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld --require features/support --require features/step_definitions',
ch: '--strict --tags ~@stress --tags ~@todo --tags ~@mld -f progress --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress'

View File

@ -1,67 +0,0 @@
FROM debian:bullseye-slim as builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src && mkdir -p /opt
RUN apt-get update && \
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
libzip-dev libboost1.74-all-dev lua5.4 liblua5.4-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
ldconfig /usr/local/lib && \
git clone --branch v2021.3.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \
cd oneTBB && \
mkdir build && \
cd build && \
cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build . && \
cmake --install .
COPY . /src
WORKDIR /src
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \
cd build && \
BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
strip /usr/local/bin/* && \
rm -rf /src /usr/local/lib/libosrm*
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM debian:bullseye-slim as runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apt-get update && \
apt-get install -y --no-install-recommends libboost-program-options1.74.0 libboost-regex1.74.0 \
libboost-date-time1.74.0 libboost-chrono1.74.0 libboost-filesystem1.74.0 \
libboost-iostreams1.74.0 libboost-system1.74.0 libboost-thread1.74.0 \
expat liblua5.4-0 && \
rm -rf /var/lib/apt/lists/* && \
# add /usr/local/lib to ldconfig to allow loading libraries from there
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
/usr/local/bin/osrm-routed --help && \
/usr/local/bin/osrm-contract --help && \
/usr/local/bin/osrm-partition --help && \
/usr/local/bin/osrm-customize --help
WORKDIR /opt
EXPOSE 5000

1
docker/Dockerfile Symbolic link
View File

@ -0,0 +1 @@
Dockerfile-debian

79
docker/Dockerfile-alpine Normal file
View File

@ -0,0 +1,79 @@
FROM alpine:3.21.2 AS alpine-mimalloc
RUN apk update && \
apk upgrade && \
apk add --no-cache \
boost-iostreams \
boost-program_options \
boost-thread \
mimalloc
ENV LD_PRELOAD=/usr/lib/libmimalloc.so.2
ENV MIMALLOC_LARGE_OS_PAGES=1
FROM alpine-mimalloc AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src /opt && \
apk add --no-cache \
boost-dev \
boost-filesystem \
clang \
cmake \
expat-dev \
git \
libbz2 \
libxml2 \
lua5.4-dev \
make \
onetbb-dev
COPY . /src
WORKDIR /src
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \
cd build && \
BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=OFF && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
strip /usr/local/bin/* && \
rm -rf /src
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM alpine-mimalloc AS runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apk add --no-cache \
boost-date_time \
expat \
lua5.4 \
onetbb && \
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
/usr/local/bin/osrm-routed --help && \
/usr/local/bin/osrm-contract --help && \
/usr/local/bin/osrm-partition --help && \
/usr/local/bin/osrm-customize --help
WORKDIR /opt
EXPOSE 5000

76
docker/Dockerfile-debian Normal file
View File

@ -0,0 +1,76 @@
FROM debian:bookworm-slim AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src /opt && \
apt-get update && \
apt-get -y --no-install-recommends --no-install-suggests install \
ca-certificates \
cmake \
g++ \
gcc \
git \
libboost1.81-all-dev \
libbz2-dev \
liblua5.4-dev \
libtbb-dev \
libxml2-dev \
libzip-dev \
lua5.4 \
make \
pkg-config
COPY . /src
WORKDIR /src
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
export CXXFLAGS="-Wno-array-bounds -Wno-uninitialized -Wno-stringop-overflow" && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \
cd build && \
BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
strip /usr/local/bin/* && \
rm -rf /src
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM debian:bookworm-slim AS runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
expat \
libboost-date-time1.81.0 \
libboost-iostreams1.81.0 \
libboost-program-options1.81.0 \
libboost-thread1.81.0 \
liblua5.4-0 \
libtbb12 && \
rm -rf /var/lib/apt/lists/* && \
# Add /usr/local/lib to ldconfig to allow loading libraries from there
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
/usr/local/bin/osrm-routed --help && \
/usr/local/bin/osrm-contract --help && \
/usr/local/bin/osrm-partition --help && \
/usr/local/bin/osrm-customize --help
WORKDIR /opt
EXPOSE 5000

6
docker/hooks/build Normal file → Executable file
View File

@ -6,4 +6,8 @@
# ensure that "COPY . /src" is referring to the repo root, not the directory
# that contains the Dockerfile.
# This script gets executed with a pwd of wherever the Dockerfile is.
docker build --build-arg BUILD_CONCURRENCY=${CONCURRENCY:-1} --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..
DOCKER_BUILD="docker build --build-arg BUILD_CONCURRENCY=${CONCURRENCY} --build-arg DOCKER_TAG=${DOCKER_TAG:?unset} -t ${IMAGE_NAME:?unset} -f"
$DOCKER_BUILD Dockerfile ..
$DOCKER_BUILD Dockerfile-alpine ..

View File

@ -32,9 +32,9 @@ For outputting data into our file (debug.geojson), we simply need to call the ma
### Possible Scopeguard Location
Think of the scopeguard as you would do of any reference. If you wan't to access to logging during a call, the guard object must be alive and valid.
As an example: a good location to create the a scopeguard to log decisions in the edge-based-graph-factory would be right before we run it ([here](https://github.com/Project-OSRM/osrm-backend/blob/a933b5d94943bf3edaf42c84a614a99650d23cba/src/extractor/extractor.cpp#L497)). If you put `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", node_coordinate_vector);` at that location, you can then print `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);` anywhere within the `edge-based-graph-factory`.
As an example: a good location to create a scopeguard to log decisions in the edge-based-graph-factory would be right before we run it ([here](https://github.com/Project-OSRM/osrm-backend/blob/a933b5d94943bf3edaf42c84a614a99650d23cba/src/extractor/extractor.cpp#L497)). If you put `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", node_coordinate_vector);` at that location, you can then print `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);` anywhere within the `edge-based-graph-factory`.
This location would enable call for all guidance related pre-processing which is called in the edge-based-graph-factory.
This location would enable calls for all guidance related pre-processing which is called in the edge-based-graph-factory.
Logging any turn-handler decisions, for example, would now be possible.
## Limitations

View File

@ -35,7 +35,7 @@ To pass parameters to each location some options support an array-like encoding:
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curbside. |
|approaches |`{approach};{approach}[;{approach} ...]` |Restrict the direction on the road network at a waypoint, relative to the input coordinate. |
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, the order does not matter. |
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of the response and do not want to transfer waste data. |
@ -47,7 +47,7 @@ Where the elements follow the following format:
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|radius |`double >= 0` or `unlimited` (default) |
|hint |Base64 `string` |
|approach |`curb` or `unrestricted` (default) |
|approach |`curb`, `opposite` or `unrestricted` (default) |
|class |A class name determined by the profile or `none`. |
```
@ -92,6 +92,7 @@ Every response object has a `code` property containing one of the strings below
| `InvalidValue` | The successfully parsed query parameters are invalid. |
| `NoSegment` | One of the supplied input coordinates could not snap to the street segment. |
| `TooBig` | The request size violates one of the service-specific request size restrictions. |
| `DisabledDataset` | The request tried to access a disabled dataset. |
- `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`.
@ -648,10 +649,10 @@ Represents a route between two waypoints.
- `distance`: The distance traveled by this route leg, in `float` meters.
- `duration`: The estimated travel time, in `float` number of seconds.
- `weight`: The calculated weight of the route leg.
- `summary`: Summary of the route taken as `string`. Depends on the `summary` parameter:
- `summary`: Summary of the route taken as `string`. Depends on the `steps` parameter:
| summary | |
|--------------|-----------------------------------------------------------------------|
| steps | |
|-------|-----------------------------------------------------------------------|
| true | Names of the two major roads used. Can be empty if the route is too short.|
| false | empty `string` |

View File

@ -21,7 +21,7 @@ var osrm = new OSRM('network.osrm');
**Parameters**
- `options` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`)
- `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'.
- `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', or 'MLD'. Default is 'CH'.
Make sure you prepared the dataset with the correct toolchain.
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
@ -31,6 +31,7 @@ var osrm = new OSRM('network.osrm');
Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`.
- `options.mmap_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
- `options.path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
- `options.disable_feature_dataset` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Disables a feature dataset from being loaded into memory if not needed. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`.
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
@ -38,6 +39,7 @@ var osrm = new OSRM('network.osrm');
- `options.max_radius_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. radius size supported in map matching query (default: 5).
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
- `options.max_alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternatives supported in alternative routes query (default: 3).
- `options.default_radius` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Default radius for queries (default: unlimited).
### route
@ -61,7 +63,7 @@ Returns the fastest route between two or more coordinates while visiting the way
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
`null`/`true`/`false`
- `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
@ -99,7 +101,7 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
Must be an integer greater than or equal to `1`. (optional, default `1`)
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
@ -139,7 +141,7 @@ Optionally returns distance table.
- `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use
location with given index as source. Default is to use all.
- `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate.. Can be `null` (unrestricted, default), `curb` or `opposite`.
- `options.fallback_speed` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points.
- `options.scale_factor` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
@ -248,7 +250,7 @@ osrm.match(options, function(err, response) {
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) 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.
If the trace point was omitted by map matching because it is an outlier, the entry will be null.
Each `Waypoint` object has the following additional properties,
1) `matchings_index`: Index to the
[`Route`](#route) object in matchings the sub-trace was matched to,
@ -296,7 +298,7 @@ Right now, the following combinations are possible:
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
- `options.source` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
- `options.destination` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**

View File

@ -113,7 +113,7 @@ excludable | Sequence of Sets | Determines which class
classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function.
restrictions | Sequence | Determines which turn restrictions will be used for this profile.
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
relation_types | Sequence | Determines wich relations should be cached for processing in this profile. It contains relations types
relation_types | Sequence | Determines which relations should be cached for processing in this profile. It contains relations types
### process_node(profile, node, result, relations)
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
@ -349,7 +349,7 @@ The input data must an ASCII file with rows of integers. e.g.:
In your `segment_function` you can then access the raster source and use `raster:query()` to query to find the nearest data point, or `raster:interpolate()` to interpolate a value based on nearby data points.
You must check whether the result is valid before use it.
You must check whether the result is valid before using it.
Example:

View File

@ -300,7 +300,7 @@ And the relations
The setting looks perfectly fine at first glance. However, it is not well defined.
The forbidden right turn could be either a superfluous addition, forbidding the turn `cb` to `be`, or actually refer to the turn `ab` to `bd` to say that a turn is forbidden here.
To model turn-restrictions correctly and unique, we need to split segments that contribute to the restriction into the smallest possible parts.
To model turn-restrictions correctly and uniquely, we need to split segments that contribute to the restriction into the smallest possible parts.
E.g. the above scenario could correctly be expressed as:
```
@ -360,7 +360,7 @@ When I route I should get
And the test reports `turn right` for the route `a->e`, where before it said `slight right`.
If you changed the turn angles, obviously you can expect changes in the distinction between `slight right` and `right`.
If you change the turn angles, obviously you can expect changes in the distinction between `slight right` and `right`.
In such a case it is, of course, reasonable to change the expected route to report `right` instead of `slight right`. You should consider inspecting the actual turn angles at `b` to see if you feel that change is justified.
However, you should never adjust the test itself.
@ -390,9 +390,9 @@ In this case we would see a very slight turn angle. If your change now reports d
### Consider Post-Processing Impacts
Some changes you might see could look completely unrelated. To understand the impact of your changes, you can make use of the debugging utilities you can finde in `util/debug.hpp` (and potentially other related headers).
Some changes you might see could look completely unrelated. To understand the impact of your changes, you can make use of the debugging utilities you can find in `util/debug.hpp` (and potentially other related headers).
If your test is inspecting a series of turns (remember, a turn not necessarily equals an instruction), you could see interaction with post-processing.
If your test is inspecting a series of turns (remember, a turn does not necessarily equals an instruction), you could see interaction with post-processing.
To see the unprocessed turns, you should print the steps at the end of step assembly (`assembleSteps` in `engine/guidance/assemble_steps.hpp`).
If you see unexpected changes, you can consider adding the `locations` field to your test to study what location a turn is reported at.

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.8)
cmake_minimum_required(VERSION 3.18)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed.
@ -12,20 +12,18 @@ endif()
project(osrm-example C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bitness 64)
message(STATUS "Building on a 64 bit system")
else()
message(STATUS "Building on a 32 bit system")
endif()
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)

View File

@ -57,15 +57,15 @@ int main(int argc, const char *argv[])
// Execute routing request, this does the heavy lifting
const auto status = osrm.Route(params, result);
auto &json_result = result.get<json::Object>();
auto &json_result = std::get<json::Object>(result);
if (status == Status::Ok)
{
auto &routes = json_result.values["routes"].get<json::Array>();
auto &routes = std::get<json::Array>(json_result.values["routes"]);
// Let's just use the first route
auto &route = routes.values.at(0).get<json::Object>();
const auto distance = route.values["distance"].get<json::Number>().value;
const auto duration = route.values["duration"].get<json::Number>().value;
auto &route = std::get<json::Object>(routes.values.at(0));
const auto distance = std::get<json::Number>(route.values["distance"]).value;
const auto duration = std::get<json::Number>(route.values["duration"]).value;
// Warn users if extract does not contain the default coordinates from above
if (distance == 0 || duration == 0)
@ -80,8 +80,8 @@ int main(int argc, const char *argv[])
}
else if (status == Status::Error)
{
const auto code = json_result.values["code"].get<json::String>().value;
const auto message = json_result.values["message"].get<json::String>().value;
const auto code = std::get<json::String>(json_result.values["code"]).value;
const auto message = std::get<json::String>(json_result.values["message"]).value;
std::cout << "Code: " << code << "\n";
std::cout << "Message: " << code << "\n";

View File

@ -78,6 +78,15 @@ Feature: Bike - Accessability of different way types
| construction | yes | | |
| construction | | yes | |
@proposed
Scenario: Bike - Don't allow routing on ways still being proposed
Then routability should be
| highway | foot | bicycle | proposed | bothw |
| primary | | | | x |
| proposed | | | | |
| proposed | yes | | yes | |
| proposed | | yes | yes | |
@roundabout
Scenario: Bike - Don't push bikes against oneway flow on roundabouts
Then routability should be

View File

@ -39,7 +39,7 @@ Feature: Car - Handle traffic lights
| k | n | 20.7s | turn with traffic light |
Scenario: Car - Traffic signal direction
Scenario: Car - Traffic signal direction straight
Given the node map
"""
a-1-b-2-c
@ -66,25 +66,60 @@ Feature: Car - Handle traffic lights
| k | traffic_signals | backward |
When I route I should get
| from | to | time | # |
| 1 | 2 | 11.1s | no turn with no traffic light |
| 2 | 1 | 11.1s | no turn with no traffic light |
| 3 | 4 | 13.1s | no turn with traffic light |
| 4 | 3 | 13.1s | no turn with traffic light |
| 5 | 6 | 13.1s | no turn with traffic light |
| 6 | 5 | 11.1s | no turn with no traffic light |
| 7 | 8 | 11.1s | no turn with no traffic light |
| 8 | 7 | 13.1s | no turn with traffic light |
| from | to | time | weight | # |
| 1 | 2 | 11.1s | 11.1 | no turn with no traffic light |
| 2 | 1 | 11.1s | 11.1 | no turn with no traffic light |
| 3 | 4 | 13.1s | 13.1 | no turn with traffic light |
| 4 | 3 | 13.1s | 13.1 | no turn with traffic light |
| 5 | 6 | 13.1s | 13.1 | no turn with traffic light |
| 6 | 5 | 11.1s | 11.1 | no turn with no traffic light |
| 7 | 8 | 11.1s | 11.1 | no turn with no traffic light |
| 8 | 7 | 13.1s | 13.1 | no turn with traffic light |
Scenario: Car - Encounters a traffic light
Scenario: Car - Traffic signal direction with distance weight
Given the profile file "car" initialized with
"""
profile.properties.weight_name = 'distance'
profile.properties.traffic_light_penalty = 100000
"""
Given the node map
"""
a f k
| | |
b-c-d h-g-i l-m-n
| | |
e j o
a---b---c
1 2
| |
| |
| |
| |
| |
d-------f
"""
And the ways
| nodes | highway |
| abc | primary |
| adfc | primary |
And the nodes
| node | highway |
| b | traffic_signals |
When I route I should get
| from | to | time | distances | weight | # |
| 1 | 2 | 100033.2s | 599.9m,0m | 599.8 | goes via the expensive traffic signal |
Scenario: Car - Encounters a traffic light direction
Given the node map
"""
a f k p
| | | |
b-c-d h-g-i l-m-n q-r-s
| | | |
e j o t
"""
@ -96,53 +131,70 @@ Feature: Car - Handle traffic lights
| fgj | primary |
| lmn | primary |
| kmo | primary |
| qrs | primary |
| prt | primary |
And the nodes
| node | highway | traffic_signals:direction |
| g | traffic_signals | forward |
| m | traffic_signals | backward |
| g | traffic_signals | |
| m | traffic_signals | forward |
| r | traffic_signals | backward |
When I route I should get
# Base case
| from | to | time | # |
| a | d | 21.9s | no turn with no traffic light |
| a | e | 22.2s | no turn with traffic light |
| a | b | 18.7s | turn with no traffic light |
| e | b | 21.9s | no turn with no traffic light |
| e | a | 22.2s | no turn with traffic light |
| a | e | 22.2s | no turn with no traffic light |
| a | d | 21.9s | turn with no traffic light |
| e | b | 21.9s | turn with no traffic light |
| e | a | 22.2s | no turn with no traffic light |
| e | d | 18.7s | turn with no traffic light |
| d | e | 21.9s | no turn with no traffic light |
| d | b | 11s | no turn with traffic light |
| d | e | 21.9s | turn with no traffic light |
| d | b | 11s | no turn with no traffic light |
| d | a | 18.7s | turn with no traffic light |
| b | a | 21.9s | no turn with no traffic light |
| b | d | 11s | no turn with traffic light |
| b | a | 21.9s | turn with no traffic light |
| b | d | 11s | no turn with no traffic light |
| b | e | 18.7s | turn with no traffic light |
| f | i | 23.9s | no turn with no traffic light |
# All have traffic lights - 2s penalty
| f | h | 20.7s | turn with traffic light |
| f | j | 24.2s | no turn with traffic light |
| f | h | 20.7s | turn with no traffic light |
| j | h | 21.9s | no turn with no traffic light |
| j | f | 22.2s | no turn with traffic light |
| j | i | 18.7s | turn with no traffic light |
| i | j | 21.9s | no turn with no traffic light |
| i | h | 11s | no turn with traffic light |
| i | f | 18.7s | turn with no traffic light |
| h | f | 23.9s | no turn with no traffic light |
| f | i | 23.9s | turn with traffic light |
| j | h | 23.9s | turn with traffic light |
| j | f | 24.2s | no turn with traffic light |
| j | i | 20.7s | turn with traffic light |
| i | j | 23.9s | turn with traffic light |
| i | h | 13s | no turn with traffic light |
| i | f | 20.7s | turn with traffic light |
| h | f | 23.9s | turn with traffic light |
| h | i | 13s | no turn with traffic light |
| h | j | 20.7s | turn with no traffic light |
| k | n | 21.9s | no turn with no traffic light |
| k | o | 22.2s | no turn with traffic light |
| k | l | 18.7s | turn with no traffic light |
| o | l | 23.9s | no turn with no traffic light |
| o | k | 24.2s | no turn with traffic light |
| o | n | 20.7s | turn with no traffic light |
| n | o | 23.9s | no turn with no traffic light |
| n | l | 13s | no turn with traffic light |
| n | k | 20.7s | turn with no traffic light |
| l | k | 21.9s | no turn with no traffic light |
| l | n | 11s | no turn with traffic light |
| l | o | 18.7s | turn with no traffic light |
| h | j | 20.7s | turn with traffic light |
# Front direction have traffic lights - 2s penalty
| k | l | 20.7s | turn with traffic light |
| k | o | 24.2s | no turn with traffic light |
| k | n | 23.9s | turn with traffic light |
| o | l | 21.9s | turn with no traffic light |
| o | k | 22.2s | no turn with no traffic light |
| o | n | 18.7s | turn with no traffic light |
| n | o | 21.9s | turn with no traffic light |
| n | l | 11s | no turn with no traffic light |
| n | k | 18.7s | turn with no traffic light |
| l | k | 23.9s | turn with traffic light |
| l | n | 13s | no turn with traffic light |
| l | o | 20.7s | turn with traffic light |
# Reverse direction have traffic lights - 2s penalty
| p | q | 18.7s | turn with no traffic light |
| p | t | 22.2s | no turn with no traffic light |
| p | s | 21.9s | turn with no traffic light |
| t | q | 23.9s | turn with traffic light |
| t | p | 24.2s | no turn with traffic light |
| t | s | 20.7s | turn with traffic light |
| s | t | 23.9s | turn with traffic light |
| s | q | 13s | no turn with traffic light |
| s | p | 20.7s | turn with traffic light |
| q | p | 21.9s | turn with no traffic light |
| q | s | 11s | no turn with no traffic light |
| q | t | 18.7s | turn with no traffic light |
Scenario: Traffic Signal Geometry
@ -308,3 +360,106 @@ Feature: Car - Handle traffic lights
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
| a | c | abc,abc | 65 km/h | 22.2,0 | 22.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
Scenario: Car - Traffic signal straight direction with edge compression
Given the node map
"""
a-1-b - c - d-2-e
"""
And the ways
| nodes | highway |
| abcde | primary |
And the nodes
| node | highway | traffic_signals:direction |
| c | traffic_signals | forward |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 35.3s | 35.3 | no turn with traffic light |
| 2 | 1 | 33.3s | 33.3 | no turn with no traffic light |
Scenario: Car - Traffic signal turn direction with edge compression
Given the node map
"""
d
|
2
|
a-1-b - c - f
|
e
j
|
4
|
g-3-h - i - k
|
l
"""
And the ways
| nodes | highway |
| abc | primary |
| cf | primary |
| fd | primary |
| fe | primary |
| ghi | primary |
| ik | primary |
| kj | primary |
| kl | primary |
And the nodes
| node | highway | traffic_signals:direction |
| k | traffic_signals | forward |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 44.2s | 44.2 | turn with no traffic light |
| 2 | 1 | 41s | 41 | turn with no traffic light |
| 3 | 4 | 46.2s | 46.2 | turn with traffic light |
| 4 | 3 | 41s | 41 | turn with no traffic light |
Scenario: Car - Traffic signal turn direction with turn restriction
Given the node map
"""
d
|
2
|
a-1-b - c - f
|
e
"""
And the ways
| nodes | highway |
| abc | primary |
| cf | primary |
| fd | primary |
| fe | primary |
And the nodes
| node | highway | traffic_signals:direction |
| f | traffic_signals | forward |
And the relations
| type | way:from | way:to | way:via | restriction |
| restriction | abc | fe | cf | no_right_turn |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | df | fc | f | right_turn_only |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 46.2s | 46.2 | turn with traffic light |
| 2 | 1 | 41s | 41 | turn with no traffic light |

View File

@ -26,7 +26,15 @@ Feature: Foot - Access tags on ways
| motorway | no | | |
| motorway | no | yes | x |
| motorway | no | no | |
| platform | | | x |
| platform | | yes | x |
| platform | | no | |
| platform | yes | | x |
| platform | yes | yes | x |
| platform | yes | no | |
| platform | no | | |
| platform | no | yes | x |
| platform | no | no | |
Scenario: Foot - Overwriting implied acccess on ways
Then routability should be

View File

@ -36,3 +36,9 @@ Feature: Foot - Accessability of different way types
| highway | leisure | forw |
| (nil) | track | x |
Scenario: Foot - Proposed ways
Then routability should be
| highway | foot | proposed | forw |
| footway | | | x |
| proposed | | | |
| proposed | yes | yes | |

View File

@ -1061,7 +1061,7 @@ Feature: Collapse
# i
# """
And the node locations
Given the node locations
| node | lat | lon | #id |
| a | -33.9644254 | 151.1378673 | 33226063 |
| b | -33.9644373 | 151.1377172 | 1072787030 |

View File

@ -9,7 +9,7 @@ Feature: Basic Roundabout
"""
Scenario: Roundabout exit counting for left sided driving
And a grid size of 10 meters
Given a grid size of 10 meters
And the node map
"""
a
@ -33,7 +33,7 @@ Feature: Basic Roundabout
| a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive |
Scenario: Mixed Entry and Exit
And a grid size of 10 meters
Given a grid size of 10 meters
And the node map
"""
c a

View File

@ -68,8 +68,9 @@ class OSRMDirectLoader extends OSRMBaseLoader {
super(scope);
}
load (inputFile, callback) {
this.inputFile = inputFile;
load (ctx, callback) {
this.inputFile = ctx.inputFile;
this.loaderArgs = ctx.loaderArgs;
this.shutdown(() => {
this.launch(callback);
});
@ -78,7 +79,7 @@ class OSRMDirectLoader extends OSRMBaseLoader {
osrmUp (callback) {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
const command_arguments = util.format('%s -p %d -i %s -a %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM);
const command_arguments = util.format('%s -p %d -i %s -a %s %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM, this.loaderArgs);
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') {
this.child = null;
@ -101,8 +102,9 @@ class OSRMmmapLoader extends OSRMBaseLoader {
super(scope);
}
load (inputFile, callback) {
this.inputFile = inputFile;
load (ctx, callback) {
this.inputFile = ctx.inputFile;
this.loaderArgs = ctx.loaderArgs;
this.shutdown(() => {
this.launch(callback);
});
@ -111,7 +113,7 @@ class OSRMmmapLoader extends OSRMBaseLoader {
osrmUp (callback) {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
const command_arguments = util.format('%s -p %d -i %s -a %s --mmap', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM);
const command_arguments = util.format('%s -p %d -i %s -a %s --mmap %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM, this.loaderArgs);
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') {
this.child = null;
@ -134,8 +136,9 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
super(scope);
}
load (inputFile, callback) {
this.inputFile = inputFile;
load (ctx, callback) {
this.inputFile = ctx.inputFile;
this.loaderArgs = ctx.loaderArgs;
this.loadData((err) => {
if (err) return callback(err);
@ -148,7 +151,7 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
}
loadData (callback) {
const command_arguments = util.format('--dataset-name=%s %s', this.scope.DATASET_NAME, this.inputFile);
const command_arguments = util.format('--dataset-name=%s %s %s', this.scope.DATASET_NAME, this.inputFile, this.loaderArgs);
this.scope.runBin('osrm-datastore', command_arguments, this.scope.environment, (err) => {
if (err) return callback(new Error('*** osrm-datastore exited with ' + err.code + ': ' + err));
callback();

View File

@ -1,44 +0,0 @@
@prepare @options @help
Feature: osrm-contract command line options: help
Scenario: osrm-contract - Help should be shown when no options are passed
When I try to run "osrm-contract"
Then stderr should be empty
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--core"
And stdout should contain "--segment-speed-file"
And it should exit with an error
Scenario: osrm-contract - Help, short
When I run "osrm-contract -h"
Then stderr should be empty
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--core"
And stdout should contain "--segment-speed-file"
And it should exit successfully
Scenario: osrm-contract - Help, long
When I run "osrm-contract --help"
Then stderr should be empty
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--core"
And stdout should contain "--segment-speed-file"
And it should exit successfully

View File

@ -1,38 +0,0 @@
@contract @options @help
Feature: osrm-customize command line options: help
Scenario: osrm-customize - Help should be shown when no options are passed
When I try to run "osrm-customize"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit with an error
Scenario: osrm-customize - Help, short
When I run "osrm-customize -h"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit successfully
Scenario: osrm-customize - Help, long
When I run "osrm-customize --help"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit successfully

View File

@ -0,0 +1,141 @@
@routing @disable-feature-dataset
Feature: disable-feature-dataset command line options
Background:
Given the profile "testbot"
And the node map
"""
0
a b c
"""
And the ways
| nodes |
| ab |
| bc |
Scenario: disable-feature-dataset - geometry disabled error
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
# The default values
And the query options
| overview | simplified |
| annotations | false |
| steps | false |
| skip_waypoints | false |
When I route I should get
| from | to | code |
| a | c | DisabledDataset |
When I plan a trip I should get
| waypoints | code |
| a,b,c | DisabledDataset |
When I match I should get
| trace | code |
| abc | DisabledDataset |
Scenario: disable-feature-dataset - geometry disabled error table
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
When I request nearest I should get
| in | code |
| 0 | DisabledDataset |
When I request a travel time matrix with these waypoints I should get the response code
| waypoints | code |
| a,b,c | DisabledDataset |
Scenario: disable-feature-dataset - geometry disabled success
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
# No geometry values returned
And the query options
| overview | false |
| annotations | false |
| steps | false |
| skip_waypoints | true |
When I route I should get
| from | to | code |
| a | c | Ok |
When I plan a trip I should get
| waypoints | code |
| a,b,c | Ok |
When I match I should get
| trace | code |
| abc | Ok |
Scenario: disable-feature-dataset - geometry disabled error table
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
And the query options
| skip_waypoints | true |
# You would never do this, but just to prove the point.
When I request nearest I should get
| in | code |
| 0 | Ok |
When I request a travel time matrix with these waypoints I should get the response code
| waypoints | code |
| a,b,c | Ok |
Scenario: disable-feature-dataset - steps disabled error
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
# Default + annotations, steps
And the query options
| overview | simplified |
| annotations | true |
| steps | true |
When I route I should get
| from | to | code |
| a | c | DisabledDataset |
When I plan a trip I should get
| waypoints | code |
| a,b,c | DisabledDataset |
When I match I should get
| trace | code |
| abc | DisabledDataset |
Scenario: disable-feature-dataset - geometry disabled error table
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
When I request nearest I should get
| in | code |
| 0 | Ok |
When I request a travel time matrix with these waypoints I should get the response code
| waypoints | code |
| a,b,c | Ok |
Scenario: disable-feature-dataset - steps disabled success
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
# Default + steps
And the query options
| overview | simplified |
| annotations | true |
| steps | false |
When I route I should get
| from | to | code |
| a | c | Ok |
When I plan a trip I should get
| waypoints | code |
| a,b,c | Ok |
When I match I should get
| trace | code |
| abc | Ok |

View File

@ -33,10 +33,6 @@ Feature: osrm-datastore command line options
When I try to run "osrm-datastore {processed_file} --dataset-name cucumber/only_metric_test --only-metric"
Then it should exit successfully
Scenario: osrm-datastore - Displaying help should work
When I try to run "osrm-datastore {processed_file} --help"
Then it should exit successfully
Scenario: osrm-datastore - Errors on invalid path
When I try to run "osrm-datastore invalid_path.osrm"
Then stderr should contain "[error] Config contains invalid file paths."

View File

@ -1,47 +0,0 @@
@extract @options @help
Feature: osrm-extract command line options: help
Background:
Given the profile "testbot"
Scenario: osrm-extract - Help should be shown when no options are passed
When I run "osrm-extract"
Then stderr should be empty
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads"
And stdout should contain "--small-component-size"
And it should exit successfully
Scenario: osrm-extract - Help, short
When I run "osrm-extract -h"
Then stderr should be empty
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads"
And stdout should contain "--small-component-size"
And it should exit successfully
Scenario: osrm-extract - Help, long
When I run "osrm-extract --help"
Then stderr should be empty
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads"
And stdout should contain "--small-component-size"
And it should exit successfully

View File

@ -154,3 +154,27 @@ Feature: osrm-extract lua ways:get_nodes()
Then it should exit successfully
And stdout should contain "node 42"
And stdout should contain "way 42"
Scenario: osrm-extract flags accessible in process_segment function
Given the profile file
"""
functions = require('testbot')
functions.process_segment = function (profile, segment)
print('segment forward ' .. tostring(segment.flags.forward) .. ' backward ' .. tostring(segment.flags.backward))
end
return functions
"""
And the node map
"""
a b
"""
And the ways
| nodes | oneway |
| ab | yes |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "segment forward true backward false"

View File

@ -1,53 +0,0 @@
@partition @options @help
Feature: osrm-partition command line options: help
Scenario: osrm-partition - Help should be shown when no options are passed
When I try to run "osrm-partition"
Then stderr should be empty
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--balance"
And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size"
And stdout should contain "--max-cell-sizes"
And it should exit with an error
Scenario: osrm-partition - Help, short
When I run "osrm-partition -h"
Then stderr should be empty
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--balance"
And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size"
And stdout should contain "--max-cell-sizes"
And it should exit successfully
Scenario: osrm-partition - Help, long
When I run "osrm-partition --help"
Then stderr should be empty
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--balance"
And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size"
And stdout should contain "--max-cell-sizes"
And it should exit successfully

View File

@ -1,65 +0,0 @@
@routed @options @help
Feature: osrm-routed command line options: help
Background:
Given the profile "testbot"
Scenario: osrm-routed - Help should be shown when no options are passed
When I run "osrm-routed"
Then stderr should be empty
And stdout should contain /osrm-routed(.exe)? <base.osrm> \[<options>\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "--trial"
And stdout should contain "Configuration:"
And stdout should contain "--ip"
And stdout should contain "--port"
And stdout should contain "--threads"
And stdout should contain "--shared-memory"
And stdout should contain "--max-viaroute-size"
And stdout should contain "--max-trip-size"
And stdout should contain "--max-table-size"
And stdout should contain "--max-matching-size"
And it should exit successfully
Scenario: osrm-routed - Help, short
When I run "osrm-routed -h"
Then stderr should be empty
And stdout should contain /osrm-routed(.exe)? <base.osrm> \[<options>\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "--trial"
And stdout should contain "Configuration:"
And stdout should contain "--ip"
And stdout should contain "--port"
And stdout should contain "--threads"
And stdout should contain "--shared-memory"
And stdout should contain "--max-viaroute-size"
And stdout should contain "--max-trip-size"
And stdout should contain "--max-table-size"
And stdout should contain "--max-matching-size"
And it should exit successfully
Scenario: osrm-routed - Help, long
When I run "osrm-routed --help"
Then stderr should be empty
And stdout should contain /osrm-routed(.exe)? <base.osrm> \[<options>\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "--trial"
And stdout should contain "Configuration:"
And stdout should contain "--ip"
And stdout should contain "--port"
And stdout should contain "--threads"
And stdout should contain "--shared-memory"
And stdout should contain "--max-trip-size"
And stdout should contain "--max-table-size"
And stdout should contain "--max-table-size"
And stdout should contain "--max-matching-size"
And it should exit successfully

View File

@ -33,6 +33,11 @@ module.exports = function () {
callback();
});
this.Given(/^the data load extra arguments "(.*?)"$/, (args, callback) => {
this.loaderArgs = this.expandOptions(args);
callback();
});
this.Given(/^a grid size of ([0-9.]+) meters$/, (meters, callback) => {
this.setGridSize(meters);
callback();

View File

@ -5,6 +5,7 @@ var FBResult = require('../support/fbresult_generated').osrm.engine.api.fbresult
module.exports = function () {
const durationsRegex = new RegExp(/^I request a travel time matrix I should get$/);
const durationsCodeOnlyRegex = new RegExp(/^I request a travel time matrix with these waypoints I should get the response code$/);
const distancesRegex = new RegExp(/^I request a travel distance matrix I should get$/);
const estimatesRegex = new RegExp(/^I request a travel time matrix I should get estimates for$/);
const durationsRegexFb = new RegExp(/^I request a travel time matrix with flatbuffers I should get$/);
@ -17,6 +18,7 @@ module.exports = function () {
const FORMAT_FB = 'flatbuffers';
this.When(durationsRegex, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_JSON, callback);}.bind(this));
this.When(durationsCodeOnlyRegex, function(table, callback) {tableCodeOnlyParse.call(this, table, 'durations', FORMAT_JSON, callback);}.bind(this));
this.When(distancesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'distances', FORMAT_JSON, callback);}.bind(this));
this.When(estimatesRegex, function(table, callback) {tableParse.call(this, table, DISTANCES_NO_ROUTE, 'fallback_speed_cells', FORMAT_JSON, callback);}.bind(this));
this.When(durationsRegexFb, function(table, callback) {tableParse.call(this, table, DURATIONS_NO_ROUTE, 'durations', FORMAT_FB, callback);}.bind(this));
@ -27,6 +29,64 @@ const durationsParse = function(v) { return isNaN(parseInt(v)); };
const distancesParse = function(v) { return isNaN(parseFloat(v)); };
const estimatesParse = function(v) { return isNaN(parseFloat(v)); };
function tableCodeOnlyParse(table, annotation, format, callback) {
const params = this.queryParams;
params.annotations = ['durations','fallback_speed_cells'].indexOf(annotation) !== -1 ? 'duration' : 'distance';
params.output = format;
var got;
this.reprocessAndLoadData((e) => {
if (e) return callback(e);
var testRow = (row, ri, cb) => {
var afterRequest = (err, res) => {
if (err) return cb(err);
for (var k in row) {
var match = k.match(/param:(.*)/);
if (match) {
if (row[k] === '(nil)') {
params[match[1]] = null;
} else if (row[k]) {
params[match[1]] = [row[k]];
}
got[k] = row[k];
}
}
var json;
got.code = 'unknown';
if (res.body.length) {
json = JSON.parse(res.body);
got.code = json.code;
}
cb(null, got);
};
var params = this.queryParams,
waypoints = [];
if (row.waypoints) {
row.waypoints.split(',').forEach((n) => {
var node = this.findNodeByName(n);
if (!node) throw new Error(util.format('*** unknown waypoint node "%s"', n.trim()));
waypoints.push({ coord: node, type: 'loc' });
});
got = { waypoints: row.waypoints };
this.requestTable(waypoints, params, afterRequest);
} else {
throw new Error('*** no waypoints');
}
};
this.processRowsAndDiff(table, testRow, callback);
});
}
function tableParse(table, noRoute, annotation, format, callback) {
const parse = annotation == 'distances' ? distancesParse : (annotation == 'durations' ? durationsParse : estimatesParse);
@ -62,9 +122,6 @@ function tableParse(table, noRoute, annotation, format, callback) {
});
}
var actual = [];
actual.push(table.headers);
this.reprocessAndLoadData((e) => {
if (e) return callback(e);
// compute matrix

View File

@ -12,25 +12,31 @@ module.exports = function () {
var inNode = this.findNodeByName(row.in);
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
var outNode = this.findNodeByName(row.out);
if (!outNode) throw new Error(util.format('*** unknown out-node "%s"', row.out));
this.requestNearest(inNode, this.queryParams, (err, response) => {
if (err) return cb(err);
var coord;
var headers = new Set(table.raw()[0]);
if (response.statusCode === 200 && response.body.length) {
var got = { in: row.in};
if (response.body.length) {
var json = JSON.parse(response.body);
got.code = json.code;
coord = json.waypoints[0].location;
var got = { in: row.in, out: row.out };
if (response.statusCode === 200) {
if (headers.has('data_version')) {
got.data_version = json.data_version || '';
}
if (json.waypoints && json.waypoints.length && row.out) {
coord = json.waypoints[0].location;
got.out = row.out;
var outNode = this.findNodeByName(row.out);
if (!outNode) throw new Error(util.format('*** unknown out-node "%s"', row.out));
Object.keys(row).forEach((key) => {
if (key === 'out') {
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
@ -40,7 +46,9 @@ module.exports = function () {
}
}
});
}
}
cb(null, got);
}
else {

View File

@ -91,7 +91,7 @@ module.exports = function () {
var encodedResult = '';
if (json.trips) row.trips.split(',').forEach((sub, si) => {
if (json.trips && row.trips) row.trips.split(',').forEach((sub, si) => {
if (si >= subTrips.length) {
ok = false;
} else {
@ -134,7 +134,6 @@ module.exports = function () {
} else {
var params = this.queryParams,
waypoints = [];
params['steps'] = 'true';
if (row.from && row.to) {
var fromNode = this.findNodeByName(row.from);
if (!fromNode) throw new Error(util.format('*** unknown from-node "%s"', row.from));

View File

@ -280,10 +280,11 @@ module.exports = function () {
};
this.reprocessAndLoadData = (callback) => {
let p = {loaderArgs: this.loaderArgs, inputFile: this.processedCacheFile};
let queue = d3.queue(1);
queue.defer(this.writeAndLinkOSM.bind(this));
queue.defer(this.extractContractPartitionAndCustomize.bind(this));
queue.defer(this.osrmLoader.load.bind(this.osrmLoader), this.processedCacheFile);
queue.defer(this.osrmLoader.load.bind(this.osrmLoader), p);
queue.awaitAll(callback);
};

View File

@ -27,7 +27,8 @@ module.exports = function () {
this.DEFAULT_ENVIRONMENT = process.env;
this.DEFAULT_PROFILE = 'bicycle';
this.DEFAULT_INPUT_FORMAT = 'osm';
this.DEFAULT_LOAD_METHOD = process.argv[process.argv.indexOf('-m') +1].match('mmap') ? 'mmap' : 'datastore';
let loadMethod = process.argv[process.argv.indexOf('-m') +1];
this.DEFAULT_LOAD_METHOD = loadMethod.match('mmap') ? 'mmap' : loadMethod.match('directly') ? 'directly' : 'datastore';
this.DEFAULT_ORIGIN = [1,1];
this.OSM_USER = 'osrm';
this.OSM_UID = 1;
@ -41,7 +42,7 @@ module.exports = function () {
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10;
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0;
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.1;
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;

View File

@ -37,6 +37,7 @@ module.exports = function () {
this.contractArgs = '';
this.partitionArgs = '';
this.customizeArgs = '';
this.loaderArgs = '';
this.environment = Object.assign(this.DEFAULT_ENVIRONMENT);
this.resetOSM();

View File

@ -101,7 +101,8 @@ module.exports = function () {
this.requestTrip = (waypoints, userParams, callback) => {
var defaults = {
output: 'json'
output: 'json',
steps: 'true'
},
params = this.overwriteParams(defaults, userParams);

View File

@ -40,7 +40,7 @@ Feature: Alternative route
| 7 | 8 | ca,ab,bd,dc,ca,ca | |
@mld-only
@mld
Scenario: Alternative loop paths on a single node with an asymmetric circle
# The test checks only MLD implementation, alternatives results are unpredictable for CH on windows (#4691, #4693)
Given a grid size of 10 meters

View File

@ -115,4 +115,4 @@ Feature: Annotations
When I route I should get
| from | to | route | a:speed | a:distance | a:duration | a:nodes |
| a | c | abc,abc | 10:10 | 249.987618946:299.962882039 | 25:30 | 1:2:3 |
| a | c | abc,abc | 10:10 | 249.9876189:299.962882 | 25:30 | 1:2:3 |

View File

@ -38,7 +38,41 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc |
Scenario: Start End opposite approach, option unrestricted for Start and End
Scenario: Start End same approach, option unrestricted for Start and opposite for End
Given the profile "testbot"
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc |
Scenario: Start End same approach, option opposite for Start and curb for End
Given the profile "testbot"
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | opposite curb | ab,bc,bc |
Scenario: Start End different approach, option unrestricted for Start and End
Given the profile "testbot"
And the node map
"""
@ -56,7 +90,7 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Start End opposite approach, option unrestricted for Start and curb for End
Scenario: Start End different approach, option unrestricted for Start and curb for End
Given the profile "testbot"
And the node map
"""
@ -74,6 +108,43 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
Scenario: Start End different approach, option unrestricted for Start and opposite for End
Given the profile "testbot"
And the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc,bc |
Scenario: Start End different approach, option curb for Start and opposite for End
Given the profile "testbot"
And the node map
"""
e
a------b------c-----------d
s
"""
And the ways
| nodes |
| ab |
| bc |
| cd |
When I route I should get
| from | to | approaches | route |
| s | e | curb opposite | cd,cd,ab,ab |
###############
# Oneway Test #
@ -114,7 +185,41 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
Scenario: Test on oneway segment, Start End same approach, option unrestricted for Start and opposite for End
Given the profile "testbot"
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc |
Scenario: Test on oneway segment, Start End same approach, option opposite for Start and curb for End
Given the profile "testbot"
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | opposite curb | ab,bc |
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and End
Given the profile "testbot"
And the node map
"""
@ -132,7 +237,7 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and curb for End
Given the profile "testbot"
And the node map
"""
@ -150,6 +255,42 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
Scenario: Test on oneway segment, Start End different approach, option unrestricted for Start and opposite for End
Given the profile "testbot"
And the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc |
Scenario: Test on oneway segment, Start End different approach, option curb for Start and opposite for End
Given the profile "testbot"
And the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | curb opposite | ab,bc |
##############
# UTurn Test #
##############
@ -175,6 +316,27 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted curb | |
Scenario: UTurn test, router can find a route because uturn authorized to reach opposite side
Given the profile "testbot"
And the node map
"""
e s
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | bc | c | no_u_turn |
When I route I should get
| from | to | approaches | route |
| s | e | curb opposite | bc,ab,ab |
Scenario: UTurn test, router can find a route because he can use the roundabout
Given the profile "testbot"
@ -200,6 +362,7 @@ Feature: Approach parameter
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc |
| s | e | opposite curb | ab,bc,bc |
Scenario: Start End same approach, option unrestricted for Start and curb for End, left-hand driving
@ -228,6 +391,32 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
Scenario: Start End same approach, option unrestricted for Start and opposite for End, left-hand driving
Given the profile file
"""
local functions = require('testbot')
local testbot_process_way = functions.process_way
functions.process_way = function(profile, way, result)
testbot_process_way(profile, way, result)
result.is_left_hand_driving = true
end
return functions
"""
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc,bc |
#######################
# Left-side countries #
@ -260,9 +449,8 @@ Feature: Approach parameter
"""
And the node map
"""
s
s e
a------b------c
e
"""
And the ways
@ -272,9 +460,49 @@ Feature: Approach parameter
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc |
| s | e | unrestricted curb | ab,bc |
Scenario: [Left-hand-side] Start End opposite approach, option unrestricted for Start and End
Scenario: [Left-hand-side] Start End same approach, option unrestricted for Start and opposite for End
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
"""
And the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc,bc |
Scenario: [Left-hand-side] Start End same approach, option opposite for Start and curb for End
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
"""
And the node map
"""
e s
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | opposite curb | bc,ab,ab |
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and End
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
@ -295,15 +523,16 @@ Feature: Approach parameter
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: [Left-hand-side] Start End opposite approach, option unrestricted for Start and curb for End
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and curb for End
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
"""
And the node map
"""
s e
s
a------b------c
e
"""
And the ways
@ -313,4 +542,121 @@ Feature: Approach parameter
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
| s | e | unrestricted curb | ab,bc,bc |
Scenario: [Left-hand-side] Start End different approach, option unrestricted for Start and opposite for End
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
"""
And the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted opposite | ab,bc |
Scenario: [Left-hand-side] Start End different approach, option curb for Start and opposite for End
Given the profile file "car" initialized with
"""
profile.properties.left_hand_driving = true
"""
And the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | curb opposite | ab,bc |
Scenario: Routes with more than two waypoints - uturns allowed
Given the profile "testbot"
And the node map
"""
2 1
a------b------c-----------d
|
3 | 4
e------f------g-----------h
|
|
i
"""
And the ways
| nodes |
| ab |
| bc |
| cd |
| bf |
| ef |
| fg |
| gh |
| ei |
And the query options
| continue_straight | false |
When I route I should get
| waypoints | approaches | locations | # |
| 1,2,3,4 | curb curb curb curb | _,_,_,a,b,f,_,_,i,h,_ | 1,2,2,a,b,f,3,3,i,h,4 (Only u-turn at end of roads) |
| 1,2,3,4 | curb unrestricted unrestricted curb | _,_,_,b,f,_,_,h,_ | 1,2,2,b,f,3,3,h,4 (Can u-turn at 2 and 3) |
| 1,2,3,4 | opposite opposite opposite opposite | _,d,a,_,_,b,f,i,_,_,_ | 1,d,a,2,2,b,f,i,3,3,4 (Only u-turn at end of roads) |
| 1,2,3,4 | opposite unrestricted unrestricted opposite | _,d,_,_,b,f,_,_,_ | 1,d,2,2,b,f,3,3,4 (Can u-turn at 2 and 3) |
Scenario: Routes with more than two waypoints - uturns forbidden
Given the profile "testbot"
And the node map
"""
2 1
a------b------c-----------d
|
3 | 4
e------f------g-----------h
|
|
i
"""
And the ways
| nodes |
| ab |
| bc |
| cd |
| bf |
| ef |
| fg |
| gh |
| ei |
And the query options
| continue_straight | true |
When I route I should get
| waypoints | approaches | locations | # |
| 1,2,3,4 | curb curb curb curb | _,_,_,a,b,f,_,_,i,h,_ | 1,2,2,a,b,f,3,3,i,h,4 (Only u-turn at end of roads) |
| 1,2,3,4 | curb opposite opposite curb | _,a,_,_,b,f,i,_,_,h,_ | 1,a,2,2,b,f,i,3,3,h,4 (switches stops with u-turns) |
| 1,2,3,4 | opposite opposite opposite opposite | _,d,a,_,_,b,f,i,_,_,_ | 1,d,a,2,2,b,f,i,3,3,4 (Only u-turn at end of roads) |
| 1,2,3,4 | opposite curb curb opposite | _,d,_,_,a,b,f,_,_,i,_ | 1,d,2,2,a,b,f,3,3,i,4 (switches stops with u-turns) |

View File

@ -0,0 +1,101 @@
@routing @testbot @via
Feature: Force routing steps
Background:
Given the profile "testbot"
Scenario: Direct routes with waypoints on same edge
Given the node map
"""
1 2
a-------b
| |
d-------c
| |
e-------f
3 4
"""
And the ways
| nodes | oneway |
| ab | no |
| ad | no |
| bc | no |
| cf | no |
| dc | no |
| de | no |
| ef | yes |
When I route I should get
| waypoints | approaches | weight | route |
| 1,2 | | 20 | ab,ab |
| 1,2 | curb curb | 100 | ab,ad,dc,bc,ab |
| 2,1 | | 20 | ab,ab |
| 2,1 | opposite opposite | 100 | ab,bc,dc,ad,ab |
| 3,4 | | 20 | ef,ef |
| 4,3 | | 100 | ef,cf,dc,de,ef |
Scenario: Via routes with waypoints on same edge
Given the node map
"""
1 2
a-------b
| |
d-5-----c
| |
e-------f
3 4
"""
And the ways
| nodes | oneway |
| ab | no |
| ad | no |
| bc | no |
| cf | no |
| dc | no |
| de | no |
| ef | yes |
When I route I should get
| waypoints | approaches | weight | route |
| 5,1,2 | | 59.8 | dc,ad,ab,ab,ab |
| 5,1,2 | unrestricted curb curb | 180.2 | dc,bc,ab,ab,ab,ad,dc,bc,ab |
| 5,2,1 | | 80.2 | dc,bc,ab,ab,ab |
| 5,2,1 | unrestricted opposite opposite | 159.8 | dc,ad,ab,ab,ab,bc,dc,ad,ab |
| 5,3,4 | | 59.8 | dc,de,ef,ef,ef |
| 5,4,3 | | 159.8 | dc,de,ef,ef,ef,cf,dc,de,ef |
Scenario: [U-turns allowed] Via routes with waypoints on same edge
Given the node map
"""
1 2
a-------b
| |
d-5-----c
| |
e-------f
3 4
"""
And the ways
| nodes | oneway |
| ab | no |
| ad | no |
| bc | no |
| cf | no |
| dc | no |
| de | no |
| ef | yes |
And the query options
| continue_straight | false |
When I route I should get
| waypoints | approaches | weight | route |
| 5,1,2 | | 59.8 | dc,ad,ab,ab,ab |
| 5,1,2 | unrestricted curb curb | 180.2 | dc,bc,ab,ab,ab,ad,dc,bc,ab |
| 5,2,1 | | 79.8 | dc,ad,ab,ab,ab,ab |
| 5,2,1 | unrestricted opposite opposite | 159.8 | dc,ad,ab,ab,ab,bc,dc,ad,ab |
| 5,3,4 | | 59.8 | dc,de,ef,ef,ef |
| 5,4,3 | | 159.8 | dc,de,ef,ef,ef,cf,dc,de,ef |

View File

@ -75,7 +75,7 @@ Feature: Avoid weird loops caused by rounding errors
@412 @via
Scenario: Avoid weird loops 3
And the node map
Given the node map
"""
a
b e

View File

@ -136,22 +136,6 @@ Feature: Basic Map Matching
| trace | matchings |
| abcbd | abbd |
Scenario: Testbot - Map matching with core factor
Given the contract extra arguments "--core 0.8"
Given the node map
"""
a b c d
e
"""
And the ways
| nodes | oneway |
| abcd | no |
When I match I should get
| trace | timestamps | matchings |
| abcd | 0 1 2 3 | abcd |
Scenario: Testbot - Map matching with small distortion
Given the node map
"""
@ -810,6 +794,6 @@ Feature: Basic Map Matching
# These should have the same weights/duration in either direction
When I match I should get
| trace | geometry | a:distance | a:duration | a:weight | duration |
| 2345 | 1.00018,1,1.000314,1 | 14.914666491 | 1.4 | 1.4 | 1.4 |
| 4321 | 1.00027,1,1.000135,1 | 15.025969972 | 1.5 | 1.5 | 1.5 |
| 2345 | 1.00018,1,1.000314,1 | 14.91466649 | 1.4 | 1.4 | 1.4 |
| 4321 | 1.00027,1,1.000135,1 | 15.02596997 | 1.5 | 1.5 | 1.5 |

View File

@ -401,12 +401,12 @@ Feature: Snapping at intersections
Given the extract extra arguments "--small-component-size=4"
And the ways
| nodes | oneway |
| ab | no |
| bc | no |
| cd | no |
| fed | no |
| bg | yes | # small SCC
| nodes | oneway | # comment |
| ab | no | |
| bc | no | |
| cd | no | |
| fed | no | |
| bg | yes | small SCC |
And the relations
| type | way:from | way:to | node:via | restriction |
@ -437,14 +437,14 @@ Feature: Snapping at intersections
Given the extract extra arguments "--small-component-size=4"
And the ways
| nodes | oneway |
| ab | no |
| bc | no |
| cd | no |
| fed | no |
| ghi | no |
| jkl | no |
| bm | yes | # small SCC
| nodes | oneway | # comment |
| ab | no | |
| bc | no | |
| cd | no | |
| fed | no | |
| ghi | no | |
| jkl | no | |
| bm | yes | small SCC |
And the relations
| type | way:from | way:to | node:via | restriction |
@ -570,7 +570,7 @@ Feature: Snapping at intersections
| a,f,k | ac,cf,cf,fj,kj,kj | 132.8s | 132.8 |
| k,f | ik,fi,fi | 54.3s | 54.3 |
| f,a | ef,ae,ae | 66.6s | 66.6 |
| k,f,a | kj,fj,fj,ef,ae,ae | 141.399999999s | 141.399999999 |
| k,f,a | kj,fj,fj,ef,ae,ae | 141.4s | 141.4 |
When I request a travel time matrix I should get
| | a | f | k |
@ -626,4 +626,4 @@ Feature: Snapping at intersections
| a,f,k | ad,df,df,fj,kj,kj | 105.6s | 105.6 |
| k,f | ik,fi,fi | 54.3s | 54.3 |
| f,a | ef,ae,ae | 66.6s | 66.6 |
| k,f,a | ik,fi,fi,ef,ae,ae | 120.899999999s | 120.899999999 |
| k,f,a | ik,fi,fi,ef,ae,ae | 120.9s | 120.9 |

View File

@ -65,32 +65,6 @@ Feature: Via points
| waypoints | route | turns |
| 1,2,3 | cd,ac,ab,bd,cd | depart,new name right,new name right,new name right,arrive |
Scenario: Simple via point with core factor
Given the contract extra arguments "--core 0.8"
Given the node map
"""
a b c d
e f g
h i
j
"""
And the ways
| nodes |
| abcd |
| efg |
| hi |
| be |
| cfh |
| dgij |
When I route I should get
| waypoints | route |
| a,b,c | abcd,abcd,abcd,abcd |
| c,b,a | abcd,abcd,abcd,abcd |
| a,d,j | abcd,abcd,dgij,dgij |
| j,d,a | dgij,dgij,abcd,abcd |
Scenario: Via point at a dead end
Given the node map
"""

View File

@ -53,10 +53,10 @@ Feature: Weight tests
When I route I should get
| waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed |
| s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 | 2 | 2 | 10 |
| t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034626629 | 2 | 2 | 10 |
| s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.940636463:10.017313314 | 3:0.9 | 3:0.9 | 10:11.1 |
| e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.017313314:29.940636463 | 0.9:3 | 0.9:3 | 11.1:10 |
| s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.03462663 | 2 | 2 | 10 |
| t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.03462663 | 2 | 2 | 10 |
| s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.94063646:10.01731331 | 3:0.9 | 3:0.9 | 10:11.1 |
| e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.01731331:29.94063646 | 0.9:3 | 0.9:3 | 11.1:10 |
Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property

View File

@ -38,7 +38,8 @@ if (ENABLE_FUZZING)
"table_parameters"
"tile_parameters"
"trip_parameters"
"url_parser")
"url_parser"
"request_parser")
foreach (target ${ServerTargets})
add_fuzz_target(${target})

28
fuzz/request_parser.cc Normal file
View File

@ -0,0 +1,28 @@
#include "server/request_parser.hpp"
#include "server/http/request.hpp"
#include "util.hpp"
#include <iterator>
#include <string>
using osrm::server::RequestParser;
using osrm::server::http::request;
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size)
{
std::string in(reinterpret_cast<const char *>(data), size);
auto first = begin(in);
auto last = end(in);
RequestParser parser;
request req;
// &(*it) is needed to go from iterator to underlying item to pointer to underlying item
parser.parse(req, &(*first), &(*last));
escape(&req);
return 0;
}

View File

@ -0,0 +1,249 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
#define FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 3 &&
FLATBUFFERS_VERSION_REVISION == 25,
"Non-compatible flatbuffers version included");
#include "route_generated.h"
#include "table_generated.h"
namespace osrm {
namespace engine {
namespace api {
namespace fbresult {
struct Error;
struct ErrorBuilder;
struct FBResult;
struct FBResultBuilder;
struct Error FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef ErrorBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_CODE = 4,
VT_MESSAGE = 6
};
const ::flatbuffers::String *code() const {
return GetPointer<const ::flatbuffers::String *>(VT_CODE);
}
const ::flatbuffers::String *message() const {
return GetPointer<const ::flatbuffers::String *>(VT_MESSAGE);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_CODE) &&
verifier.VerifyString(code()) &&
VerifyOffset(verifier, VT_MESSAGE) &&
verifier.VerifyString(message()) &&
verifier.EndTable();
}
};
struct ErrorBuilder {
typedef Error Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
void add_code(::flatbuffers::Offset<::flatbuffers::String> code) {
fbb_.AddOffset(Error::VT_CODE, code);
}
void add_message(::flatbuffers::Offset<::flatbuffers::String> message) {
fbb_.AddOffset(Error::VT_MESSAGE, message);
}
explicit ErrorBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
::flatbuffers::Offset<Error> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = ::flatbuffers::Offset<Error>(end);
return o;
}
};
inline ::flatbuffers::Offset<Error> CreateError(
::flatbuffers::FlatBufferBuilder &_fbb,
::flatbuffers::Offset<::flatbuffers::String> code = 0,
::flatbuffers::Offset<::flatbuffers::String> message = 0) {
ErrorBuilder builder_(_fbb);
builder_.add_message(message);
builder_.add_code(code);
return builder_.Finish();
}
inline ::flatbuffers::Offset<Error> CreateErrorDirect(
::flatbuffers::FlatBufferBuilder &_fbb,
const char *code = nullptr,
const char *message = nullptr) {
auto code__ = code ? _fbb.CreateString(code) : 0;
auto message__ = message ? _fbb.CreateString(message) : 0;
return osrm::engine::api::fbresult::CreateError(
_fbb,
code__,
message__);
}
struct FBResult FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef FBResultBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_ERROR = 4,
VT_CODE = 6,
VT_DATA_VERSION = 8,
VT_WAYPOINTS = 10,
VT_ROUTES = 12,
VT_TABLE = 14
};
bool error() const {
return GetField<uint8_t>(VT_ERROR, 0) != 0;
}
const osrm::engine::api::fbresult::Error *code() const {
return GetPointer<const osrm::engine::api::fbresult::Error *>(VT_CODE);
}
const ::flatbuffers::String *data_version() const {
return GetPointer<const ::flatbuffers::String *>(VT_DATA_VERSION);
}
const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *waypoints() const {
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *>(VT_WAYPOINTS);
}
const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>> *routes() const {
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>> *>(VT_ROUTES);
}
const osrm::engine::api::fbresult::TableResult *table() const {
return GetPointer<const osrm::engine::api::fbresult::TableResult *>(VT_TABLE);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_ERROR, 1) &&
VerifyOffset(verifier, VT_CODE) &&
verifier.VerifyTable(code()) &&
VerifyOffset(verifier, VT_DATA_VERSION) &&
verifier.VerifyString(data_version()) &&
VerifyOffset(verifier, VT_WAYPOINTS) &&
verifier.VerifyVector(waypoints()) &&
verifier.VerifyVectorOfTables(waypoints()) &&
VerifyOffset(verifier, VT_ROUTES) &&
verifier.VerifyVector(routes()) &&
verifier.VerifyVectorOfTables(routes()) &&
VerifyOffset(verifier, VT_TABLE) &&
verifier.VerifyTable(table()) &&
verifier.EndTable();
}
};
struct FBResultBuilder {
typedef FBResult Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
void add_error(bool error) {
fbb_.AddElement<uint8_t>(FBResult::VT_ERROR, static_cast<uint8_t>(error), 0);
}
void add_code(::flatbuffers::Offset<osrm::engine::api::fbresult::Error> code) {
fbb_.AddOffset(FBResult::VT_CODE, code);
}
void add_data_version(::flatbuffers::Offset<::flatbuffers::String> data_version) {
fbb_.AddOffset(FBResult::VT_DATA_VERSION, data_version);
}
void add_waypoints(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> waypoints) {
fbb_.AddOffset(FBResult::VT_WAYPOINTS, waypoints);
}
void add_routes(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>>> routes) {
fbb_.AddOffset(FBResult::VT_ROUTES, routes);
}
void add_table(::flatbuffers::Offset<osrm::engine::api::fbresult::TableResult> table) {
fbb_.AddOffset(FBResult::VT_TABLE, table);
}
explicit FBResultBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
::flatbuffers::Offset<FBResult> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = ::flatbuffers::Offset<FBResult>(end);
return o;
}
};
inline ::flatbuffers::Offset<FBResult> CreateFBResult(
::flatbuffers::FlatBufferBuilder &_fbb,
bool error = false,
::flatbuffers::Offset<osrm::engine::api::fbresult::Error> code = 0,
::flatbuffers::Offset<::flatbuffers::String> data_version = 0,
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> waypoints = 0,
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>>> routes = 0,
::flatbuffers::Offset<osrm::engine::api::fbresult::TableResult> table = 0) {
FBResultBuilder builder_(_fbb);
builder_.add_table(table);
builder_.add_routes(routes);
builder_.add_waypoints(waypoints);
builder_.add_data_version(data_version);
builder_.add_code(code);
builder_.add_error(error);
return builder_.Finish();
}
inline ::flatbuffers::Offset<FBResult> CreateFBResultDirect(
::flatbuffers::FlatBufferBuilder &_fbb,
bool error = false,
::flatbuffers::Offset<osrm::engine::api::fbresult::Error> code = 0,
const char *data_version = nullptr,
const std::vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *waypoints = nullptr,
const std::vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>> *routes = nullptr,
::flatbuffers::Offset<osrm::engine::api::fbresult::TableResult> table = 0) {
auto data_version__ = data_version ? _fbb.CreateString(data_version) : 0;
auto waypoints__ = waypoints ? _fbb.CreateVector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>(*waypoints) : 0;
auto routes__ = routes ? _fbb.CreateVector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>>(*routes) : 0;
return osrm::engine::api::fbresult::CreateFBResult(
_fbb,
error,
code,
data_version__,
waypoints__,
routes__,
table);
}
inline const osrm::engine::api::fbresult::FBResult *GetFBResult(const void *buf) {
return ::flatbuffers::GetRoot<osrm::engine::api::fbresult::FBResult>(buf);
}
inline const osrm::engine::api::fbresult::FBResult *GetSizePrefixedFBResult(const void *buf) {
return ::flatbuffers::GetSizePrefixedRoot<osrm::engine::api::fbresult::FBResult>(buf);
}
inline bool VerifyFBResultBuffer(
::flatbuffers::Verifier &verifier) {
return verifier.VerifyBuffer<osrm::engine::api::fbresult::FBResult>(nullptr);
}
inline bool VerifySizePrefixedFBResultBuffer(
::flatbuffers::Verifier &verifier) {
return verifier.VerifySizePrefixedBuffer<osrm::engine::api::fbresult::FBResult>(nullptr);
}
inline void FinishFBResultBuffer(
::flatbuffers::FlatBufferBuilder &fbb,
::flatbuffers::Offset<osrm::engine::api::fbresult::FBResult> root) {
fbb.Finish(root);
}
inline void FinishSizePrefixedFBResultBuffer(
::flatbuffers::FlatBufferBuilder &fbb,
::flatbuffers::Offset<osrm::engine::api::fbresult::FBResult> root) {
fbb.FinishSizePrefixed(root);
}
} // namespace fbresult
} // namespace api
} // namespace engine
} // namespace osrm
#endif // FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_

View File

@ -0,0 +1,51 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_POSITION_OSRM_ENGINE_API_FBRESULT_H_
#define FLATBUFFERS_GENERATED_POSITION_OSRM_ENGINE_API_FBRESULT_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 3 &&
FLATBUFFERS_VERSION_REVISION == 25,
"Non-compatible flatbuffers version included");
namespace osrm {
namespace engine {
namespace api {
namespace fbresult {
struct Position;
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Position FLATBUFFERS_FINAL_CLASS {
private:
float longitude_;
float latitude_;
public:
Position()
: longitude_(0),
latitude_(0) {
}
Position(float _longitude, float _latitude)
: longitude_(::flatbuffers::EndianScalar(_longitude)),
latitude_(::flatbuffers::EndianScalar(_latitude)) {
}
float longitude() const {
return ::flatbuffers::EndianScalar(longitude_);
}
float latitude() const {
return ::flatbuffers::EndianScalar(latitude_);
}
};
FLATBUFFERS_STRUCT_END(Position, 8);
} // namespace fbresult
} // namespace api
} // namespace engine
} // namespace osrm
#endif // FLATBUFFERS_GENERATED_POSITION_OSRM_ENGINE_API_FBRESULT_H_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,149 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_TABLE_OSRM_ENGINE_API_FBRESULT_H_
#define FLATBUFFERS_GENERATED_TABLE_OSRM_ENGINE_API_FBRESULT_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 3 &&
FLATBUFFERS_VERSION_REVISION == 25,
"Non-compatible flatbuffers version included");
#include "waypoint_generated.h"
namespace osrm {
namespace engine {
namespace api {
namespace fbresult {
struct TableResult;
struct TableResultBuilder;
struct TableResult FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef TableResultBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_DURATIONS = 4,
VT_ROWS = 6,
VT_COLS = 8,
VT_DISTANCES = 10,
VT_DESTINATIONS = 12,
VT_FALLBACK_SPEED_CELLS = 14
};
const ::flatbuffers::Vector<float> *durations() const {
return GetPointer<const ::flatbuffers::Vector<float> *>(VT_DURATIONS);
}
uint16_t rows() const {
return GetField<uint16_t>(VT_ROWS, 0);
}
uint16_t cols() const {
return GetField<uint16_t>(VT_COLS, 0);
}
const ::flatbuffers::Vector<float> *distances() const {
return GetPointer<const ::flatbuffers::Vector<float> *>(VT_DISTANCES);
}
const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *destinations() const {
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *>(VT_DESTINATIONS);
}
const ::flatbuffers::Vector<uint32_t> *fallback_speed_cells() const {
return GetPointer<const ::flatbuffers::Vector<uint32_t> *>(VT_FALLBACK_SPEED_CELLS);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_DURATIONS) &&
verifier.VerifyVector(durations()) &&
VerifyField<uint16_t>(verifier, VT_ROWS, 2) &&
VerifyField<uint16_t>(verifier, VT_COLS, 2) &&
VerifyOffset(verifier, VT_DISTANCES) &&
verifier.VerifyVector(distances()) &&
VerifyOffset(verifier, VT_DESTINATIONS) &&
verifier.VerifyVector(destinations()) &&
verifier.VerifyVectorOfTables(destinations()) &&
VerifyOffset(verifier, VT_FALLBACK_SPEED_CELLS) &&
verifier.VerifyVector(fallback_speed_cells()) &&
verifier.EndTable();
}
};
struct TableResultBuilder {
typedef TableResult Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
void add_durations(::flatbuffers::Offset<::flatbuffers::Vector<float>> durations) {
fbb_.AddOffset(TableResult::VT_DURATIONS, durations);
}
void add_rows(uint16_t rows) {
fbb_.AddElement<uint16_t>(TableResult::VT_ROWS, rows, 0);
}
void add_cols(uint16_t cols) {
fbb_.AddElement<uint16_t>(TableResult::VT_COLS, cols, 0);
}
void add_distances(::flatbuffers::Offset<::flatbuffers::Vector<float>> distances) {
fbb_.AddOffset(TableResult::VT_DISTANCES, distances);
}
void add_destinations(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> destinations) {
fbb_.AddOffset(TableResult::VT_DESTINATIONS, destinations);
}
void add_fallback_speed_cells(::flatbuffers::Offset<::flatbuffers::Vector<uint32_t>> fallback_speed_cells) {
fbb_.AddOffset(TableResult::VT_FALLBACK_SPEED_CELLS, fallback_speed_cells);
}
explicit TableResultBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
::flatbuffers::Offset<TableResult> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = ::flatbuffers::Offset<TableResult>(end);
return o;
}
};
inline ::flatbuffers::Offset<TableResult> CreateTableResult(
::flatbuffers::FlatBufferBuilder &_fbb,
::flatbuffers::Offset<::flatbuffers::Vector<float>> durations = 0,
uint16_t rows = 0,
uint16_t cols = 0,
::flatbuffers::Offset<::flatbuffers::Vector<float>> distances = 0,
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> destinations = 0,
::flatbuffers::Offset<::flatbuffers::Vector<uint32_t>> fallback_speed_cells = 0) {
TableResultBuilder builder_(_fbb);
builder_.add_fallback_speed_cells(fallback_speed_cells);
builder_.add_destinations(destinations);
builder_.add_distances(distances);
builder_.add_durations(durations);
builder_.add_cols(cols);
builder_.add_rows(rows);
return builder_.Finish();
}
inline ::flatbuffers::Offset<TableResult> CreateTableResultDirect(
::flatbuffers::FlatBufferBuilder &_fbb,
const std::vector<float> *durations = nullptr,
uint16_t rows = 0,
uint16_t cols = 0,
const std::vector<float> *distances = nullptr,
const std::vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *destinations = nullptr,
const std::vector<uint32_t> *fallback_speed_cells = nullptr) {
auto durations__ = durations ? _fbb.CreateVector<float>(*durations) : 0;
auto distances__ = distances ? _fbb.CreateVector<float>(*distances) : 0;
auto destinations__ = destinations ? _fbb.CreateVector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>(*destinations) : 0;
auto fallback_speed_cells__ = fallback_speed_cells ? _fbb.CreateVector<uint32_t>(*fallback_speed_cells) : 0;
return osrm::engine::api::fbresult::CreateTableResult(
_fbb,
durations__,
rows,
cols,
distances__,
destinations__,
fallback_speed_cells__);
}
} // namespace fbresult
} // namespace api
} // namespace engine
} // namespace osrm
#endif // FLATBUFFERS_GENERATED_TABLE_OSRM_ENGINE_API_FBRESULT_H_

View File

@ -0,0 +1,205 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_WAYPOINT_OSRM_ENGINE_API_FBRESULT_H_
#define FLATBUFFERS_GENERATED_WAYPOINT_OSRM_ENGINE_API_FBRESULT_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 3 &&
FLATBUFFERS_VERSION_REVISION == 25,
"Non-compatible flatbuffers version included");
#include "position_generated.h"
namespace osrm {
namespace engine {
namespace api {
namespace fbresult {
struct Uint64Pair;
struct Waypoint;
struct WaypointBuilder;
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Uint64Pair FLATBUFFERS_FINAL_CLASS {
private:
uint64_t first_;
uint64_t second_;
public:
Uint64Pair()
: first_(0),
second_(0) {
}
Uint64Pair(uint64_t _first, uint64_t _second)
: first_(::flatbuffers::EndianScalar(_first)),
second_(::flatbuffers::EndianScalar(_second)) {
}
uint64_t first() const {
return ::flatbuffers::EndianScalar(first_);
}
uint64_t second() const {
return ::flatbuffers::EndianScalar(second_);
}
};
FLATBUFFERS_STRUCT_END(Uint64Pair, 16);
struct Waypoint FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef WaypointBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_HINT = 4,
VT_DISTANCE = 6,
VT_NAME = 8,
VT_LOCATION = 10,
VT_NODES = 12,
VT_MATCHINGS_INDEX = 14,
VT_WAYPOINT_INDEX = 16,
VT_ALTERNATIVES_COUNT = 18,
VT_TRIPS_INDEX = 20
};
const ::flatbuffers::String *hint() const {
return GetPointer<const ::flatbuffers::String *>(VT_HINT);
}
float distance() const {
return GetField<float>(VT_DISTANCE, 0.0f);
}
const ::flatbuffers::String *name() const {
return GetPointer<const ::flatbuffers::String *>(VT_NAME);
}
const osrm::engine::api::fbresult::Position *location() const {
return GetStruct<const osrm::engine::api::fbresult::Position *>(VT_LOCATION);
}
const osrm::engine::api::fbresult::Uint64Pair *nodes() const {
return GetStruct<const osrm::engine::api::fbresult::Uint64Pair *>(VT_NODES);
}
uint32_t matchings_index() const {
return GetField<uint32_t>(VT_MATCHINGS_INDEX, 0);
}
uint32_t waypoint_index() const {
return GetField<uint32_t>(VT_WAYPOINT_INDEX, 0);
}
uint32_t alternatives_count() const {
return GetField<uint32_t>(VT_ALTERNATIVES_COUNT, 0);
}
uint32_t trips_index() const {
return GetField<uint32_t>(VT_TRIPS_INDEX, 0);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_HINT) &&
verifier.VerifyString(hint()) &&
VerifyField<float>(verifier, VT_DISTANCE, 4) &&
VerifyOffset(verifier, VT_NAME) &&
verifier.VerifyString(name()) &&
VerifyField<osrm::engine::api::fbresult::Position>(verifier, VT_LOCATION, 4) &&
VerifyField<osrm::engine::api::fbresult::Uint64Pair>(verifier, VT_NODES, 8) &&
VerifyField<uint32_t>(verifier, VT_MATCHINGS_INDEX, 4) &&
VerifyField<uint32_t>(verifier, VT_WAYPOINT_INDEX, 4) &&
VerifyField<uint32_t>(verifier, VT_ALTERNATIVES_COUNT, 4) &&
VerifyField<uint32_t>(verifier, VT_TRIPS_INDEX, 4) &&
verifier.EndTable();
}
};
struct WaypointBuilder {
typedef Waypoint Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
void add_hint(::flatbuffers::Offset<::flatbuffers::String> hint) {
fbb_.AddOffset(Waypoint::VT_HINT, hint);
}
void add_distance(float distance) {
fbb_.AddElement<float>(Waypoint::VT_DISTANCE, distance, 0.0f);
}
void add_name(::flatbuffers::Offset<::flatbuffers::String> name) {
fbb_.AddOffset(Waypoint::VT_NAME, name);
}
void add_location(const osrm::engine::api::fbresult::Position *location) {
fbb_.AddStruct(Waypoint::VT_LOCATION, location);
}
void add_nodes(const osrm::engine::api::fbresult::Uint64Pair *nodes) {
fbb_.AddStruct(Waypoint::VT_NODES, nodes);
}
void add_matchings_index(uint32_t matchings_index) {
fbb_.AddElement<uint32_t>(Waypoint::VT_MATCHINGS_INDEX, matchings_index, 0);
}
void add_waypoint_index(uint32_t waypoint_index) {
fbb_.AddElement<uint32_t>(Waypoint::VT_WAYPOINT_INDEX, waypoint_index, 0);
}
void add_alternatives_count(uint32_t alternatives_count) {
fbb_.AddElement<uint32_t>(Waypoint::VT_ALTERNATIVES_COUNT, alternatives_count, 0);
}
void add_trips_index(uint32_t trips_index) {
fbb_.AddElement<uint32_t>(Waypoint::VT_TRIPS_INDEX, trips_index, 0);
}
explicit WaypointBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
::flatbuffers::Offset<Waypoint> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = ::flatbuffers::Offset<Waypoint>(end);
return o;
}
};
inline ::flatbuffers::Offset<Waypoint> CreateWaypoint(
::flatbuffers::FlatBufferBuilder &_fbb,
::flatbuffers::Offset<::flatbuffers::String> hint = 0,
float distance = 0.0f,
::flatbuffers::Offset<::flatbuffers::String> name = 0,
const osrm::engine::api::fbresult::Position *location = nullptr,
const osrm::engine::api::fbresult::Uint64Pair *nodes = nullptr,
uint32_t matchings_index = 0,
uint32_t waypoint_index = 0,
uint32_t alternatives_count = 0,
uint32_t trips_index = 0) {
WaypointBuilder builder_(_fbb);
builder_.add_trips_index(trips_index);
builder_.add_alternatives_count(alternatives_count);
builder_.add_waypoint_index(waypoint_index);
builder_.add_matchings_index(matchings_index);
builder_.add_nodes(nodes);
builder_.add_location(location);
builder_.add_name(name);
builder_.add_distance(distance);
builder_.add_hint(hint);
return builder_.Finish();
}
inline ::flatbuffers::Offset<Waypoint> CreateWaypointDirect(
::flatbuffers::FlatBufferBuilder &_fbb,
const char *hint = nullptr,
float distance = 0.0f,
const char *name = nullptr,
const osrm::engine::api::fbresult::Position *location = nullptr,
const osrm::engine::api::fbresult::Uint64Pair *nodes = nullptr,
uint32_t matchings_index = 0,
uint32_t waypoint_index = 0,
uint32_t alternatives_count = 0,
uint32_t trips_index = 0) {
auto hint__ = hint ? _fbb.CreateString(hint) : 0;
auto name__ = name ? _fbb.CreateString(name) : 0;
return osrm::engine::api::fbresult::CreateWaypoint(
_fbb,
hint__,
distance,
name__,
location,
nodes,
matchings_index,
waypoint_index,
alternatives_count,
trips_index);
}
} // namespace fbresult
} // namespace api
} // namespace engine
} // namespace osrm
#endif // FLATBUFFERS_GENERATED_WAYPOINT_OSRM_ENGINE_API_FBRESULT_H_

View File

@ -7,9 +7,7 @@
#include "contractor/graph_contractor_adaptors.hpp"
#include "contractor/query_graph.hpp"
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
using GraphAndFilter = std::tuple<QueryGraph, std::vector<std::vector<bool>>>;
@ -63,9 +61,11 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
// Add all non-core edges to container
{
auto non_core_edges = toEdges<QueryEdge>(contractor_graph);
auto new_end =
std::remove_if(non_core_edges.begin(), non_core_edges.end(), [&](const auto &edge) {
return is_shared_core[edge.source] && is_shared_core[edge.target];
auto new_end = std::remove_if(non_core_edges.begin(),
non_core_edges.end(),
[&](const auto &edge) {
return is_shared_core[edge.source] &&
is_shared_core[edge.target];
});
non_core_edges.resize(new_end - non_core_edges.begin());
edge_container.Insert(std::move(non_core_edges));
@ -77,8 +77,8 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
}
// Extract core graph for further contraction
shared_core_graph = contractor_graph.Filter(
[&is_shared_core](const NodeID node) { return is_shared_core[node]; });
shared_core_graph = contractor_graph.Filter([&is_shared_core](const NodeID node)
{ return is_shared_core[node]; });
}
for (const auto &filter : filters)
@ -94,7 +94,6 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
return GraphAndFilter{QueryGraph{num_nodes, edge_container.edges},
edge_container.MakeEdgeFilters()};
}
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif

View File

@ -14,9 +14,7 @@
#include <numeric>
#include <vector>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
struct ContractedEdgeContainer
@ -91,7 +89,10 @@ struct ContractedEdgeContainer
// Remove all edges that are contained in the old set of edges and set the appropriate flag.
auto new_end =
std::remove_if(new_edges.begin(), new_edges.end(), [&](const QueryEdge &edge) {
std::remove_if(new_edges.begin(),
new_edges.end(),
[&](const QueryEdge &edge)
{
// check if the new edge would be sorted before the currend old edge
// if so it is not contained yet in the set of old edges
if (edge_iter == edge_end || mergeCompare(edge, *edge_iter))
@ -134,10 +135,10 @@ struct ContractedEdgeContainer
// enforce sorting for next merge step
std::vector<unsigned> ordering(edges_size);
std::iota(ordering.begin(), ordering.end(), 0);
tbb::parallel_sort(
ordering.begin(), ordering.end(), [&](const auto lhs_idx, const auto rhs_idx) {
return mergeCompare(edges[lhs_idx], edges[rhs_idx]);
});
tbb::parallel_sort(ordering.begin(),
ordering.end(),
[&](const auto lhs_idx, const auto rhs_idx)
{ return mergeCompare(edges[lhs_idx], edges[rhs_idx]); });
auto permutation = util::orderingToPermutation(ordering);
util::inplacePermutation(edges.begin(), edges.end(), permutation);
@ -164,7 +165,6 @@ struct ContractedEdgeContainer
std::vector<MergedFlags> flags;
std::vector<QueryEdge> edges;
};
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif

View File

@ -3,9 +3,7 @@
#include "contractor/query_graph.hpp"
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
namespace detail
@ -19,7 +17,6 @@ template <storage::Ownership Ownership> struct ContractedMetric
using ContractedMetric = detail::ContractedMetric<storage::Ownership::Container>;
using ContractedMetricView = detail::ContractedMetric<storage::Ownership::View>;
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif

View File

@ -30,9 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "contractor/contractor_config.hpp"
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
/// Base class of osrm-contract
@ -49,7 +47,6 @@ class Contractor
private:
ContractorConfig config;
};
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // PROCESSING_CHAIN_HPP

View File

@ -31,13 +31,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "storage/io_config.hpp"
#include "updater/updater_config.hpp"
#include <boost/filesystem/path.hpp>
#include <filesystem>
#include <string>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
struct ContractorConfig final : storage::IOConfig
@ -49,7 +46,7 @@ struct ContractorConfig final : storage::IOConfig
}
// Infer the output names from the path of the .osrm file
void UseDefaultOutputNames(const boost::filesystem::path &base)
void UseDefaultOutputNames(const std::filesystem::path &base)
{
IOConfig::UseDefaultOutputNames(base);
updater_config.UseDefaultOutputNames(base);
@ -71,7 +68,6 @@ struct ContractorConfig final : storage::IOConfig
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
double core_factor = 1.0;
};
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // EXTRACTOR_OPTIONS_HPP

View File

@ -4,20 +4,18 @@
#include "util/dynamic_graph.hpp"
#include <algorithm>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
struct ContractorEdgeData
{
ContractorEdgeData()
: weight(0), duration(0), distance(0), id(0), originalEdges(0), shortcut(0), forward(0),
: weight{0}, duration{0}, distance{0}, id(0), originalEdges(0), shortcut(0), forward(0),
backward(0)
{
}
ContractorEdgeData(EdgeWeight weight,
EdgeWeight duration,
EdgeDuration duration,
EdgeDistance distance,
unsigned original_edges,
unsigned id,
@ -30,7 +28,7 @@ struct ContractorEdgeData
{
}
EdgeWeight weight;
EdgeWeight duration;
EdgeDuration duration;
EdgeDistance distance;
unsigned id;
unsigned originalEdges : 29;
@ -42,7 +40,6 @@ struct ContractorEdgeData
using ContractorGraph = util::DynamicGraph<ContractorEdgeData>;
using ContractorEdge = ContractorGraph::InputEdge;
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // OSRM_CONTRACTOR_CONTRACTOR_GRAPH_HPP_

View File

@ -5,9 +5,7 @@
#include "util/typedefs.hpp"
#include "util/xor_fast_hash_storage.hpp"
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
struct ContractorHeapData
{
@ -24,7 +22,6 @@ using ContractorHeap = util::QueryHeap<NodeID,
ContractorHeapData,
util::XORFastHashStorage<NodeID, NodeID>>;
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_

View File

@ -8,9 +8,7 @@
#include <cstddef>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
void search(ContractorHeap &heap,
@ -20,7 +18,6 @@ void search(ContractorHeap &heap,
const EdgeWeight weight_limit,
const NodeID forbidden_node);
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // OSRM_CONTRACTOR_DIJKSTRA_HPP

View File

@ -1,131 +0,0 @@
#ifndef ITERATOR_BASED_CRC32_H
#define ITERATOR_BASED_CRC32_H
#if defined(__x86_64__) && !defined(__MINGW64__)
#include <cpuid.h>
#endif
#include <boost/crc.hpp> // for boost::crc_32_type
#include <iterator>
namespace osrm
{
namespace contractor
{
class IteratorbasedCRC32
{
public:
bool UsingHardware() const { return use_hardware_implementation; }
IteratorbasedCRC32() : crc(0) { use_hardware_implementation = DetectHardwareSupport(); }
template <class Iterator> unsigned operator()(Iterator iter, const Iterator end)
{
unsigned crc = 0;
while (iter != end)
{
using value_type = typename std::iterator_traits<Iterator>::value_type;
const char *data = reinterpret_cast<const char *>(&(*iter));
if (use_hardware_implementation)
{
crc = ComputeInHardware(data, sizeof(value_type));
}
else
{
crc = ComputeInSoftware(data, sizeof(value_type));
}
++iter;
}
return crc;
}
private:
bool DetectHardwareSupport() const
{
static const int sse42_bit = 0x00100000;
const unsigned ecx = cpuid();
const bool sse42_found = (ecx & sse42_bit) != 0;
return sse42_found;
}
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 ComputeInHardware(const char *str, unsigned len)
{
#if defined(__x86_64__)
unsigned q = len / sizeof(unsigned);
unsigned r = len % sizeof(unsigned);
unsigned *p = (unsigned *)str;
// crc=0;
while (q--)
{
__asm__ __volatile__(".byte 0xf2, 0xf, 0x38, 0xf1, 0xf1;"
: "=S"(crc)
: "0"(crc), "c"(*p));
++p;
}
str = reinterpret_cast<char *>(p);
while (r--)
{
__asm__ __volatile__(".byte 0xf2, 0xf, 0x38, 0xf1, 0xf1;"
: "=S"(crc)
: "0"(crc), "c"(*str));
++str;
}
#else
(void)str;
(void)len;
#endif
return crc;
}
inline unsigned cpuid() const
{
unsigned eax = 0, ebx = 0, ecx = 0, edx = 0;
// on X64 this calls hardware cpuid(.) instr. otherwise a dummy impl.
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
return ecx;
}
#if defined(__MINGW64__) || defined(_MSC_VER) || !defined(__x86_64__)
inline void __get_cpuid(int /*param*/,
unsigned * /*eax*/,
unsigned * /*ebx*/,
unsigned *ecx,
unsigned * /*edx*/) const
{
*ecx = 0;
}
#endif
boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> crc_processor;
unsigned crc;
bool use_hardware_implementation;
};
struct RangebasedCRC32
{
template <typename Iteratable> unsigned operator()(const Iteratable &iterable)
{
return crc32(std::begin(iterable), std::end(iterable));
}
bool UsingHardware() const { return crc32.UsingHardware(); }
private:
IteratorbasedCRC32 crc32;
};
} // namespace contractor
} // namespace osrm
#endif /* ITERATOR_BASED_CRC32_H */

View File

@ -5,15 +5,11 @@
#include <unordered_map>
namespace osrm
{
namespace contractor
{
namespace files
namespace osrm::contractor::files
{
// reads .osrm.hsgr file
template <typename ContractedMetricT>
inline void readGraph(const boost::filesystem::path &path,
inline void readGraph(const std::filesystem::path &path,
std::unordered_map<std::string, ContractedMetricT> &metrics,
std::uint32_t &connectivity_checksum)
{
@ -34,7 +30,7 @@ inline void readGraph(const boost::filesystem::path &path,
// writes .osrm.hsgr file
template <typename ContractedMetricT>
inline void writeGraph(const boost::filesystem::path &path,
inline void writeGraph(const std::filesystem::path &path,
const std::unordered_map<std::string, ContractedMetricT> &metrics,
const std::uint32_t connectivity_checksum)
{
@ -52,8 +48,6 @@ inline void writeGraph(const boost::filesystem::path &path,
serialization::write(writer, "/ch/metrics/" + pair.first, pair.second);
}
}
} // namespace files
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor::files
#endif

View File

@ -8,9 +8,7 @@
#include <tuple>
#include <vector>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
std::vector<bool> contractGraph(ContractorGraph &graph,
@ -37,7 +35,6 @@ inline auto contractGraph(ContractorGraph &graph,
graph, {}, std::move(node_is_contractable), std::move(node_weights), core_factor);
}
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // OSRM_CONTRACTOR_GRAPH_CONTRACTOR_HPP

View File

@ -10,9 +10,7 @@
#include <vector>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
// Make sure to move in the input edge list!
@ -29,18 +27,20 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
#ifndef NDEBUG
const unsigned int constexpr DAY_IN_DECI_SECONDS = 24 * 60 * 60 * 10;
if (static_cast<unsigned int>(std::max(input_edge.data.weight, 1)) > DAY_IN_DECI_SECONDS)
if (from_alias<unsigned int>(std::max(input_edge.data.weight, EdgeWeight{1})) >
DAY_IN_DECI_SECONDS)
{
util::Log(logWARNING) << "Edge weight large -> "
<< static_cast<unsigned int>(std::max(input_edge.data.weight, 1))
<< from_alias<unsigned int>(
std::max(input_edge.data.weight, EdgeWeight{1}))
<< " : " << static_cast<unsigned int>(input_edge.source) << " -> "
<< static_cast<unsigned int>(input_edge.target);
}
#endif
edges.emplace_back(input_edge.source,
input_edge.target,
std::max(input_edge.data.weight, 1),
input_edge.data.duration,
std::max(input_edge.data.weight, {1}),
to_alias<EdgeDuration>(input_edge.data.duration),
input_edge.data.distance,
1,
input_edge.data.turn_id,
@ -50,8 +50,8 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
edges.emplace_back(input_edge.target,
input_edge.source,
std::max(input_edge.data.weight, 1),
input_edge.data.duration,
std::max(input_edge.data.weight, {1}),
to_alias<EdgeDuration>(input_edge.data.duration),
input_edge.data.distance,
1,
input_edge.data.turn_id,
@ -109,7 +109,7 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
// merge edges (s,t) and (t,s) into bidirectional edge
if (forward_edge.data.weight == reverse_edge.data.weight)
{
if ((int)forward_edge.data.weight != INVALID_EDGE_WEIGHT)
if (forward_edge.data.weight != INVALID_EDGE_WEIGHT)
{
forward_edge.data.backward = true;
edges[edge++] = forward_edge;
@ -117,11 +117,11 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
}
else
{ // insert seperate edges
if (((int)forward_edge.data.weight) != INVALID_EDGE_WEIGHT)
if (forward_edge.data.weight != INVALID_EDGE_WEIGHT)
{
edges[edge++] = forward_edge;
}
if ((int)reverse_edge.data.weight != INVALID_EDGE_WEIGHT)
if (reverse_edge.data.weight != INVALID_EDGE_WEIGHT)
{
edges[edge++] = reverse_edge;
}
@ -157,7 +157,7 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
new_edge.target = target;
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
new_edge.data.weight = data.weight;
new_edge.data.duration = data.duration;
new_edge.data.duration = from_alias<EdgeDuration::value_type>(data.duration);
new_edge.data.distance = data.distance;
new_edge.data.shortcut = data.shortcut;
new_edge.data.turn_id = data.id;
@ -175,7 +175,6 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
return edges;
}
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // OSRM_CONTRACTOR_GRAPH_CONTRACTION_ADAPTORS_HPP_

View File

@ -5,9 +5,7 @@
#include <tuple>
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
struct QueryEdge
@ -17,15 +15,15 @@ struct QueryEdge
struct EdgeData
{
explicit EdgeData()
: turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false),
distance(0)
: turn_id(0), shortcut(false), weight{0}, duration(0), forward(false),
backward(false), distance{0}
{
}
EdgeData(const NodeID turn_id,
const bool shortcut,
const EdgeWeight weight,
const EdgeWeight duration,
const EdgeDuration duration,
const EdgeDistance distance,
const bool forward,
const bool backward)
@ -50,7 +48,7 @@ struct QueryEdge
NodeID turn_id : 31;
bool shortcut : 1;
EdgeWeight weight;
EdgeWeight duration : 30;
EdgeDuration::value_type duration : 30;
std::uint32_t forward : 1;
std::uint32_t backward : 1;
EdgeDistance distance;
@ -77,7 +75,6 @@ struct QueryEdge
data.distance == right.data.distance);
}
};
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // QUERYEDGE_HPP

View File

@ -6,9 +6,7 @@
#include "util/static_graph.hpp"
#include "util/typedefs.hpp"
namespace osrm
{
namespace contractor
namespace osrm::contractor
{
namespace detail
@ -19,7 +17,6 @@ using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>;
using QueryGraph = detail::QueryGraph<storage::Ownership::Container>;
using QueryGraphView = detail::QueryGraph<storage::Ownership::View>;
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor
#endif // QUERYEDGE_HPP

View File

@ -8,11 +8,7 @@
#include "storage/serialization.hpp"
#include "storage/tar.hpp"
namespace osrm
{
namespace contractor
{
namespace serialization
namespace osrm::contractor::serialization
{
template <storage::Ownership Ownership>
@ -46,8 +42,6 @@ void read(storage::tar::FileReader &reader,
metric.edge_filter[index]);
}
}
} // namespace serialization
} // namespace contractor
} // namespace osrm
} // namespace osrm::contractor::serialization
#endif

View File

@ -10,9 +10,7 @@
#include <unordered_set>
namespace osrm
{
namespace customizer
namespace osrm::customizer
{
class CellCustomizer
@ -61,7 +59,7 @@ class CellCustomizer
}
}
heap.Clear();
heap.Insert(source, 0, {false, 0, 0});
heap.Insert(source, {0}, {false, {0}, {0}});
// explore search space
while (!heap.Empty() && !destinations_set.empty())
@ -124,7 +122,8 @@ class CellCustomizer
for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level)
{
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, partition.GetNumberOfCells(level)),
[&](const tbb::blocked_range<std::size_t> &range) {
[&](const tbb::blocked_range<std::size_t> &range)
{
auto &heap = heaps.local();
for (auto id = range.begin(), end = range.end(); id != end; ++id)
{
@ -216,12 +215,11 @@ class CellCustomizer
partition.GetCell(level - 1, to)))
{
const EdgeWeight to_weight = weight + data.weight;
const EdgeDuration to_duration = duration + data.duration;
const EdgeDuration to_duration = duration + to_alias<EdgeDuration>(data.duration);
const EdgeDistance to_distance = distance + data.distance;
if (!heap.WasInserted(to))
{
heap.Insert(
to, to_weight, {false, duration + data.duration, distance + data.distance});
heap.Insert(to, to_weight, {false, to_duration, to_distance});
}
else if (std::tie(to_weight, to_duration, to_distance) <
std::tie(
@ -236,7 +234,6 @@ class CellCustomizer
const partitioner::MultiLevelPartition &partition;
};
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer
#endif // OSRM_CELLS_CUSTOMIZER_HPP

View File

@ -7,9 +7,7 @@
#include "util/typedefs.hpp"
#include "util/vector_view.hpp"
namespace osrm
{
namespace customizer
namespace osrm::customizer
{
namespace detail
{
@ -26,7 +24,6 @@ template <storage::Ownership Ownership> struct CellMetricImpl
using CellMetric = detail::CellMetricImpl<storage::Ownership::Container>;
using CellMetricView = detail::CellMetricImpl<storage::Ownership::View>;
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer
#endif

View File

@ -3,9 +3,7 @@
#include "customizer/customizer_config.hpp"
namespace osrm
{
namespace customizer
namespace osrm::customizer
{
class Customizer
@ -14,7 +12,6 @@ class Customizer
int Run(const CustomizationConfig &config);
};
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_HPP

View File

@ -1,17 +1,14 @@
#ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
#define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
#include <boost/filesystem/path.hpp>
#include <array>
#include <filesystem>
#include <string>
#include "storage/io_config.hpp"
#include "updater/updater_config.hpp"
namespace osrm
{
namespace customizer
namespace osrm::customizer
{
struct CustomizationConfig final : storage::IOConfig
@ -29,7 +26,7 @@ struct CustomizationConfig final : storage::IOConfig
{
}
void UseDefaultOutputNames(const boost::filesystem::path &base)
void UseDefaultOutputNames(const std::filesystem::path &base)
{
IOConfig::UseDefaultOutputNames(base);
updater_config.UseDefaultOutputNames(base);
@ -39,7 +36,6 @@ struct CustomizationConfig final : storage::IOConfig
updater::UpdaterConfig updater_config;
};
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP

View File

@ -9,11 +9,9 @@
#include "storage/shared_memory_ownership.hpp"
#include <boost/filesystem/path.hpp>
#include <filesystem>
namespace osrm
{
namespace customizer
namespace osrm::customizer
{
struct EdgeBasedGraphEdgeData
@ -97,7 +95,7 @@ class MultiLevelGraph : public partitioner::MultiLevelGraph<EdgeDataT, Ownership
EdgeWeight GetNodeWeight(NodeID node) const { return node_weights[node]; }
EdgeWeight GetNodeDuration(NodeID node) const { return node_durations[node]; }
EdgeDuration GetNodeDuration(NodeID node) const { return node_durations[node]; }
EdgeDistance GetNodeDistance(NodeID node) const { return node_distances[node]; }
@ -126,7 +124,6 @@ using MultiLevelEdgeBasedGraph =
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
using MultiLevelEdgeBasedGraphView =
MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>;
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer
#endif

View File

@ -9,16 +9,12 @@
#include <unordered_map>
namespace osrm
{
namespace customizer
{
namespace files
namespace osrm::customizer::files
{
// reads .osrm.cell_metrics file
template <typename CellMetricT>
inline void readCellMetrics(const boost::filesystem::path &path,
inline void readCellMetrics(const std::filesystem::path &path,
std::unordered_map<std::string, std::vector<CellMetricT>> &metrics)
{
static_assert(std::is_same<CellMetricView, CellMetricT>::value ||
@ -48,7 +44,7 @@ inline void readCellMetrics(const boost::filesystem::path &path,
// writes .osrm.cell_metrics file
template <typename CellMetricT>
inline void
writeCellMetrics(const boost::filesystem::path &path,
writeCellMetrics(const std::filesystem::path &path,
const std::unordered_map<std::string, std::vector<CellMetricT>> &metrics)
{
static_assert(std::is_same<CellMetricView, CellMetricT>::value ||
@ -76,7 +72,7 @@ writeCellMetrics(const boost::filesystem::path &path,
// reads .osrm.mldgr file
template <typename MultiLevelGraphT>
inline void readGraph(const boost::filesystem::path &path,
inline void readGraph(const std::filesystem::path &path,
MultiLevelGraphT &graph,
std::uint32_t &connectivity_checksum)
{
@ -92,7 +88,7 @@ inline void readGraph(const boost::filesystem::path &path,
// writes .osrm.mldgr file
template <typename MultiLevelGraphT>
inline void writeGraph(const boost::filesystem::path &path,
inline void writeGraph(const std::filesystem::path &path,
const MultiLevelGraphT &graph,
const std::uint32_t connectivity_checksum)
{
@ -106,8 +102,6 @@ inline void writeGraph(const boost::filesystem::path &path,
writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum);
serialization::write(writer, "/mld/multilevelgraph", graph);
}
} // namespace files
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer::files
#endif

View File

@ -9,11 +9,7 @@
#include "storage/shared_memory_ownership.hpp"
#include "storage/tar.hpp"
namespace osrm
{
namespace customizer
{
namespace serialization
namespace osrm::customizer::serialization
{
template <storage::Ownership Ownership>
@ -65,8 +61,6 @@ inline void write(storage::tar::FileWriter &writer,
storage::serialization::write(writer, name + "/is_backward_edge", graph.is_backward_edge);
storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset);
}
} // namespace serialization
} // namespace customizer
} // namespace osrm
} // namespace osrm::customizer::serialization
#endif

View File

@ -3,11 +3,7 @@
#include <type_traits>
namespace osrm
{
namespace engine
{
namespace routing_algorithms
namespace osrm::engine::routing_algorithms
{
// Contraction Hiearchy
@ -111,8 +107,6 @@ template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type
template <> struct HasExcludeFlags<mld::Algorithm> final : std::true_type
{
};
} // namespace routing_algorithms
} // namespace engine
} // namespace osrm
} // namespace osrm::engine::routing_algorithms
#endif

View File

@ -18,11 +18,7 @@
#include <memory>
#include <vector>
namespace osrm
{
namespace engine
{
namespace api
namespace osrm::engine::api
{
static const constexpr char *INTERSECTION_DELIMITER = " / ";
@ -44,10 +40,10 @@ class BaseAPI
util::json::Array waypoints;
waypoints.values.resize(parameters.coordinates.size());
boost::range::transform(
waypoint_candidates,
boost::range::transform(waypoint_candidates,
waypoints.values.begin(),
[this](const PhantomNodeCandidates &candidates) { return MakeWaypoint(candidates); });
[this](const PhantomNodeCandidates &candidates)
{ return MakeWaypoint(candidates); });
return waypoints;
}
@ -57,8 +53,8 @@ class BaseAPI
{
// TODO: check forward/reverse
const auto toName = [this](const auto &phantom) {
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
.to_string();
return std::string(
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
};
const auto noEmpty = [](const auto &name) { return !name.empty(); };
@ -108,9 +104,8 @@ class BaseAPI
std::transform(waypoint_candidates.begin(),
waypoint_candidates.end(),
waypoints.begin(),
[this, builder](const PhantomNodeCandidates &candidates) {
return MakeWaypoint(builder, candidates)->Finish();
});
[this, builder](const PhantomNodeCandidates &candidates)
{ return MakeWaypoint(builder, candidates)->Finish(); });
return builder->CreateVector(waypoints);
}
@ -128,8 +123,8 @@ class BaseAPI
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lat))));
const auto toName = [this](const auto &phantom) {
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
.to_string();
return std::string(
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
};
const auto noEmpty = [](const auto &name) { return !name.empty(); };
@ -170,8 +165,6 @@ class BaseAPI
const BaseParameters &parameters;
};
} // namespace api
} // namespace engine
} // namespace osrm
} // namespace osrm::engine::api
#endif

View File

@ -33,16 +33,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "engine/hint.hpp"
#include "util/coordinate.hpp"
#include <boost/optional.hpp>
#include <optional>
#include <algorithm>
#include <vector>
namespace osrm
{
namespace engine
{
namespace api
namespace osrm::engine::api
{
/**
@ -56,7 +52,8 @@ namespace api
* optional per coordinate
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
* towards true north in clockwise direction, optional per coordinate
* - approaches: force the phantom node to start towards the node with the road country side.
* - approaches: force the phantom node to start towards the node with the road country side or
* its opposite
*
* \see OSRM, Coordinate, Hint, Bearing, RouteParameters, TableParameters,
* NearestParameters, TripParameters, MatchParameters and TileParameters
@ -77,12 +74,12 @@ struct BaseParameters
};
std::vector<util::Coordinate> coordinates;
std::vector<boost::optional<Hint>> hints;
std::vector<boost::optional<double>> radiuses;
std::vector<boost::optional<Bearing>> bearings;
std::vector<boost::optional<Approach>> approaches;
std::vector<std::optional<Hint>> hints;
std::vector<std::optional<double>> radiuses;
std::vector<std::optional<Bearing>> bearings;
std::vector<std::optional<Approach>> approaches;
std::vector<std::string> exclude;
boost::optional<OutputFormatType> format = OutputFormatType::JSON;
std::optional<OutputFormatType> format = OutputFormatType::JSON;
// Adds hints to response which can be included in subsequent requests, see `hints` above.
bool generate_hints = true;
@ -93,10 +90,10 @@ struct BaseParameters
SnappingType snapping = SnappingType::Default;
BaseParameters(std::vector<util::Coordinate> coordinates_ = {},
std::vector<boost::optional<Hint>> hints_ = {},
std::vector<boost::optional<double>> radiuses_ = {},
std::vector<boost::optional<Bearing>> bearings_ = {},
std::vector<boost::optional<Approach>> approaches_ = {},
std::vector<std::optional<Hint>> hints_ = {},
std::vector<std::optional<double>> radiuses_ = {},
std::vector<std::optional<Bearing>> bearings_ = {},
std::vector<std::optional<Approach>> approaches_ = {},
bool generate_hints_ = true,
std::vector<std::string> exclude = {},
const SnappingType snapping_ = SnappingType::Default)
@ -115,7 +112,8 @@ struct BaseParameters
(approaches.empty() || approaches.size() == coordinates.size()) &&
std::all_of(bearings.begin(),
bearings.end(),
[](const boost::optional<Bearing> &bearing_and_range) {
[](const std::optional<Bearing> &bearing_and_range)
{
if (bearing_and_range)
{
return bearing_and_range->IsValid();
@ -124,8 +122,6 @@ struct BaseParameters
});
}
};
} // namespace api
} // namespace engine
} // namespace osrm
} // namespace osrm::engine::api
#endif // ROUTE_PARAMETERS_HPP

View File

@ -2,22 +2,15 @@
#define ENGINE_API_BASE_RESULT_HPP
#include <flatbuffers/flatbuffers.h>
#include <mapbox/variant.hpp>
#include <variant>
#include <string>
#include "util/json_container.hpp"
namespace osrm
namespace osrm::engine::api
{
namespace engine
{
namespace api
{
using ResultT =
mapbox::util::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
} // namespace api
} // namespace engine
} // namespace osrm
using ResultT = std::variant<util::json::Object, std::string, flatbuffers::FlatBufferBuilder>;
} // namespace osrm::engine::api
#endif

View File

@ -14,7 +14,7 @@ table FBResult {
data_version: string;
waypoints: [Waypoint]; //Used as 'sources' waypoints for a 'Table' service
routes: [RouteObject];
table: Table;
table: TableResult;
}
root_type FBResult;

File diff suppressed because it is too large Load Diff

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