Reputation: 18544
The Mapbox web directions API supports avoiding motorways Link.
How is this done in the Mapbox iOS SDK?
Upvotes: 0
Views: 282
Reputation: 636
The Mapbox Navigation SDK for iOS uses Direction
s objects to provide directions between waypoints. You may provide a RouteOptions
object to each Direction
to specify criteria for the results returned by the Mapbox Directions API. As noted in the changelog for the SDK here, on the RouteOptions
object there is a roadClassesToAvoid
option where you can specify a RoadClass
object to avoid, such as motorway
. The source code for the motorway
RoadClass
can be found here, namely:
public static let motorway = RoadClasses(rawValue: 1 << 3)
The Nav SDK's NavigationRouteOptions
extends RouteOptions
. So, to calculate directions avoiding motorways in your iOS app, you should specify the roadClassesToAvoid
option on a NavigationRouteOptions
passed to Directions.shared.calculate
. This example for a basic navigation app is a great place to get started.
Upvotes: 2