我使用DirectionsRender绘制的路线很好但我无法找到如何用我自己的标记替换通用的Google标记.
我知道并在正常的谷歌地图情况下使用它,但发现使用开始和结束的方向标记很难做到这一点.
如果这是一个愚蠢的问题,感谢任何建议,指点或温和的嘲笑:D
迈克尔
我在Google Maps API中添加单个标记时遇到问题.我搜索了很多像以下链接,在谷歌地图方向api V3中更改个别标记.但我无法在我的代码上实现相同的功能.在suppressMarkers: true我的帮助下,我能够阻止默认标记.现在只显示根方向.现在我该如何为起点和终点添加制造商.以下是我的代码.
function GoogleMap_selected(){
var lattitude_value= document.getElementById('slectedLat').value;
var longitude_value= document.getElementById('slectedLon').value;
var from = new google.maps.LatLng(mylatitude, mylongitude);
var to = new google.maps.LatLng(lattitude_value, longitude_value);
var directionsService = new google.maps.DirectionsService();
var directionsRequest = {
origin: from,
destination: to,
travelMode: google.maps.DirectionsTravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC
};
this.initialize = function(){
var map = showMap_selected();
directionsService.route(
directionsRequest,
function(response, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
new google.maps.DirectionsRenderer({
map: map,
directions: response,
suppressMarkers: true
});
}
else
{
alert("Unable to retrive route"); …Run Code Online (Sandbox Code Playgroud) javascript google-maps google-maps-api-3 google-maps-markers