Skip to main content

AR navigation

Mapbox Vision AR for iOS is a high-level framework that sits on top of the Mapbox Vision SDK for iOS. Vision AR manages the navigation route, translates it to the core library, and renders an AR navigation route on top of the live video stream from the device’s built-in camera.

Integration with other Mapbox tools

Vision AR is intended to be used with the Mapbox Navigation SDK. Vision AR sits on top of the Vision SDK for iOS and next to the Mapbox Directions API and Mapbox Core Navigation.

Route line

To project a route line on the road, start by generating the route. Use MapboxDirections.swift to create a new Route object, which you can use to display a route on a map or start a navigation sequence. In most cases, you’ll also use the NavigationRouteOptions class (a subclass of Mapbox Directions for Swift’s RouteOptions class) to set a few options. Read more about route generation in the Navigation SDK documentation.

Then, create a VisionARManager and set the route to the route you generated.

visionARManager = VisionARManager.create(visionManager: visionManager, delegate: self)

let origin = CLLocationCoordinate2D()
let destination = CLLocationCoordinate2D()
let options = NavigationRouteOptions(coordinates: [origin, destination], profileIdentifier: .automobile)

// query a navigation route between location coordinates and pass it to VisionARManager
Directions.shared.calculate(options) { [weak self] (waypoints, routes, error) in
guard let route = routes?.first else { return }
self?.visionARManager.set(route: Route(route: route))
}

See the full example code in the Basic AR navigation example.

Was this page helpful?