How to use osrm - 1 common examples

To help you get started, we’ve selected a few osrm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WorldBank-Transport / ram-backend / __converter / app / calculate-eta / index.js View on Github external
process.on('message', function (e) {
  process.send({type: 'status', data: 'srv_started', id:});
  const {
    poi: poiByType,
  } = e;

  const osrm = new OSRM(osrmFile);
  process.send({type: 'status', data: 'srv_loaded_files', id: id});

  // Split the input region in squares for parallelisation.
  let box = envelope(adminArea);
  let extent = [box.geometry.coordinates[0][0][0], box.geometry.coordinates[0][0][1], box.geometry.coordinates[0][2][0], box.geometry.coordinates[0][2][1]];
  let squares = squareGrid(extent, gridSize || 30, 'kilometers').features;
  process.send({type: 'squarecount', data: squares.length, id: id});

  // Create a task for each square to be run below.
  var squareTasks = => {
    // Clip the square with the input geometry. In this way we work with a
    // smaller area..
    let workArea = intersect(adminArea, square);
    return createProcessAreaTask(workArea, poiByType, villages, osrm, maxTime, maxSpeed, id);


The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.

Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular osrm functions