angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

AGM map icon resize

Open silpa-kanthan opened this issue 8 years ago • 6 comments

I m using AGM map. Showing markers and marker icon dynamically. Showing user image as marker icon. The user images are different in size so its showing very large. Cant resize the icon. pls help. The images are showing like below, map4

silpa-kanthan avatar Feb 08 '18 11:02 silpa-kanthan

Your "icons" should not be that large in the first place, it would take forever to load. You should resize them on your backend.

lazarljubenovic avatar Feb 08 '18 20:02 lazarljubenovic

@lazarljubenovic , is there any possibility do this by using css?

silpa-kanthan avatar Feb 09 '18 05:02 silpa-kanthan

@lazarljubenovic , actually I want to show user image inside the marker icon.

silpa-kanthan avatar Feb 10 '18 12:02 silpa-kanthan

copy of 517

https://github.com/SebastianM/angular-google-maps/issues/517

Basically you can make an object with the iconUrl for a marker and set the size from your component.ts file Just make sure the url is correct to your needs

private icon = {
    url: require('../../../../assets/images/myImg.png'), 
    scaledSize: {
      height: 40,
      width: 20
    }
  };

Then as part of the marker html tag

<agm-marker [iconUrl="icon">

timcblank avatar Feb 15 '18 22:02 timcblank

timcblank is right, this a duplicate of #517; closing as such.

lazarljubenovic avatar Feb 26 '18 19:02 lazarljubenovic

Found this comment by hrdkisback on StackOverflow which lets you dynamically change the map marker icon and specify the size:

[iconUrl]='{"url": marker,"scaledSize": {"height": 10, "width": 10}}'

https://stackoverflow.com/questions/50812678/add-user-image-to-agm-marker-in-angular-5#comment88677807_50812678

dalezak avatar Oct 26 '18 22:10 dalezak