Google maps api 3 谷歌地图API,生成直线路径而不是圆路径
生成的路径由一系列圆组成。我希望它是一条线。谢谢Google maps api 3 谷歌地图API,生成直线路径而不是圆路径,google-maps-api-3,Google Maps Api 3,生成的路径由一系列圆组成。我希望它是一条线。谢谢 var directionsDisplay = new google.maps.DirectionsRenderer({ map:map, polylineOptions:{strokeColor: '#98c28a', strokeOpacity: 0, strokeWeight: 4, icons: [{ icon: { path: google.map
var directionsDisplay = new google.maps.DirectionsRenderer({
map:map, polylineOptions:{strokeColor: '#98c28a',
strokeOpacity: 0,
strokeWeight: 4,
icons: [{
icon: {
path: google.maps.SymbolPath.CIRCLE,
fillColor: '#98c28a',
fillOpacity: 1,
scale: 2,
strokeColor: '#98c28a',
strokeOpacity: 1,
},
offset: '0',
repeat: '10px'
}]}, suppressMarkers:true });
从多段线定义中删除图标,并使笔划不透明度非零
代码段:
函数初始化{
var map=new google.maps.map
document.getElementByIdmap_画布{
中心:新google.maps.LatLng37.4419,-122.1419,
缩放:13,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var directionsDisplay=新建google.maps.DirectionsRenderer{
地图:地图,
多段线选项:{
strokeColor:'98c28a',
笔划不透明度:1.0,
冲程重量:4,
},
真的吗
};
var directionsService=新的google.maps.directionsService;
方向服务.路线{
产地:纽约州纽约市,
目的地:马萨诸塞州波士顿,
travelMode:“驾驶”
},函数响应,状态{
如果状态=='确定'{
directionsDisplay.setDirectionsresponse;
}否则{
window.alert'Directions请求由于'+状态而失败;
}
};
}
google.maps.event.AddDomainListenerWindow,加载,初始化;
html,
身体
地图画布{
身高:100%;
宽度:100%;
边际:0px;
填充:0px
}
var directionsDisplay = new google.maps.DirectionsRenderer({
map:map,
polylineOptions:{
strokeColor: '#98c28a',
strokeOpacity: 1.0,
strokeWeight: 4
},
suppressMarkers:true
});