Git Product home page Git Product logo

osrm.js's Introduction

osrm.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.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

osrm.js's People

Contributors

themarex avatar drag0s avatar mayorandrew avatar zhuang-hao-ming avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.