Maps client for local instance of openrouteservice

Hi, guys.
This is my first post and I want say the application is absolutely fantastic.
I’m trying to set up a local instance of openrouteservice (which is working) along with maps client.
I have changed configuration in maps client to my local server (localhost:8082) but it still doesn’t work.
The key “orsApiKey” is empty, I don’t know how to setup a local one for my local instance of the openrouteservice server; maybe that’s the error.

Thanks in advance for your help and as you have probably noticed, my mother language is not English, so, sorry if I make mistakes.

Do you have any logs you can share as to the reason why it is not working?

Also, I don’t think you need the orsApiKey for the localhost version of the OpenRouteService as the whole service is running on your computer.

Hi, @0zyxel0, thanks for answering.
I expected the local map client to trigger the same requests I did to test my local instance of openrouteservice to get directions. However, when I check the request, what I saw was
https://api.openrouteservice.org/v2/directions/driving-car/geojson

Same request to my local instance of openrouteservice didn’t work. Should I need to configure geojson service in a special way?.
When I check the services by status request I get:

{"engine":{"version":"6.7.0","build_date":"2022-04-05T08:03:17Z"},"services":["routing","isochrones","matrix","mapmatching"],"languages":["de","de-de","en","en-us","es","es-es","fr","fr-fr","gr","gr-gr","he","he-il","hu","hu-hu","id","id-id","it","it-it","ja","ja-jp","ne","ne-np","nl","nl-nl","pl","pl-pl","pt","pt-pt","ru","ru-ru","tr","tr-tr","zh","zh-cn"],"profiles":{"profile 1":{"profiles":"driving-car","creation_date":"","storages":{"WayCategory":{},"HeavyVehicle":{},"WaySurfaceType":{},"RoadAccessRestrictions":{"use_for_warnings":"true"}},"limits":{"maximum_distance":100000,"maximum_distance_dynamic_weights":100000,"maximum_distance_avoid_areas":100000,"maximum_waypoints":50}}}}

Hi @ethiel,

could you share the request to your local instance you tried?
Be aware that for the local endpoint you need http://localhost:8082/ors/v2/directions...

Also you might want to keep the api key for geocoding and just set the enpoints for directions and isochrones to your local instance (as the openrouteservice backend only includes directions, isochrones and matrix).

Best regards

Hi, @amandus.
Sure:
This one, which works:
http://localhost:8080/ors/v2/directions/driving-car?start=8.676581,49.418204&end=8.692803,49.409465

And this one, from the local map client, which doesn’t work:
http://localhost:8080/ors/v2/directions/driving-car/geojson
It’s a post or it should be (at least in the working instance, when I set up the properties agains the open routeservice engine with my API key, it is a post)

What’s the error of the request?
Check your browser console and network tab (f12). There might be a CORS issue depending on how you run your local ors instance.
Are there any errors?

Yes, related to CORS but I changed the web.xml file to add the filter. That’s not the issue. I think it’s related to geocoding… But does it mean a local instance can’t be running with all the services needed?.

Yes and no.
Take a look at

The map client currently only works if the geocoding is working (you can circumvent that issue by pasting in coordinates, but that’s rather hacky).

But if you have an API key, you could just keep the normal endpoint for geocoding which calls the openrouteservice API and just change the endpoint to directions and isochrones to your local one.

IF you would want a full local setup you would also need a Pelias geocoder instance, which is quite resource heavy.

I’m using coordinates… Why is this trying to use geocoder? Edited: I just read the GitHub request.

So, it seems is not possible to have directions / distances working in a local instance, since directions depends on geocoding to work.
Anyway, I only need distances for my application to work. Maybe I can use distance services in local.

If the interface styling and suitability for smaller devices is not too important, you could also try our classic maps client, which is decoupled from geocoding:
GitHub - GIScience/openrouteservice-app: The open source route planner app with plenty of features..

1 Like

Thanks for your help, @amandus. It has helped me tremendously.

1 Like