骑行路线规划可以根据起终点获取骑行路线规划数据,并可以通过添加Polyline绘制出骑行路线。
效果图如下:
br: BikingRoute = new BikingRoute();// 获取骑行路线规划br.getRouteLines(fromArr, toArr, (res:routeres) => {let resultLine: Array<Latlng> = []for (let i = 0; i < res.routes.length; i++) {// 选取第一个路线规划方案let routes = res.routes[i];// 解析路线let line:Array<Latlng> = [];line = parseStringToLatLngArray(routes.path);resultLine = resultLine.concat(line)}// 绘制路线let polyline:Polyline = new Polyline({points: resultLine,fillcolor: '#6af',width: 10,join: SysEnum.LineJoinType.ROUND,cap: SysEnum.LineCapType.ROUND,isThined: true,isGeodesic: true});this.mapController?.addOverlay(polyline);}, {})
上一篇
下一篇
本篇文章对您是否有帮助?