0

I need to rotate a Google Maps Marker. I'm using the JavaScript v3 API. What is the best way of doing this? I've had a look at some other similar questions but there seems to be no clear answer, or if there is it's for v2.

I'm looking for a neat/tidy way to rotate the marker icon.

Edit:

As this question has started to rise in views quite dramatically I have decided to edit it to make the result of my question clearer.

You can't

jskidd3
  • 4,609
  • 15
  • 63
  • 127

2 Answers2

0

A marker image cant be rotated.. you will need to create new images of all your possible rotations and replace the marker image as required with a rotate image file.. using marker.setIcon()

https://developers.google.com/maps/documentation/javascript/reference#Marker

Duncan_m
  • 2,526
  • 2
  • 21
  • 19
  • Ok thanks, is it possible to animate the rotation doing it this way? – jskidd3 Jul 29 '13 at 00:38
  • Yes.. but only by changing the marker image in quick succession with new marker images to achieve the effect of animation.. – Duncan_m Jul 29 '13 at 00:47
  • 2
    I think its the good answer...y '-1' is given...However even this may help you... http://stackoverflow.com/questions/6800613/rotating-image-marker-image-on-google-map-v3 – Premshankar Tiwari Jul 29 '13 at 18:04
-3

How about? chart-API

https://chart.googleapis.com/chart?chst=d_map_spin&chld=0.25|38|FF0000|12|text-1|text-2

It rotates a red spin marker by 38degree scaled 25%,and labeled with two lines texts.

tcltk-d
  • 60
  • 1