Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

A complete turn-by-turn navigation UI in your iOS application

$
0
0

The new Mapbox Navigation SDK for iOS makes it easy to add a complete turn-by-turn navigation experience to your iOS application. The navigation SDK builds upon our January releases of core navigation components (previously known as MapboxNavigation.swift), runtime styling for maps, and real-time, traffic-aware directions. We’ve added some important features that give your users more reasons to stay within your application:

  • A ready-to-go, drop-in navigation UI
  • Smoother location updates
  • Voice instructions powered by Amazon Polly

A ready-to-go, drop-in navigation UI

With just a few lines of Swift or Objective-C code, your application can take advantage of the Mapbox Navigation SDK’s ready-made route view controller:

// Obtain a route from MapboxDirections.swift and create a route view controller to follow it.letviewController=NavigationUI.routeViewController(for:selectedRoute)// Optionally configure Amazon Polly with a pool ID. Without a pool ID, the SDK will use AVSpeechSynthesizer instead.viewController.voiceController?.identityPoolId="<#Your AWS Pool Id#>"// Smooth out user location updates to more closely match the route line.viewController.routeController.snapsUserLocationAnnotationToRoute=true// Present the route view controller.present(viewController,animated:true)// That’s it! The SDK takes care of rerouting, voice announcements, and UI updates.

Mapbox Navigation iOS SDK

The Mapbox Navigation SDK provides several options for customizing colors and other details. It also supports storyboard integration. If you need more advanced customization, or if you want the spatial and timing logic without the full UI, you can build your own navigation experience around the Mapbox Core Navigation library that’s included in the SDK.

Smoother location updates

Even in normal driving conditions, an iPhone may report an occasional inaccurate location update. The Mapbox Navigation SDK now corrects these location updates to more closely conform to the route line, resulting in a more consistent view of the road ahead, smoother transitions from step to step, and fewer rerouting attempts.

Voice instructions powered by Amazon Polly

The Mapbox Navigation SDK incorporates turn instructions in several languages, reading them aloud using Amazon Polly. Unlike the AVSpeechSynthesizer API built into iOS, Amazon Polly delivers more natural-sounding pronunciation of road names and numbers. For example, the following turn instruction contains a street name with a relatively unusual spelling pattern:

In 400 feet turn left onto East Coeur D’Alene Avenue then merge left onto I-280

AVSpeechSynthesizer not only mangles the street name but also reads the route number as “eye two hundred and eighty”:

With Amazon Polly, the Mapbox Navigation SDK correctly pronounces both the street name and the route number (as “eye two-eighty”):

Natural-sounding pronunciation helps your users comprehend the turn instructions being read aloud by your application, reducing the chances of misunderstanding and missed turns.

Add a complete navigation experience to your application today with the Mapbox Navigation SDK for iOS, and stay tuned for our Navigation SDK for Android.


Viewing all articles
Browse latest Browse all 2230

Trending Articles