dpq
dpq

Reputation: 9278

Rotate Google Maps API MarkerImage

I have a marker of a rocket on one of my Google Maps apps. Not surprisingly, I need to rotate it depending on where it's headed. How can I do that? Rotating the image with a canvas/VML (like jquery-rotate does) appears to be not an option, because I need to specify a URL as the image source, not an <img> element.

Upvotes: 2

Views: 2311

Answers (2)

Chris Broadfoot
Chris Broadfoot

Reputation: 5112

The best cross browser way would be to create a sprite with the marker at different angles, and vary the Marker's size attribute depending on the angle.

The other non-cross browser way would be to use CSS3 transforms, and you'd probably want to create a custom Overlay in order to do this. Alternatively, draw onto the map with canvas. Though, you won't get a dom element to capture click events.

Upvotes: 1

aniri
aniri

Reputation: 1831

You can make more versions of that image (for the rotations) and use the url of the image you want.

Upvotes: 1

Related Questions