我知道如何在标准的Google地图API v3上更改图标。 是否有办法在带有方向的地图上更改图标?
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize(){
directionsDisplay = new google.maps.DirectionsRenderer();
var mapOptions={
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById("directionsPanel")
);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
icon: 'marker/image.png',
title: 'Click to zoom'
});
google.maps.event.addListener(marker, 'click', function(){
map.setZoom(15);
map.setCenter(marker.getPosition());
});
google.maps.event.addDomListener(window, 'load', initialize);
}
function calcRoute() {
var start = document.getElementById("start").value;
var end = '-34.397, 150.644';
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
</script>
上述代码显示了带有我的自定义图标标记的地图,但是当我生成方向时,在我的自定义标记顶部,我看到另一个带有字母B的标准绿色标记。
如何覆盖它?