Route to Navigation points

The Navigation SDK for iOS offers enhanced ways to specify waypoints, providing more accurate routing and a better arrival experience, especially for destinations with multiple entrances or specific access points. You can route to precise locations using a navigationPointToken or by combining location coordinates with a Place ID for added context.

The destination highlighting feature will continue to be performed if applicable.

Background

Prior to v10.10, you could define a Waypoint using either location coordinates or a Place ID. While sometimes effective, routing solely to a latitude and longitude can sometimes lead to suboptimal drop-off or pick-up points, particularly for large venues, parks, or buildings with multiple entrances. The result might snap to the nearest road segment, which may not be the most convenient or correct access point.

The enhanced waypoint options address this by allowing you to provide more context.

Use a Navigation Point token

For the most precise routing to specific access points like entrances, loading docks, or designated pick-up areas, you can use a navigationPointToken.

This token is obtained by calling the Destinations method of the Geocoding API. It represents a specific, routable navigation point associated with a place.

To specify a Navigation Point token:

  1. Obtain a navigationPointToken from the Destinations method of the Geocoding API response.

  2. Specify that navigationPointToken when you create a GMSNavigationWaypoint.

Note: You cannot simultaneously specify a Navigation point token along with a location and PlaceID.

Swift

// Create a waypoint using a navigation endpoint token
let waypointTwo = GMSNavigationWaypoint(
  navigationPointToken: "ChIJALijSXPhQkARHmIozCCbXsASEgkFVjYHGH6PgBFrbM7wl3.."
  title: "Sydney Opera House")

// Route to the waypoint
navigator.setDestinations([waypointTwo]) { [weak self] routeStatus in
   self?.handleRouteCallback(status: routeStatus)
}