【问题标题】:Change Google map marker icon size更改 Google 地图标记图标大小
【发布时间】:2017-06-09 16:05:54
【问题描述】:

我想知道如何更改地图标记图标的大小。看了网上教程后,我无法完成!

var marker = new google.maps.Marker({
    position: new google.maps.LatLng(51.124110, -0.073897),
    map: map,
    title: 'Snazzy!',
    icon: 'map_marker.png',
    size: new google.maps.Size(20, 32)
});

【问题讨论】:

  • 标记的默认大小(以像素为单位)是多少?

标签: google-maps google-maps-api-3


【解决方案1】:

对于那些陷入类似情况的人,我可以解决这个问题:

var image = {
                    url: 'map_marker.png',
                    scaledSize : new google.maps.Size(50, 50),
                };

                // Let's also add a marker while we're at it
                var marker = new google.maps.Marker({
                    position: new google.maps.LatLng(51.524110, -0.073897),
                    map: map,
                    title: 'Snazzy!',
                    icon: image
                });

【讨论】:

    猜你喜欢
    • 2013-01-14
    • 2011-12-12
    • 2013-02-12
    • 1970-01-01
    • 2019-09-18
    • 1970-01-01
    • 2011-10-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多