Document Navigation SDK for iOS Guides Route Planning Walking Routing

Walking Routing

Overview

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

AMapNaviWalkManager — The walking navigation management class. It provides methods for route planning, pre-trip route selection, and rerouting during navigation.  

Important: Starting from Navigation SDK 7.4.0, the init method of AMapNaviWalkManager is deprecated. Use the singleton [AMapNaviWalkManager sharedInstance] instead. When the class is deallocated (for example, when the navigation view controller is popped), call [AMapNaviWalkManager destroyInstance] to destroy the singleton. If the singleton is not destroyed successfully, check whether it is strongly referenced.

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

<AMapNaviWalkDataRepresentable> — The walking navigation data protocol. It provides callbacks for real-time data during route calculation and navigation, such as guidance information (NaviInfo) and positioning data.

Notes

- Route planning requires a network connection.

- Start and end points can be obtained 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.

- Three methods are available for walking route planning, as shown in the table below:

Method

Parameters

Return Value

Description

calculateWalkRouteWithEndPoints:

endPoints: Destination coordinates

BOOL — Indicates whether the required conditions and parameter validation for route planning are successful. Does not indicate whether the route calculation itself succeeds.

Route planning without a specified start point (uses the current location as the start point).

calculateWalkRouteWithStartPoints:endPoints:

startPoints: Start coordinates; endPoints: Destination coordinates

BOOL — Same as above.

Route planning with both start and end points specified as coordinates.

calculateWalkRouteWithStartPOIInfo:endPOIInfo:strategy:

startPOIInfo: Start POIInfo; endPOIInfo: Destination POIInfo; strategy: Route calculation strategy

BOOL — Same as above.

Route planning with start and end points specified as POIInfo objects. The start point can be nil; the SDK uses the current location as the start point.

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

Usage

Step 1: Set Start and End Points

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

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

Step 2: Calculate the Route

// Calculate a walking route using POI
[[AMapNaviWalkManager sharedInstance] calculateWalkRouteWithStartPOIInfo:self.startPOIInfo
                                                              endPOIInfo:self.endPOIInfo
                                                                strategy:AMapNaviTravelStrategyMultipleDefault];

Step 3: Handle the Result

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

- (void)walkManagerOnCalculateRouteSuccess:(AMapNaviWalkManager *)walkManager
{
    NSLog(@"onCalculateRouteSuccess");
    // Display the route or start navigation
}