redfrogsbinary
redfrogsbinary

Reputation: 629

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) ?

Upvotes: 0

Views: 3920

Answers (1)

lccarrasco
lccarrasco

Reputation: 2051

You create the icons as marker images like this:

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

Upvotes: 2

Related Questions