Add routing algorithm option

This commit is contained in:
Michael Krasnyk 2017-03-14 12:17:31 +01:00
parent 57c6c6e51c
commit c370ddd89a
No known key found for this signature in database
GPG Key ID: 49C12AD0F43D2108
2 changed files with 5 additions and 2 deletions

View File

@ -77,7 +77,8 @@ class OSRMDirectLoader extends OSRMBaseLoader {
osrmUp (callback) { osrmUp (callback) {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!")); 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') { if (err && err.signal !== 'SIGINT') {
this.child = null; this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd)); throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
@ -115,7 +116,8 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
osrmUp (callback) { osrmUp (callback) {
if (this.osrmIsRunning()) return 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') { if (err && err.signal !== 'SIGINT') {
this.child = null; this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd)); throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));

View File

@ -39,6 +39,7 @@ module.exports = function () {
this.OSM_TIMESTAMP = '2000-01-01T00:00:00Z'; this.OSM_TIMESTAMP = '2000-01-01T00:00:00Z';
this.WAY_SPACING = 100; this.WAY_SPACING = 100;
this.DEFAULT_GRID_SIZE = 100; // meters this.DEFAULT_GRID_SIZE = 100; // meters
this.ROUTING_ALGORITHM = 'CH';
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000; this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT; this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;