mapbox / mapbox-sdk-js

A JavaScript client to Mapbox services, supporting Node, browsers, and React Native
Other
711 stars 185 forks source link

getDirections: waypoint.separatesLegs #343

Open noway opened 4 years ago

noway commented 4 years ago

Hello, the iOS version of getDirections api has waypoint.separatesLegs: https://docs.mapbox.com/ios/api/directions/0.30.0/Classes/Waypoint.html#/Waypoint

How to achieve the same in javascript? Looking at https://github.com/mapbox/mapbox-sdk-js/blob/master/services/directions.js#L65 , it it not there.

I need separateLegs in javascript because I generate route object in javascript and then use it for [[MBRoute alloc] initWithJSON:self->_route waypoints:mbWaypoints routeOptions:routeOptions]; in iOS

noway commented 4 years ago

I've tried setting approaches to ';;;' but that generated the same route... so not sure how to implement waypoint.separatesLegs in javascript

noway commented 4 years ago

According to https://github.com/mapbox/MapboxDirections.swift/blob/2fcaf62cbe9f6491b1991b5f811e731e1a825235/Sources/MapboxDirections/MBDirectionsOptions.swift#L517 they implement it using waypoints attribute on api: https://docs.mapbox.com/api/navigation/#retrieve-directions

Can we get waypoints attribute support for getDirections js sdk?

noway commented 4 years ago

I would label this as a feature request