Highlight distance along route

776 views
Skip to first unread message

Jason

unread,
Aug 21, 2010, 4:29:17 PM8/21/10
to Google Maps JavaScript API v3
I've been working on creating an application that stores mileage and
displays progress along a Google Maps route. I have a basic map up and
working, with start/end/waypoints set with driving directions
connecting them. What I want to be able to do is take a number of
miles and display where the user is "at" along this route. Is there a
way to do this using the Google Maps API?

I've been searching around for some time, but either this is an
uncommon problem or I'm not using the right search terms. I came
across some examples using polygon lines instead of actual directions
(e.g. http://stackoverflow.com/questions/2698112/how-to-add-markers-on-google-maps-polylines-based-on-distance-along-the-line)
but they seem to either focus on polygons and/or utilize version 2 of
the Maps API.

Any solutions or pointers in the right directly would be most
appreciated.

geoco...@gmail.com

unread,
Aug 21, 2010, 8:12:56 PM8/21/10
to Google Maps JavaScript API v3
On Aug 21, 1:29 pm, Jason <dumpsterkee...@gmail.com> wrote:
> I've been working on creating an application that stores mileage and
> displays progress along a Google Maps route. I have a basic map up and
> working, with start/end/waypoints set with driving directions
> connecting them. What I want to be able to do is take a number of
> miles and display where the user is "at" along this route. Is there a
> way to do this using the Google Maps API?

Yes. But it is not built in.

>
> I've been searching around for some time, but either this is an
> uncommon problem or I'm not using the right search terms. I came
> across some examples using polygon lines instead of actual directions
> (e.g.http://stackoverflow.com/questions/2698112/how-to-add-markers-on-goog...)
> but they seem to either focus on polygons and/or utilize version 2 of
> the Maps API.
>
> Any solutions or pointers in the right directly would be most
> appreciated.

You need to do something like this:
http://www.geocodezip.com/v3_animate_marker_directions.html

http://groups.google.com/group/google-maps-js-api-v3/browse_frm/thread/16cd7a807ff89d2/ef5246350b50146f?lnk=gst&q=cartrip#ef5246350b50146f

But what you want to do is simpler. I think the pieces should all be
there. The main one being the port of polyline.GetPointAtDistance
from Mike Williams' epoly extension.

Post a link to your map if you want more specific advice or if you run
into trouble.

-- Larry

Jason

unread,
Aug 23, 2010, 11:10:55 AM8/23/10
to Google Maps JavaScript API v3
Awesome! Thanks for the information, that looks really helpful. I'll
post pack if I have further questions, but this looks like a great
start. Thanks again!

On Aug 21, 5:12 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Aug 21, 1:29 pm, Jason <dumpsterkee...@gmail.com> wrote:
>
> > I've been working on creating an application that stores mileage and
> > displays progress along a Google Maps route. I have a basic map up and
> > working, with start/end/waypoints set with driving directions
> > connecting them. What I want to be able to do is take a number of
> > miles and display where the user is "at" along this route. Is there a
> > way to do this using the Google Maps API?
>
> Yes.  But it is not built in.
>
>
>
> > I've been searching around for some time, but either this is an
> > uncommon problem or I'm not using the right search terms. I came
> > across some examples using polygon lines instead of actual directions
> > (e.g.http://stackoverflow.com/questions/2698112/how-to-add-markers-on-goog...)
> > but they seem to either focus on polygons and/or utilize version 2 of
> > the Maps API.
>
> > Any solutions or pointers in the right directly would be most
> > appreciated.
>
> You need to do something like this:http://www.geocodezip.com/v3_animate_marker_directions.html
>
> http://groups.google.com/group/google-maps-js-api-v3/browse_frm/threa...
Reply all
Reply to author
Forward
0 new messages