且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从谷歌地图API V3删除路线标记

更新时间:2023-08-30 17:41:15

燮pressMarkers 选项设置为true创建当你的的DirectionsRenderer 对象,然后标记将不会出现。你也可以改变标记的风格和图标。请参阅API SPEC DirectionsRendererOptions 了解,您可以设置其他属性。

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});
   ...

编辑:它看起来像API差不多6年前改变了一点点,因为我原来的答复,所以从@乔尼·琼斯的答案是现在的正确方法。我调整我上面的例子来反映这一点。