Search code examples
angular-google-maps

Can I give an anchor to a marker in agm/core?


I created a marker with a custom image, but the image is anchored to the bottom of the image. I want to give the the centre if the image as the anchor point so that even if I rotate the image, it rotates around the centre.

I followed this excellent solution Rotating image / marker image on Google map V3 to rotate the custom image on the marker in agm/core (angular 4).

thanks to @ErDmKo

thanks in advance


Solution

  • It is possible by using the Object like in the official Google Maps Doc instead of the string like in the AGM Doc.

    It works like:

    <agm-marker [iconUrl]="{url: '/assets/icons/icon-map-home.png',  anchor : {x:19, y:19}}">