Is it possible to convert / pass Openrouteservice Directions response to Mapbox Navigation SDK?

Hi all, as from topic title, I’m using the Openrouteservice for an app because it gives me a profile like “cycling-mountain”, instead Mapbox Directions Api offers only a generic “cycling” option.

But in the same app I have to use Mapbox Navigation SDK as navigator and this works with Mapbox Directions Api. I’ve compared the Json produced by Openrouteservice Directions Api and Mapbox Api and, though they have similarities, Mapbox Api have more properties that are “read” by Mapbox Navigation SDK to generate the turn-by-turn navigation.

It could bee possible to convert one format in another, so I can take advantage of the “cycling-mountain” profile of Openrouteservice in Mabox Navigator?

Hi @aminta

Openrouteservices returns a geojson document.
I am not aware of any service/tool that does this conversion. But if you know what the missing properties are, you could do this in your code. Some people have discussed this here: dataset - Convert JSON into GeoJSON compatible with Mapbox Studio - Stack Overflow

Best,

1 Like

Many thanks! To be more exact Directions Api return not a GeoJSON but a JSON with a “routes” property that includes all the “segments” → “steps” to follow the route.

Hey @aminta

Yes, you are right. Other endpoints return a geojson, but not directions :). Thans for noticing that.