步行路线规划可以根据起终点获取驾车步行规划数据,并可以通过Polyline绘制出步行路线,效果图:
wr: WalkingRoute = new WalkingRoute();// 步行路线规划wr.getRouteLines(fromArr, toArr, (res: routes) => {let routes = res.routes;let line: Array<Latlng> = []// 解析轨迹for (let i = 0; i < routes.length; i++) {let step: step = routes[i]let paths: Array<Latlng> = step.pathfor (let i = 0; i < paths.length; i++) {let ll: Latlng = new Latlng(paths[i].lat, paths[i].lng)line.push(ll)}}// 绘制轨迹let polyline:Polyline = new Polyline({points: line,fillcolor: '#6af',width: 10,join: SysEnum.LineJoinType.ROUND,cap: SysEnum.LineCapType.ROUND,isThined: true,isGeodesic: true});this.mapController?.addOverlay(polyline);}, {})
上一篇
下一篇
本篇文章对您是否有帮助?