如何将谷歌 Map 的距离和时间信息添加到连接两点的折线?

loading...


0

我正在研究Ionic应用程序并使用谷歌提供的离子谷歌 Map 原生和方向服务我通过使用以下代码绘制了多条路线:

calculateAndDisplayRoute() {
var points = [];
this.directionsService.route({
  origin: this.start,
  destination: this.end,
  travelMode: 'DRIVING',
  provideRouteAlternatives: true


}, (response, status) => {
  if (status === 'OK') {
    var step = 1;

    for(var j=0;j<response.routes.length;j++){

      points=[]
      for (var i = 0; i < response.routes[j].overview_path.length; i++) {
        points.push(response.routes[j].overview_path[i].toJSON())
      }
      let position=points[20]
      this.drawRoutePolyLine(points,j,position)
      step=step+1
    }


  } else {
    window.alert('Directions request failed due to ' + status);
  }
});

帮助我添加infowindow

loading...

0回答

No Data

评论

暂时没有评论!