Self host - /routes parameters

Hi !

I am contacting you because I recently installed ORS with Docker in order to no longer be restricted by the public API of ORS

I would also like to thank you for this work which is just enormous and super well done!

So suddenly I installed ORS from my Mac, with Docker, and I can’t make API calls to / routes.

The production of my API uses this route, but impossible to reproduce it from the hosted version on my side.

https://api.openrouteservice.org/v2/directions/${mode}?api_key=${config.ors_token}&start=${from.join(',')}&end=${to.join(',')}`)

If I type this route:

http://localhost:8080/ors/routes

Here’s what comes out:

{
    "error": {
    "code": 2001,
        "message": "Parameter 'profile' is missing."
    },
    "info": {
        "engine": {
            "version": "6.1.1",
            "build_date": "2020-06-22T09:07:41Z"
        },
    "timestamp": 1592826844647
    }
}

Which seems normal, so I keep writing my API call:

localhost:8080/ors/routes?profile=foot-walking&start=8.697609901428223, 49.39622819171437&end=8.697609901428223, 49.39622819171437

ORS tells me that the “Coordinates” parameter is missing. I searched the entire API (https://openrouteservice.org/dev/#/api-docs) and couldn’t see how to use the coordinates parameter. Also, the API never talks about the route “routes” but I deduce that “routes” = “directions”

Thank you for your help and thank you for this useful API !!

Camille

Hi @CMonjo

It’s generally better to use the v2 API which needs post requests and most of the content sent in the body of the request (the v1 endpoint will be removed in the not too distant future).

For example, the above query should be something like:
localhost:8080/ors/v2/directions/foot-walking
with a body

{
  "coordinates": [[8.697610, 49.396228], [8.697610, 49.396228]],
}

Make sure that you also specify in the header 'Content-type: application/json` and it should work.

In the v1 api, coordinates are passed as a pipe separated list of coordinate pairs, so &coordinates=8.697609901428223,49.39622819171437|8.697609901428223,49.39622819171437 though the , and | should be url encoded

Hi @adam !

Thank you for your reply :slight_smile:

I tried your solution however here is what stands out:

I then wondered if I could use the same route as this: Dashboard | ORS

But if i do this call on your online API that’s work :frowning:

Any idea ? I apologize for the inconvenience and all these questions!

OK, so when using the v2 api, you either use the GET method with start=xxx&end=xxx in the querystring, OR you use the POST method whereby you have the information in the body. In the first image above, you are still sending it as a GET (the box next to the url).

Looking at the second item it looks like the profile for foot-walking hasn’t been built. Can you do a query to http://localhost:8080/ors/v2/status and post it? That will say what profiles are running.

Thanks @adam for the time you spend for me !

Indeed, I do not have a “foot-walking” profile, that is probably why I have no results on my calls.

I can’t figure out how to change my profile, do you have an idea?

Thank you so much !

You would need to have the profile turned on in your app.config. If you are using a custom one, you can copy the entry from our sample at https://github.com/GIScience/openrouteservice/blob/master/openrouteservice/src/main/resources/app.config.sample, and then just make sure that in the active: [...] has the profile in there

"active": [
            "car",
            "walking"
          ],
"profile-walking": {
            "profiles": "foot-walking",
            "parameters": {
              "encoder_options": "block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
1 Like

For further configuration, please check the github wiki as well:

1 Like

Ok that work! Thank you so much !