how to change the color of route in google maps v3

前端 未结 2 487
长情又很酷
长情又很酷 2020-12-05 10:10

I am using this code to get directions between two points. Is it possible to change the color of the route from blue? I am not using polyline in my code.

Thanx in ad

2条回答
  •  星月不相逢
    2020-12-05 10:28

    you can change the color by changing the stroke color :) as simple as that

        directionsService = new google.maps.DirectionsService();
        directionsDisplay = new google.maps.DirectionsRenderer({ polylineOptions: { strokeColor: "#8b0013" } });
        directionsDisplay.setMap(map);
        directionsDisplay.setOptions({ suppressMarkers: true });
    
    
            calcRoute();
    

提交回复
热议问题