Hide polyline from A to B using in Google Map api v3

前端 未结 3 909
逝去的感伤
逝去的感伤 2021-01-16 01:54

I am displaying google map with code below, I want to hide Polyline between A to B. All answers on google talk about creating an array and then doing array.setmap(null

3条回答
  •  情歌与酒
    2021-01-16 02:22

    If you want to render the directions but hide the polyline, use the DirectionsRendererOptions suppressPolylines.

    function initialize() {
    
        var rendererOptions = {
            suppressPolylines: true,
            map: map,
            draggable: true               
        }
        // Instantiate a directions service.
        directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);
    

提交回复
热议问题