Mapbox iOS 避开高速公路/高速公路
Mapbox iOS Avoid Motorways / Highways
Mapbox 网络导航 API 支持避开高速公路 Link。
这在 Mapbox iOS SDK 中是如何完成的?
的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,即:
public static let motorway = RoadClasses(rawValue: 1 << 3)
用于基本导航应用程序的 Nav SDK 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 是一个很好的起点。
Mapbox 网络导航 API 支持避开高速公路 Link。
这在 Mapbox iOS SDK 中是如何完成的?
的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,即:
public static let motorway = RoadClasses(rawValue: 1 << 3)
用于基本导航应用程序的 Nav SDK 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 是一个很好的起点。