Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need property icon rotation in agm-marker #1622

Closed
gokuldhas opened this issue Mar 28, 2019 · 20 comments · Fixed by #1836
Closed

Need property icon rotation in agm-marker #1622

gokuldhas opened this issue Mar 28, 2019 · 20 comments · Fixed by #1836

Comments

@gokuldhas
Copy link

gokuldhas commented Mar 28, 2019

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

@hamzash750
Copy link

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

@ghost
Copy link

ghost commented May 31, 2019

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

@magnusfernandes
Copy link

@doom777 it doesn't work for custom marker icons

@ghost
Copy link

ghost commented Jun 3, 2019

@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?

@magnusfernandes
Copy link

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

@ghost
Copy link

ghost commented Jun 3, 2019

can you create a stackblitz?

@magnusfernandes
Copy link

magnusfernandes commented Jun 3, 2019

@doom777 Stackblitz

@ghost
Copy link

ghost commented Jun 3, 2019

worked for me:
image

@magnusfernandes
Copy link

magnusfernandes commented Jun 4, 2019

@doom777 can't rotate the custom icon
Stackblitz

@pst9354
Copy link

pst9354 commented Jun 6, 2019

Same problem here...

@ghost ghost added the needs: investigation label Jun 6, 2019
@magnusfernandes
Copy link

@SebastianM @doom777 any update on this, please?

@ghost
Copy link

ghost commented Jun 11, 2019

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 ghost assigned gokuldhas Jun 11, 2019
@ghost ghost added this to the 1.0.0-beta.8 milestone Jun 26, 2019
@ghost ghost removed this from the 1.0.0-beta.8 milestone Jul 18, 2019
@annnoo
Copy link

annnoo commented Aug 9, 2019

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

@deeprenus
Copy link

stackbiz is not working

@ghost
Copy link

ghost commented Oct 2, 2019

Stackblitz stopped working generally.

@stale
Copy link

stale bot commented Dec 31, 2019

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 stale bot added the stale label Dec 31, 2019
@ghost ghost added this to the 2.1.0 milestone Jan 2, 2020
@stale stale bot removed the stale label Jan 2, 2020
@roushankumar01
Copy link

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

@ioas99
Copy link

ioas99 commented Mar 24, 2020

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

@wlisesrivas
Copy link

Any update on this request?

@darron1217
Copy link
Contributor

I created PR to add icon type

@ghost ghost closed this as completed in #1836 Jul 16, 2020
ghost pushed a commit that referenced this issue Jul 16, 2020
allow AgmMarker `iconUrl` to be a GoogleSymbol or an Icon type.

fixes: #1740
fixes: #1622
fixes: #1580
probably fixes a bunch more, since this was often requested.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants