Parallel Road Detection
Overview
Starting with Navigation SDK v6.6.0, parallel road detection supports both main/auxiliary road status detection and elevated road (overpass) status detection. When the user's location is on a road with two adjacent parallel routes—such as a city expressway's main road and its service road, or the upper and lower levels of a ring-road overpass—the SDK triggers a callback indicating that the user can manually switch between parallel roads to trigger route recalculation.
/// Types of switchable parallel roads. Available since v5.3.0.
typedef NS_ENUM(NSInteger, AMapNaviParallelRoadStatusFlag)
{
AMapNaviParallelRoadStatusFlagNone = 0, ///< 0: No switchable parallel road
AMapNaviParallelRoadStatusFlagAssist = 1, ///< 1: Can switch to the auxiliary road
AMapNaviParallelRoadStatusFlagMain = 2, ///< 2: Can switch to the main road
};
/// Types of switchable elevated road levels. Available since v6.6.0.
typedef NS_ENUM(NSInteger, AMapNaviElevatedRoadStatusFlag)
{
AMapNaviElevatedRoadStatusFlagNone = 0, ///< 0: No switchable elevated road
AMapNaviElevatedRoadStatusFlagUnder = 1, ///< 1: Can switch to the lower level
AMapNaviElevatedRoadStatusFlagUp = 2, ///< 2: Can switch to the upper level
};
/// Parallel road status information. Available since v5.3.0.
@interface AMapNaviParallelRoadStatus : NSObject
/// Main/auxiliary road indicator (the type of parallel road that can be switched to, if available).
@property (nonatomic, assign) AMapNaviParallelRoadStatusFlag flag;
/// Elevated road level indicator (the level that can be switched to, if available). Available since v6.6.0.
@property (nonatomic, assign) AMapNaviElevatedRoadStatusFlag hwFlag;
@end
/**
* @brief Notifies whether a parallel road switch is currently possible, including main/auxiliary roads and elevated road levels. Available since v5.3.0.
* @param driveManager The driving navigation manager instance.
* @param parallelRoadStatus Parallel road status information. See AMapNaviParallelRoadStatus.
*/
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateParallelRoadStatus:(nullable AMapNaviParallelRoadStatus *)parallelRoadStatus;For example, if parallelRoadStatus.flag is AMapNaviParallelRoadStatusFlagAssist, the SDK assumes the vehicle is currently on the main road. If the user is indeed on the main road, no action is required. However, if the user is actually on the auxiliary road, the SDK's assumption is incorrect. In this case, developers can use the callback value to provide a UI that allows the user to manually switch the parallel road by calling the following method on AMapNaviDriveManager:
/// Parallel road switch information. Available since v6.6.0.
@interface AMapNaviParallelRoadInfo : NSObject
/// Switch type: 1 = main/auxiliary road switch; 2 = elevated road level switch.
@property (nonatomic, assign) NSInteger type;
@end
/**
* @brief Switches the parallel road, including main/auxiliary road and elevated road level switches. This method must be used in conjunction with the driveManager:updateParallelRoadStatus: callback from AMapNaviDriveDataRepresentable. Available since v5.3.0.
* @param parallelRoadInfo Parallel road switch information. See AMapNaviParallelRoadInfo.
*/
- (void)switchParallelRoad:(AMapNaviParallelRoadInfo *)parallelRoadInfo;The following images illustrate a reference UI for the parallel road switch feature:


