12

Using Google maps javascript API i want to draw arrow on top of the poly line so when the user is looking at the Map he would understand that some one traveled from here and to here.

The existing functionality

img

I want something like this

img

Please help.

Help will be appreciated.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Chintan Patel
  • 329
  • 2
  • 3
  • 5
  • 1
    there is a very good answer http://stackoverflow.com/questions/14066387/how-to-add-direction-on-tracking-path-for-google-maps – Developerium Oct 22 '14 at 08:28
  • 1
    Please see [Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/questions/284236/why-is-can-someone-help-me-not-an-actual-question) – glennsl Aug 18 '18 at 16:00

1 Answers1

13

You may calculate the angle between two points, here's a how-to.

Depending on the calculated angle you can place a marker at the start-point. Here you find the description of the markers: http://sites.google.com/site/gmapicons/home/ (Direction indicators)


Edit:

See a demo: http://jsfiddle.net/doktormolle/9gJjj/

You'll find a function fx() there which expects a DirectionsRoute as argument and draws the markers.


Edit2:

Note that you may also use an IconSequence which may be a better approach, See: Google Map API Direction Triangle Icon Ambiguous

Community
  • 1
  • 1
Dr.Molle
  • 116,463
  • 16
  • 195
  • 201