Google Map API V3. Unable to create custom polyline for TRANSIT directions

后端 未结 1 809
时光取名叫无心
时光取名叫无心 2021-01-23 07:15

I am unable to create custom polyline for transit directions on Google API. Only part of the route is rendered, not all. It works for driving, walking & cycling but not for

1条回答
  •  失恋的感觉
    2021-01-23 08:04

    A polylineOptions anonymous object is not (and shouldn't be) a google.maps.Polyline.

    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        var polyLineOptions = {
            strokeColor: '#FF0000'
          };
        var options = {};
        options.directions = response;
        options.map = map;
        options.polylineOptions = polyLineOptions;
        //options.suppressMarkers = true;
        directionsDisplay.setOptions(options);// = new google.maps.DirectionsRenderer(options);
        polyLine.setMap(map);
        //directionsDisplay.setDirections(response);
      }
    });
    

    updated fiddle

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