Google Maps Route Generation with Waypoints

后端 未结 1 1557
故里飘歌
故里飘歌 2021-01-07 14:23

I\'ve got an existing app that tracks vehicles and renders their polyline on a map, and I want to be able to import these polylines into another app using the routing servic

1条回答
  •  别那么骄傲
    2021-01-07 15:20

    waypoints.push(new google.maps.LatLng(coordinates[index].lat(), coordinates[index].lng()));

    the 'waypoints' property of the DirectionsRequest object definition should be an Array of google.maps.DirectionsWaypoint object definitions https://developers.google.com/maps/documentation/javascript/3.exp/reference#DirectionsWaypoint

    So, try:

    waypoints.push(
        {
            location: new google.maps.LatLng(coordinates[index].lat(), coordinates[index].lng())
        }
    );
    

    0 讨论(0)
提交回复
热议问题