How to overlay an image on Google Maps (v3) in a specific direction (bearing)?
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 to share