CodeSlayer
CodeSlayer

Reputation: 1327

how to stretch the icon in google map api v3

Here is my code... The problem is, I don't know how to stretch the image of icon. I just want to know if there's a way to stretch the image of icon? if there is, please tell me..thanks in advance

var image = {
    url: 'images/arrive.png'
    size: new google.maps.Size(40, 40)
};

var markerOptions = {
  map: map, 
  position: new google.maps.LatLng(lati, longti), 
  icon: image};

Upvotes: 0

Views: 659

Answers (3)

user3954526
user3954526

Reputation:

Put this on your code,

 origin: new google.maps.Point(0,0),
 anchor: new google.maps.Point(anchor_left, anchor_top)

Upvotes: 0

vinod_vh
vinod_vh

Reputation: 1061

Use scaledSize Property of Google Maps API.

The size of the entire image after scaling, if any. Use this property to stretch/shrink an image or a sprite.

You can see here about scaledSize .

Upvotes: 3

cracker
cracker

Reputation: 4906

Use Like

 var icon = {
     url: "../res/sit_marron.png", // url
     size: new google.maps.Size(width, height), // size
     origin: new google.maps.Point(0,0), // origin
     anchor: new google.maps.Point(anchor_left, anchor_top) // anchor 
 };

 position = new google.maps.LatLng(latitud,longitud)
 marker = new google.maps.Marker({
  position: position,
  map: map,
  icon: icon
 });

Markers

Upvotes: 3

Related Questions