更改路线中标记的默认图标 [英] change default icon of marker in route

查看:81
本文介绍了更改路线中标记的默认图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我搜索两个位置之间的路线时,我想更改标记的默认图标.我该怎么做?我使用了这段代码,但我没有得到没有路线和点的地图

I want to change the default icon of marker when I search route between two locations. How can I do it? I use this code but I didn't get only the map without route and points

var start  = new google.maps.Marker({
position: new google.maps.LatLng(lat, lon),
 icon:'http://www.google.com/mapfiles/dd-start.png',
 map: map  });

var end = new google.maps.Marker({
position: new google.maps.LatLng(lat1, long1),
icon:'http://www.google.com/mapfiles/dd-end.png',
map: map  });
var request = {
            origin: start,
                destination: end,
                optimizeWaypoints: true,
            travelMode: google.maps.DirectionsTravelMode.DRIVING
            };

推荐答案

创建渲染器时,请添加此选项,然后将标记放置在起点(开始)和终点(结束)

When you create the renderer add this option, then place your markers at the origin (start) and destination(end)

    directionsDisplay = new google.maps.DirectionsRenderer({
      suppressMarkers: true
    });

这篇关于更改路线中标记的默认图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