Jaec
Jaec

Reputation: 390

How to create direction arrows for my polylines in Google Maps (V3)?

I have routes as Google Maps Polylines in my project (an example, http://rutasgdl.com/rutas/626-2 ) and I want to add direction arrows to the routes. I want something like this (sadly, it is for Google Maps V2) http://wtp2.appspot.com/ArrowLine.htm

Can you point me in the right direction in order to achieve this? Regards.

Upvotes: 12

Views: 30241

Answers (4)

Robert Fontaine
Robert Fontaine

Reputation: 1

The simple solution is use add a short line segment angled back 45 degrees to the end of the line. This thread is 10 years old but I still dont find a built in arrow to use in Google Earth. Bob Fontaine

Upvotes: 0

awmross
awmross

Reputation: 3839

The Google Maps API now supports this natively (as of July 2012).

https://developers.google.com/maps/documentation/javascript/symbols#add_to_polyline

Upvotes: 7

Peter Bennett
Peter Bennett

Reputation: 11

Here is the code from Bill Chadwick ported to v3

Enjoy!

https://docs.google.com/open?id=0B4WFC4iBvLilOHc1YTFnakFsdWM

Upvotes: 1

Vincent
Vincent

Reputation: 170

I found a blog entry by Pavel Zotov, where he describes a way to add arrows to a polyline. The trick is to extend google.maps.OverlayView.

http://yab.hot-line.su/javascript/polyline-with-arrows-in-google-maps-api-v3.html

(I don't know if I can reproduce the code here, so I only post a link to the blog entry.)

Upvotes: 4

Related Questions