更新时间:2026/02/27 14:52
1. 构造 RoutePlanOption
代码
// 起终点位置let startPt: RouteNodeInfo = new RouteNodeInfo()let endPt: RouteNodeInfo = new RouteNodeInfo()startPt.location = new LatLng(40.048241,116.296165)endPt.location = new LatLng(40.04721,116.316372) // 构造 RoutePlanOption ,设置起终点let param: RoutePlanOption = new RoutePlanOption().startNodeInfo(startPt).endNodeInfo(endPt)2. 发起路线规划
代码
service.routePlanService().routePlanWithRouteNode(param,new Object({ //引擎开始路线规划 onRoutePlanStart: () => { }, // 正常规划成功 onRoutePlanSuccess: () => { // 展示路线 service.routePlanService().displayRoutePlanResult() }, // 正常规划失败 onRoutePlanFail: (error: RoutePlanError) => { }}) as IRoutePlanListener)本篇文章对您是否有帮助?