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>
This commit is contained in:
Michael Bell
2024-04-03 19:59:15 +01:00
committed by GitHub
parent 367933fc1a
commit 8ef366e061
12 changed files with 400 additions and 38 deletions
+7 -3
View File
@@ -573,7 +573,7 @@ test('route: throws on bad radiuses', function(assert) {
});
test('route: routes Monaco with valid approaches values', function(assert) {
assert.plan(3);
assert.plan(4);
var osrm = new OSRM(monaco_path);
var options = {
coordinates: two_test_coordinates,
@@ -586,6 +586,10 @@ test('route: routes Monaco with valid approaches values', function(assert) {
osrm.route(options, function(err, route) {
assert.ifError(err);
});
options.approaches = ['opposite', 'opposite'];
osrm.route(options, function(err, route) {
assert.ifError(err);
});
options.approaches = ['unrestricted', null];
osrm.route(options, function(err, route) {
assert.ifError(err);
@@ -609,12 +613,12 @@ test('route: throws on bad approaches', function(assert) {
coordinates: two_test_coordinates,
approaches: ['curb', 'test']
}, function(err, route) {}) },
/'approaches' param must be one of \[curb, unrestricted\]/);
/'approaches' param must be one of \[curb, opposite, unrestricted\]/);
assert.throws(function() { osrm.route({
coordinates: two_test_coordinates,
approaches: [10, 15]
}, function(err, route) {}) },
/Approach must be a string: \[curb, unrestricted\] or null/);
/Approach must be a string: \[curb, opposite, unrestricted\] or null/);
});
test('route: routes Monaco with custom limits on MLD', function(assert) {