Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

osrm-client-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

osrm-client-js

REST client for the OSRM server API

  • 5.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

osrm-client-js

Build Status

Client library for Open Source Routing Machine - OSRM that uses the REST http API that is exposed by osrm-routed.

The interface is compatible with node-osrm. However it is not meant as replacement for node-osrm on the server.

Can be used with NodeJS and with browserify.

Example

var OSRM = require('osrm-client-js');

var osrm = new OSRM("https://router.project-osrm.org");

osrm.route({
      coordinates: [[13.438640,52.519930], [13.415852,52.513191]],
      steps: true,
      alternatives: false,
      overview: 'simplified',
      geometries: 'polyline'
   }, function(err, result) {
   console.log(result);
});

osrm.trip({
      coordinates: [[13.438640,52.519930], [13.415852,52.513191]],
      steps: true,
      overview: 'simplified',
      geometries: 'polyline'
   }, function(err, result) {
   console.log(result);
});

osrm.match({
      coordinates: [[13.438640,52.519930], [13.415852,52.513191]],
      timestamps: [1460585940, 1460585945],
      steps: true,
      overview: 'simplified',
      geometries: 'polyline'
   }, function(err, result) {
   console.log(result);
});

osrm.table({
      coordinates: [[13.438640,52.519930], [13.415852,52.513191], [13.333086, 52.4224]],
      sources: [0],
      destinations: [1, 2]
   }, function(err, result) {
   console.log(result);
});

osrm.tile([17603, 10747, 15], function(err, result) {
   console.log(result); // pbf encoded vector tile
});

//You can also pass it query paths directly:

osrm.request('/route/v1/driving/13.438640,52.519930;13.415852,52.513191', function(err, result) {
});

Testing

npm test # run node tape tests
firefox test.html # check the console if tape tests worked

Keywords

FAQs

Package last updated on 29 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc