Wextux
Wextux

Reputation: 762

Rotate Marker with Google Maps API

I am looking to have markers on the map with a handle that will allow the user to rotate the marker. Then I would like to get the compass heading that the marker is facing. Is this possible with the Google Maps API? Are there any good examples?

Upvotes: 1

Views: 718

Answers (1)

KoZe
KoZe

Reputation: 63

The solution I came up with is to send pre-rotated image to the marker object but instead of physical url a base64 encoded string of the rotated image.
so you rotate the image in a hidden div probably outside the map you base64 encode it and then you update the marker with

marker.setIcon({url:(The base64 string here of the image),origin: new google.maps.Point(0,0),anchor: new google.maps.Point(0,0)});

Upvotes: 1

Related Questions