From c370ddd89ace23437adc20f62ff02a9d5923e03b Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Tue, 14 Mar 2017 12:17:31 +0100 Subject: [PATCH] Add routing algorithm option --- features/lib/osrm_loader.js | 6 ++++-- features/support/env.js | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/features/lib/osrm_loader.js b/features/lib/osrm_loader.js index 27980cf41..992eda433 100644 --- a/features/lib/osrm_loader.js +++ b/features/lib/osrm_loader.js @@ -77,7 +77,8 @@ class OSRMDirectLoader extends OSRMBaseLoader { osrmUp (callback) { if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!")); - this.child = this.scope.runBin('osrm-routed', util.format("%s -p %d", this.inputFile, this.scope.OSRM_PORT), this.scope.environment, (err) => { + const command_arguments = util.format('%s -p %d -a %s', this.inputFile, this.scope.OSRM_PORT, this.scope.ROUTING_ALGORITHM); + this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => { if (err && err.signal !== 'SIGINT') { this.child = null; throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd)); @@ -115,7 +116,8 @@ class OSRMDatastoreLoader extends OSRMBaseLoader { osrmUp (callback) { if (this.osrmIsRunning()) return callback(); - this.child = this.scope.runBin('osrm-routed', util.format('--shared-memory=1 -p %d', this.scope.OSRM_PORT), this.scope.environment, (err) => { + const command_arguments = util.format('--shared-memory=1 -p %d -a %s', this.scope.OSRM_PORT, this.scope.ROUTING_ALGORITHM); + this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => { if (err && err.signal !== 'SIGINT') { this.child = null; throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd)); diff --git a/features/support/env.js b/features/support/env.js index 7aa976f30..79c8dd862 100644 --- a/features/support/env.js +++ b/features/support/env.js @@ -39,6 +39,7 @@ module.exports = function () { this.OSM_TIMESTAMP = '2000-01-01T00:00:00Z'; this.WAY_SPACING = 100; this.DEFAULT_GRID_SIZE = 100; // meters + this.ROUTING_ALGORITHM = 'CH'; this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000; this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;