Google maps api 3 如何删除起点和终点标记,但仍保留白色小圆点?

Google maps api 3 如何删除起点和终点标记,但仍保留白色小圆点?,google-maps-api-3,Google Maps Api 3,我使用GoogleMapsDirections api和运输模式创建地图(代码如下)。我想删除起点和终点标记,但仍保留地图上的白色小圆点 <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps API v3 Directions Exampl

我使用GoogleMapsDirections api和运输模式创建地图(代码如下)。我想删除起点和终点标记,但仍保留地图上的白色小圆点

<!DOCTYPE html>
<html> 
<head> 
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
   <title>Google Maps API v3 Directions Example</title> 
   <script type="text/javascript" 
           src="http://maps.google.com/maps/api/js?sensor=false"></script>
<style>
html, body, #map-canvas {
  height: 100%;
  margin: 0px;
  padding: 0px
}
#panel li:before{
  padding: 3px;
  display:block;
  color:#fff;
  font-weight:bold;
} 
#panel li:nth-child(1):before{
  content:'startLeg:TRANSIT';
  background:green;
} 
#panel li:nth-child(2):before{
  content:'middleLeg:TRANSIT';
  background:blue;
} 
#panel li:nth-child(3):before{
  content:'endLeg:TRANSIT';
  background:red;
  color:#000;
}
</style>
</head> 
<body> 
   <div id="map" style="width: 800px; height: 1800px; float: left;"></div> 
   <div id="panel" style="width: 450px; float: right;"></div>

   <script type="text/javascript"> 
function initialize() {
    var goo         = google.maps,
        map         = new goo.Map(document.getElementById('map'),
       {
         center  : new goo.LatLng(23, 122),//地圖中心點
         zoom    : 7,
         styles: [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}]
        }),
        App = { 
          map               : map,
          bounds            : new goo.LatLngBounds(),
          directionsService : new goo.DirectionsService(),    
          directionsDisplay: new goo.DirectionsRenderer({
          map             : map,
          preserveViewport: true,
          suppressMarkers : false,
          polylineOptions : {
            strokeColor:'green',strokeOpacity: 0.5,
            strokeWeight: 7},
          panel           : document.getElementById('panel').appendChild(document.createElement('li'))})
        }
        startLeg   = {
          origin     :  '(25.0327698,121.5681653)',
          destination :  '(25.0404699,121.5635321)',
          travelMode  :  goo.DirectionsTravelMode.TRANSIT},             
        App.directionsService.route(startLeg, function(result, status) {
          if (status == google.maps.DirectionsStatus.OK) {
            App.directionsDisplay.setDirections(result);
            App.map.fitBounds(App.bounds.union(result.routes[0].bounds));
          }
        }); 
}
google.maps.event.addDomListener(window, 'load', initialize);
</script> 
</body> 
</html>

