Leaflet Routing - ORS V2 Updates

Hi all,

I am a junior developer, having recently graduated from a coding bootcamp, and used Openrouteservice, Leaflet, and GraphHopper in the final project.

Website - https://thereandback.surge.sh/
GitHub - GitHub - AndrewHulme/route_planner: ThereAndBack - generates circular routes for a given distance and starting location

Due the the recent Openrouteservice API upgrade to V2 the routing/directions are not working any more.

I have uploaded an screenshot example of how we use Openrouteservice for the router - L.Routing.openrouteservice.. on line 59.

Can anyone help? What is the easiest way to get our website working again?

As I mentioned we are all relatively new to coding.

Any help would be greatly appreciated!

Thank you :slight_smile:

Hi @AndrewHulme,

Please take a look at our api documentation and generate a JS example code to understand how you can request the v2/directions endpoints in JavaScript:
https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/post

You could also use the get request but would not have additional options then.

A short search also got me this: Added API Version 2 (V2) by TheJltres · Pull Request #6 · willmorejg/lrm-openrouteservice · GitHub
guess that’s what you need

Hi @amandus,

Thank you so much, that pull request link at the bottom was just what we needed.

Hope you have a good evening.