New User Confusion

I’m trying to get a very simple example working, and failing…
I have a client browser with existing features, and am trying to add a Route-Planning feature.
I’m currently trying to run this Directions example:

var Directions = new Openrouteservice.Directions({ api_key: "Yes_I_Have_A_Key"});

    coordinates: [[8.690958, 49.404662], [8.687868, 49.390139]],
    profile: 'driving-car',
    // profile:
    // {
    //     "vehicle_type": "driving-car",
    //     "avoid_features": "ferries|tollways",
    //     "maximum_speed": 100,
    // },
    extra_info: ['waytype', 'steepness'],
    avoid_features: ['tollways', 'ferries'],
    format: 'json'
.then(function(json) {
    // Add your own result handling here
.catch(function(err) {
    var str = "An error occurred: " + err;


** Problem 1: If I run the code as is, I get these 2 errors:

ors-js-client.js:16 POST 400

ors-js-client.js:36 Error: Unsuccessful HTTP response
at Request. (ors-js-client.js:16)
at Request.Emitter.emit (ors-js-client.js:7)
at XMLHttpRequest.t.onreadystatechange (ors-js-client.js:16)

I understand that the second error is the result of the first, but have been unable to find any useful documentation on the source of the first error

** Problem 2: How do I use the extended profile features?
If I replace: profile: ‘driving-car’,
with the commented lines below it, then the ‘driving-car’ field in the POST command never even gets populated

I would appreciate help with these problems, and if there is a working example that you can point me to that would be great!

Hi @MoltenLight

  1. For me the example works as is when i open the file from within the repository in firefox.
    Which browser are you using? Did you append your api_key as needed?

  2. Where did you get these settings for profile?
    Please read the API documentation to see which parameter-value pairs are available

Best regards

Hi amandus

I am working in Chrome because there are features in the main app that work better in Chrome.
However, I did just try it in Firefox and it gave me more debug info than I was able to find in Chrome (may be a learning curve on my side). It said ‘avoid_features’ was and ‘Unknown Parameter’. I removed it and the code worked!

Which then indicates I don’t have the proper code version that goes with the example. I downloaded 6.5, but apparently there is a disconnect somewhere.


Hi @MoltenLight,

You would pass this as in the js isochrone example:

                coordinates: [[8.690958, 49.404662], [8.687868, 49.390139]],
                profile: "driving-hgv",
                extra_info: ["waytype", "steepness"],
                maximum_speed: 100,
                avoidables: ["tollways", "highways"],
                format: "json"

This is a bit confusing, as the parameter is different from the API documentation.
It is there to have a quick access to the options.avoid_features property, but is not properly documented in the plugin.

Hi @MoltenLight

In the repository of the ORS-js library there is an examples folder openrouteservice-js/examples at master · GIScience/openrouteservice-js · GitHub
So, in the case you need basic working examples for other endpoints, please check them. If you clone the repository, you can open directly the examples’ folder index and check each endpoint working.