更改Google地图标记图标大小 [英] Change Google map marker icon size

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

问题描述

我想知道如何更改地图标记图标的大小。

I would like to know how to change the size of the map marker icon. I'm unable to get it done after going through the tutorials online!

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)
});


推荐答案

对于那些陷入类似情况的人,我得到了它的工作:

For those of you who are stuck in similar situations, I got it working with this:

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
                });

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

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