How to overlay an image on Google Maps (v3) in a specific direction (bearing)?

I have an arrow image that I would like to place on a google map v3 and point it to a specific direction (using a pivot from a specific Lat / Long point). Is it possible?

Thanks.

+2


a source to share


1 answer


There are two ways to solve this problem:



  • Create 360 ​​arrow icons, each rotated 1 degree, and then bring up the corresponding one according to the direction you want. You can call the arrows something like "arrow_123.png" to indicate 123 degrees.

    You often don't need 1 degree accuracy. In this case, for example, you can only create 36 icons in 10-degree increments. Then just use the icon closest to the closest view.

  • You can also use the HTML 5 canvas to rotate the icon to an arbitrary degree, as in the following Stack Overflow column: Show wind direction on Google Maps.However , please note that this will not work in browsers that do not support the canvas element, such as Internet Explorer ...

+1


a source







All Articles