简体   繁体   中英

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?

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)});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM