Removing Directions markers from the Google Maps API V3

眉间皱痕 提交于 2019-11-30 03:30:31

Set the suppressMarkers option to true when creating your DirectionsRenderer object and then the markers won't show up. You could also change the style or icon of the markers. See the API spec for DirectionsRendererOptions for other properties you can set.

   ... 
   directionsDisplay = new google.maps.DirectionsRenderer({suppressMarkers: true});
   ...

EDIT: It looks like the API changed a little bit since my original answer almost 6 years ago, so the answer from @joni-jones is now the correct way. I tweaked my example above to reflect that.

I had a similar problem. The previous solution did not help me. But I tried this:

var directionsDisplay = new google.maps.DirectionsRenderer({suppressMarkers: true});
And it's work.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!