Tomás Metcalfe
Tomás Metcalfe

Reputation: 372

What response does leaflet routing machine expect from a custom OSRM router?

I have OSRM (node-osrm) set up locally and it produces correct results for routes on the server. However, when I request routes from it via leaflet routing machine I get the following error in the browser:

leaflet-routing-machine.js:2605 Routing error: Object {status: undefined}status: undefined__proto__: ObjectdefaultErrorHandler 

@ leaflet-routing-machine.js:2605fire 
@ leaflet-src.js:588(anonymous function) 
@ leaflet-routing-machine.js:2900_routeDone 
@ leaflet-routing-machine.js:4693(anonymous function) 
@ leaflet-routing-machine.js:4645loaded 
@ leaflet-routing-machine.js:46

The app works with the mapbox router and the response looks slight different (different order).

Upvotes: 0

Views: 657

Answers (1)

Tomás Metcalfe
Tomás Metcalfe

Reputation: 372

After comparing responses from a commercial server and my own server I found the problem: Leaflet routing machine (LRM) expects a route response containing:

The OSRM engine does not include instructions out-of-the-box in the response, these must be added on the server after the route is returned by OSRM. The osrm-text-instructions plugin does so nicely. osrm-text-instructions

Upvotes: 1

Related Questions