I am trying to create several markers along a route from google maps directions. I have already looked into waypoints as an option but based on my understanding of the documentation on it, it creates the route from point A to point B and passes through the waypoints that you set in order to get from point A to point B. I don't want my route to be calculated based on predetermined waypoints. I want a predetermined start and end point, with my waypoints calculated based on a distance on the map. For instance, a marker created every so many miles along the route. Would waypoints do this? If so, any examples of where that has been done?
Any suggestions?
As Andrew told waypoints wouldn't do it.
You don't have predefined points for the route (like the example), so what you can do is:
A direction consists of points defined by route->overview_path, what defines the polyline for the route.
So you may walk this path, calculate the distance between two path-points using google.maps.geometry.spherical.computeDistanceBetween()
and create the marker when the desired distance has been reached.
Here is an implementation of the suggestion: http://jsfiddle.net/doktormolle/eNzFb/
<edit>
Please Note: this answer is obsolete. You better use the built-in IconSequence instead.