如何在谷歌地图中调整复杂图标的大小

时间:2017-11-09 15:35:46

标签: google-maps

我在谷歌地图中有几个图标的下一个代码,但在尝试调整serval图标的大小时不起作用。

我需要帮助,因为我的图标大小不同

           var iconBase = '../../Content/images/';
            var icons = {
                WIND: {
                    icon: iconBase + 'turbin.gif',
                    origin: new google.maps.Point(0, -15),
                    size: new google.maps.Size(40, 80),
                    scaledSize: new google.maps.Size(40, 80)
                },
                OTHER: {
                    icon: iconBase + 'library_maps.png'
                },

                SOLAR: {
                    icon: iconBase + 'panel.gif'
                },

            };

1 个答案:

答案 0 :(得分:0)

您的代码中有一个拼写错误,每个the documentation,下面的icon应为url

WIND: {
    icon: iconBase + 'turbin.gif',
    origin: new google.maps.Point(0, -15),
    size: new google.maps.Size(40, 80),
    scaledSize: new google.maps.Size(40, 80)
}

应该是:

WIND: {
    url: iconBase + 'turbin.gif',
    origin: new google.maps.Point(0, -15),
    size: new google.maps.Size(40, 80),
    scaledSize: new google.maps.Size(40, 80)
}

proof of concept fiddle