谷歌地图API v3方向示例
html,正文,#地图画布{
身高:100%;
边际:0px;
填充:0px
}
#李小组:之前,{
填充:3倍;
显示:块;
颜色:#fff;
字体大小:粗体;
} 
#小组李:第n个孩子(1):之前{
内容:'例如:运输';
背景:绿色;
} 
#小组李:第n个孩子(2):之前{
内容:'中段:中转';
背景:蓝色;
} 
#小组李:第n个孩子(3):之前{
内容:'endLeg:TRANSIT';
背景:红色;
颜色:#000;
}
函数初始化(){
var goo=google.maps,
map=new goo.map(document.getElementById('map'),
{
中心:新固拉丁(23122)//地圖中心點
缩放:7,
样式:[{“featureType”:“景观”、“样式器”:[{“饱和度”:-100}、{“亮度”:65}、{“可见性”:“on”}、{“featureType”:“poi”、“样式器”:[{“饱和度”:-100}、{“亮度”:51}、{“可见性”:“简化”}、{“featureType”:“road.highway”、“样式器”:[{“饱和度”:-100}、{“可见性”:“简化”}、{“road.Article”;“样式器”:[{“饱和度”:-100},{“亮度”:30},{“可见性”:“on”},{“特征类型”:“road.local”,“stylers”:[{“饱和度”:-100},{“亮度”:40},{“可见性”:“on”},{“特征类型”:“transit”,“stylers”:[{“饱和度”:-100},{“可见性”:“简化”},{“特征类型”:“行政省”,“stylers”:[{“可见性”:“offelementType:“标签”、“样式器”:[{“可见性”:“在”}、{“亮度”:-25}、{“饱和度”:-100}]}、{“特征类型”:“水”、“元素类型”:“几何体”、“样式器”:[{“色调”:“#ffff00”}、{“亮度”:-25}、{“饱和度”:-97}]
}),
App={
地图:地图,
边界:新的goo.LatLngBounds(),
DirectionService:new goo.DirectionService(),
方向显示:新建goo.DirectionsRenderer({
地图:地图,
对,,
对:错,,
多段线选项:{
笔划颜色:“绿色”,笔划不透明度:0.5,
冲程重量:7},
面板:document.getElementById('panel').appendChild(document.createElement('li'))}
}
惊吓,惊吓{
来源:“(25.0327698121.5681653)”,
目的地:“(25.040464699121.5635321)”,
travelMode:goo.Directions travelMode.TRANSIT},
App.directionsService.route(例如,函数(结果、状态){
if(status==google.maps.directionstatus.OK){
应用程序方向显示设置方向(结果);
App.map.fitBounds(App.bounds.union(result.routes[0].bounds));
}
}); 
}
google.maps.event.addDomListener(窗口“加载”,初始化);

您不能只渲染某些标记(至少当前是这样)。您可以设置
suppressMarkers:true
,然后解析以显示要渲染的标记

代码片段:

函数初始化(){
var goo=google.maps,
map=new goo.map(document.getElementById('map'){
中心:新固拉丁(23122)//地圖中心點
缩放:7,
风格:[{
“特色类型”:“景观”,
“造型师”:[{
“饱和”:-100
}, {
“轻盈”:65
}, {
“可见性”:“打开”
}]
}, {
“featureType”:“poi”,
“造型师”:[{
“饱和”:-100
}, {
“轻盈”:51
}, {
“可见性”:“简化”
}]
}, {
“功能类型”:“道路.公路”,
“造型师”:[{
“饱和”:-100
}, {
“可见性”:“简化”
}]
}, {
“功能类型”:“道路干线”,
“造型师”:[{
“饱和”:-100
}, {
“轻盈”:30
}, {
“可见性”:“打开”
}]
}, {
“功能类型”:“road.local”,
“造型师”:[{
“饱和”:-100
}, {
“轻盈”:40
}, {
“可见性”:“打开”
}]
}, {
“featureType”:“transit”,
“造型师”:[{
“饱和”:-100
}, {
“可见性”:“简化”
}]
}, {
“特征类型”:“行政省”,
“造型师”:[{
“可见性”:“关闭”
}]
}, {
“功能类型”:“水”,
“elementType”:“标签”,
“造型师”:[{
“可见性”:“打开”
}, {
“亮度”:-25
}, {
“饱和”:-100
}]
}, {
“功能类型”:“水”,
“elementType”:“几何体”,
“造型师”:[{
“色调”:“ffff00”
}, {
“亮度”:-25
}, {
“饱和度”:-97
}]
}]
}),
应用={
地图:地图,
边界:新的goo.LatLngBounds(),
DirectionService:new goo.DirectionService(),
方向显示:新建goo.DirectionsRenderer({
地图:地图,
对,,
对,,
多段线选项:{
strokeColor:'绿色',
笔划不透明度:0.5,
冲程重量:7
},
面板:document.getElementById('panel').appendChild(document.createElement('li'))
})
}
惊吓,惊吓{
来源:“(25.0327698121.5681653)”,
目的地:“(25.040464699121.5635321)”,
travelMode:goo.Directions travelMode.TRANSIT
},
App.directionsService.route(例如,函数(结果、状态){
if(status==google.maps.directionstatus.OK){
应用程序方向显示设置方向(结果);
对于(var i=0;i