-1

I use below code to create a marker with 190 degree rotation, but it doesn't work. Other icon options are working well, only rotation doesn't work.

createMapMarker(pos, map) {
    var iconUrl = 'assets/img/green_arrow.png'
    var iconScaledSize = new google.maps.Size(15, 15)
    var iconOrigin = new google.maps.Point(0,0)
    var iconAnchor = new google.maps.Point(7.5, 7.5)

    return new google.maps.Marker({
      position: pos,
      map: map,
      title: '',
      icon: {
        url: iconUrl,
        scaledSize: iconScaledSize,
        origin: iconOrigin,
        anchor:iconAnchor,
        rotation: 180,
      }
    });
  } 
geocodezip
  • 158,664
  • 13
  • 220
  • 245
lei lei
  • 1,753
  • 4
  • 19
  • 44

1 Answers1

0

rotation is not a property of the Icon Interface, it is only valid for the SVG Symbol Interface.

Either use an SVG Symbol for your icon or to rotate an image (jpeg, png, gif) use CSS (Related question: rotate a .gif image on google maps api v3?)

geocodezip
  • 158,664
  • 13
  • 220
  • 245