简体   繁体   English

调整Google地图api V3中的标记大小

[英]Resize markers in Google maps api V3

I have an associative array holding the path of the image according to the type. 我有一个关联数组,根据类型保存图像的路径。

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

The marker is created in: 标记创建于:

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

But icons appear too big. 但是图标看起来太大了。 How can I resize them to (30, 30) ? 我怎样才能将它们调整为(30,30)?

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM