Document Navigation SDK for iOS Guides Route Planning Cycling Routing

Cycling Routing

Overview

To implement ride route planning functionality, you need to understand the following three classes:

AMapNaviRideManager — The ride navigation manager class. It provides methods for route planning, pre-trip route selection, and rerouting during navigation.  

Important: Starting with Navigation SDK 7.4.0, the init method of AMapNaviRideManager is deprecated. Use the singleton [AMapNaviRideManager sharedInstance] instead. Call [AMapNaviRideManager destroyInstance] in the dealloc method or at an appropriate time (such as when the navigation view controller is popped) to destroy the singleton. If destruction fails, check whether the singleton is strongly referenced.

<AMapNaviRideManagerDelegate> — The ride navigation manager delegate protocol. It provides callbacks for events during route calculation and navigation, such as route planning success/failure, TTS strings, weak GPS signal, and arrival at the destination.

<AMapNaviRideDataRepresentable> — The ride navigation data protocol. It provides real-time data callbacks during route calculation and navigation, including guidance information (NaviInfo) and location data.

Notes

- Route planning requires a network connection.

- You can obtain start and end point information in multiple ways, such as using the coordinate picker to query coordinates, or using the POI search in the Search SDK to find points of interest.

- The following three ride route planning methods are available:

Method

Parameters

Return Value

Description

calculateRideRouteWithEndPoint:

endPoint: Destination coordinate

BOOL — Indicates whether parameter validation succeeded, not whether route calculation succeeded.

Ride route planning with only a destination coordinate. (Internally uses the current location as the start point.)

calculateRideRouteWithStartPoint:endPoint:

startPoint: Start coordinate

endPoint: Destination coordinate

BOOL — Indicates whether parameter validation succeeded, not whether route calculation succeeded.

Ride route planning with start and end coordinates.

calculateRideRouteWithStartPOIInfo:endPOIInfo:strategy:

startPOIInfo: Start POI info

endPOIInfo: Destination POI info

strategy: Route calculation strategy

BOOL — Indicates whether parameter validation succeeded, not whether route calculation succeeded.

Ride route planning with POI information. (The start point can be nil; the SDK uses the current location as the start point.)

Recommendation: Use the -calculateRideRouteWithStartPOIInfo:endPOIInfo:strategy: method for route planning. The SDK automatically completes additional information based on the POIId or startPOIInfo.startAngle, resulting in more reasonable routes and reducing detours.

Usage

Step 1: Set Start and End Point Information

// Initialize start and end points using POI info
self.startPOIInfo = [[AMapNaviPOIInfo alloc] init];
self.startPOIInfo.mid = @"B0FFFAB6J2";

self.endPOIInfo = [[AMapNaviPOIInfo alloc] init];
self.endPOIInfo.mid = @"B0FFIA9OE8";

Step 2: Plan the Route

// Plan a ride route using POI info
[[AMapNaviRideManager sharedInstance] calculateRideRouteWithStartPOIInfo:self.startPOIInfo endPOIInfo:self.endPOIInfo strategy:AMapNaviTravelStrategyMultipleDefault];

Step 3: Handle the Result

When the ride route is successfully calculated, the -rideManagerOnCalculateRouteSuccess: callback is triggered. In this callback, you can display the planned route or start navigation directly.

- (void)rideManagerOnCalculateRouteSuccess:(AMapNaviRideManager *)rideManager
{
    NSLog(@"onCalculateRouteSuccess");
    // Display the route or start navigation
}