Reputation: 25
I've been using google.maps.markerIcon on API V3. Here is the code used until now:
var addImage = new google.maps.MarkerImage('/images/address.png',
new google.maps.Size(293, 198),
new google.maps.Point(0,0), //img origin
new google.maps.Point(320, 110)); //img anchor
Now I see that markerIcon is deprecated in V3.1(This class is deprecated in favor of Icon.) So now I have tried this:
var AddressMarker = new google.maps.Marker({
position: coords,
map: map,
icon: (new google.maps.Point(320, 110), new google.maps.Point(50, 50),new google.maps.Size(293, 198),'/images/address.png'),
});
It shows the address.png again but it seems not to take care on the anchor point (first value). This marker is an address image wich should be shown on left of the coords position. Not taking the icon origin value, it show the image centered on the position.
How can I have on left middle position of the coords instead ?
Thank you for help.
Upvotes: 1
Views: 1544
Reputation: 433
You can use a google.maps.MarkerImage as icon. See Complex Icons
edit: Sorry, totaly overlooked the 3.1 part. But it seems like Icon has no constructor, have you tried to set the Icon properties explicitly?
Upvotes: 1