How to use roundtrip in react native

Hello,

Im looking to implement round trip in my program where i get a user input for distance then i map a route from their location with a distance of 5KM. I have had a look at the API calls in the documents but i dont see anything that i can use for round trips.

https://openrouteservice.org/dev/#/api-docs

Hi @Williamk28

round_trip is a nested parameter of options in https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/post

You can also use out Javascript library https://github.com/GIScience/openrouteservice-js to interact with the ORS API.

Hi @amoncaldas

I managed to get round_trip working using openrouteservies-js, is there a way to display this on a map? I have returned the route as a String and im using react-native-maps.

Hey @Williamk28
Yes, there are ways to display it on a map. According to the react-native-maps documentation it accepts a geojson as an input. This is exactly what the API/ors-js library returns.