Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API set icon size

I am having an issue resizing a custom icon/markers on google maps, I want to set the icon size to be 15x15.

You would normally use the below to set the size, but I not sure how to apply this to my custom icon in the fiddle below.

scaledSize: new google.maps.Size(25, 25)

Here is my fiddle http://jsfiddle.net/ww17amv2/82/

Thanks for any help or suggestions.

like image 654
Bowen Avatar asked Dec 24 '22 13:12

Bowen


1 Answers

You need add the size when the icon is set:

        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(locations[i][1], locations[i][2]),
            map: map,
            optimized: false,
            icon: {url:icons[iconCounter], scaledSize: new google.maps.Size(70, 70)},
            title: 'Click to zoom'
        });

See: Change Google map marker icon size

like image 59
evitt Avatar answered Dec 26 '22 11:12

evitt