-2

I have a problem that I can't change the size of the marker on my code. If someone can help me I apreciate it. Code:

 var marker, i;

for (i = 0; i < locations.length; i++) { 
 
  
  marker = new google.maps.Marker({
    position: new google.maps.LatLng(locations[i][3], locations[i][4]),
    map: map,
 
    icon:'custm-marker.png'
      
  
  });

1 Answers1

0

Duplicate of Resize Google Maps marker icon image

If the original size is 100 x 100 and you want to scale it to 50 x 50, use scaledSize instead of Size.

const icon = {
    url: "custm-marker.png", // url
    scaledSize: new google.maps.Size(50, 50), // scaled size
    origin: new google.maps.Point(0,0), // origin
    anchor: new google.maps.Point(0, 0) // anchor
};

const marker = new google.maps.Marker({
    position: new google.maps.LatLng(lat, lng),
    map: map,
    icon: icon
});
Obsidianlab
  • 667
  • 1
  • 4
  • 24