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

Need property icon rotation in agm-marker

Open gokuldhas opened this issue 7 years ago • 20 comments

Issue description Need property icon rotation in agm-marker could be great. Is possible to have a class for agm-marker Example : https://stackoverflow.com/questions/46843606/how-to-make-custom-arrow-mark-in-agm-map

gokuldhas avatar Mar 28 '19 11:03 gokuldhas

yes please anyone have done this because i have same situation need to rotation icon.

hamzash750 avatar Apr 02 '19 11:04 hamzash750

currently you can workaround by setting [iconUrl]="{rotation: 40, path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW}"

You are invited to create a PR extending the AgmMarker directive with new properties

ghost avatar May 31 '19 09:05 ghost

@doom777 it doesn't work for custom marker icons

magnusfernandes avatar Jun 03 '19 08:06 magnusfernandes

@magnusfernandes , should work. If anything, the example I gave doesn't work because google namespace isn't available at that time.

Can you make an example on stackblitz?

ghost avatar Jun 03 '19 09:06 ghost

@doom777 can this issue be solved soon? Need it for an app release.

magnusfernandes avatar Jun 03 '19 10:06 magnusfernandes

can you create a stackblitz?

ghost avatar Jun 03 '19 10:06 ghost

@doom777 Stackblitz

magnusfernandes avatar Jun 03 '19 13:06 magnusfernandes

worked for me: image

ghost avatar Jun 03 '19 14:06 ghost

@doom777 can't rotate the custom icon Stackblitz

magnusfernandes avatar Jun 04 '19 17:06 magnusfernandes

Same problem here...

pst9354 avatar Jun 06 '19 10:06 pst9354

@SebastianM @doom777 any update on this, please?

magnusfernandes avatar Jun 09 '19 10:06 magnusfernandes

Ok, so I think I got it. MarkerOptions#icon property can either be an Icon or a Symbol. Symbol class has rotation property, while Icon has scaledSize, so you can't have them together. So either convert your icon to an SVG and inline it in Symbol, or actually rotate the image in the icon file manually.

This is a limitation of Google Maps, so we cannot fix it.

Please confirm that this is your problem, and if so, close the issue.

ghost avatar Jun 11 '19 11:06 ghost

Is someone working on this issue? Otherwise I could try to implement this (need the functionality aswell 👍 ).

annnoo avatar Aug 09 '19 14:08 annnoo

stackbiz is not working

deeprenus avatar Oct 01 '19 10:10 deeprenus

Stackblitz stopped working generally.

ghost avatar Oct 02 '19 17:10 ghost

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 31 '19 18:12 stale[bot]

Rotation is working fine but when i am changing rotation value at run time it not working, Example project https://angular-google-maps-demo-b3cm38.stackblitz.io

roushankumar01 avatar Feb 06 '20 05:02 roushankumar01

You cannot rotate markers using agm-marker and iconUrl property. I recommend using agm-overlay. This way you can set the icon with "img src" and use inline css "style" to rotate the icon. You can check my working example here: <agm-overlay *ngFor="let marker of markers" [latitude]="marker.latitude" [longitude]="marker.longitude"> <div> <img *ngIf="marker.type === 'BT'" src='./assets/images/bt.png' style="transform: rotate({{marker.rotation}}deg); width: 60%; height: 60%;"> <img *ngIf="marker.type === 'RTMS'" src='./assets/images/test.png' style="transform: rotate({{marker.rotation}}deg); width: 5%; height: 5%;"> </div> </agm-overlay>

Untitled

ioas99 avatar Mar 24 '20 16:03 ioas99

Any update on this request?

wlisesrivas avatar Apr 28 '20 22:04 wlisesrivas

I created PR to add icon type

darron1217 avatar Jul 15 '20 02:07 darron1217