Skip to content

Commit

Permalink
fix: added support for different OSRM routing algorithms (@MichielDeMey)
Browse files Browse the repository at this point in the history
fix: added support for different OSRM routing algorithms (@MichielDeMey)
  • Loading branch information
stepankuzmin authored Oct 29, 2018
2 parents 95f2248 + d9417ba commit 6fa22bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Options:
defaults.lengthThreshold
}].
--port=<port> Port to run on [default: 3000].
--algorithm=<algorithm> Algorithm used by OSRM (CH or MLD) [default: ${
defaults.algorithm
}].
--radius=<radius> Isochrone buffer radius [default: ${defaults.radius}].
--sharedMemory Use shared memory [default: false].
--units=<units> Either 'kilometers' or 'miles' [default: ${defaults.units}].
Expand Down Expand Up @@ -84,6 +87,7 @@ const main = async () => {

const options = {
osrmPath: graphPath,
algorithm: args['--algorithm'] || defaults.algorithm,
port: parseInt(args['--port'], 10),
radius: parseFloat(args['--radius']),
cellSize: parseFloat(args['--cellSize']),
Expand Down
1 change: 1 addition & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createApp = (config) => {

app.context.osrm = new OSRM({
path: config.osrmPath,
algorithm: config.algorithm,
shared_memory: config.sharedMemory
});

Expand Down
3 changes: 2 additions & 1 deletion src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const defaults = {
deintersect: true,
intervals: [10, 20, 30],
lengthThreshold: 0,
units: 'kilometers'
units: 'kilometers',
algorithm: 'CH'
};

module.exports = defaults;

0 comments on commit 6fa22bc

Please sign in to comment.