0

我有一个关联数组,根据类型保存图像的路径。

var customIcons = {
  restaurant: {  icon: 'http://labs.google.com/ridefinde/a2/8.gif',   },
  bar: {  icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',   }
};

标记创建于:

var icon = customIcons[icones] || {};
      var marker = new google.maps.Marker({
        map: map,
        position: point,
        icon: icon.icon,   });

但是图标显得太大了。如何将它们调整为 (30, 30) ?

4

1 回答 1

2

您将图标创建为标记图像,如下所示:

icon: new google.maps.MarkerImage( URL_GOES_HERE , undefined, undefined, undefined, new google.maps.Size(30, 30));

于 2012-09-28T19:20:03.983 回答