Client library for OSRM with promises
npm install osrm-client-promiseAn isomorphic promising OSRM client (v4)
| Service | Description |
|-------------|-----------------------------------------------------------|
| viaroute | shortest path between given coordinates |
| nearest | returns the nearest street segment for a given coordinate |
| table | computes distance tables for given coordinates |
| match | matches given coordinates to the road network |
| trip | Compute the shortest round trip between given coordinates
``javascripthttp://router.project-osrm.org
// instantiate a new client (without arg will be used)
let osrm = new OSRMClient('http://localhost:5000')
osrm.nearest([52.4224,13.333086])
.then(ret => {
console.log(ret)
// {
// "status": 200,
// "mapped_coordinate": [52.42259, 13.33383],
// "name": "Mariannenstraße"
// }
})
osrm.trip({loc: [45, 8], [45.1, 8.1]})
``