Google Maps Arrowed Polyline demo

Here is an arrowed polyline demo. The arrowed polyline shows arrow marks along its length at a fixed pixel interval regardless of zoom. Constructor for the Arrowed Polyline is as for GPolyline + 5 extra parameter specifying 1) the gap between the arrows heads in pixels, 2) the length of the arrow head sides in pixels, 3) the arrow head color, 4) the arrow head thicknes in pixels, 5) the arrow head opacity. If the space between heads is 0, you get one arrow head at the end of each line segment. If the space between heads is 1, you get one arrow head in the middle of each line segment. Recalculation is only done on a change of map zoom level. Can be a bit slow for long lines with lots of arrows.


Source code (free for any use) for the Arrow Line Overlay is here. A variant of this with arrows at a scale interval, e.g. 1km, should be a fairly straight forward change. Also with a little further work, the arrows could be equally spaced along a multi-segment polyline. Updated November 2009 for correct arrow heads on lines that cross the +/-180 meridean.


Bill Chadwick May 2008.