Adding a waypoint at a specifc distance along route

132 views
Skip to first unread message

skube

unread,
Aug 16, 2011, 11:00:15 AM8/16/11
to google-map...@googlegroups.com
Hi, I'm wondering if anyone might be able to help. I would like to create a directions map that obviously has an origin and destination plotted. However, I would like to drop a marker at some distance along the route polyline (not radially from the origin). Does anyone know if this is even possible?

thanks!

geoco...@gmail.com

unread,
Aug 16, 2011, 2:56:13 PM8/16/11
to Google Maps JavaScript API v3
Sure. You can get the route, then compute the coordinates of a point
at a certain distance along it and put a marker there.

One example:
http://www.geocodezip.com/v3_polyline_example_kmmarkers_0.html
(markers every 2 km)

Another example:
http://www.geocodezip.com/v3_GoogleEx_directions-waypoints_kmmarkersC.html
puts markers at:

createMarker(polyline.GetPointAtDistance(9500),"9.5km","9.5km");

createMarker(polyline.GetPointAtDistance(64800),"64.8km","64.8km");
(uses a ported version of Mike Williams (v2) epoly library, there are
probably better ways to do it now)

-- Larry

>
> thanks!
Reply all
Reply to author
Forward
0 new messages