Hi Michael and others,
Looping won't work for me unless I have misunderstood the solution.

I'll reframe the problem. I would like to display two points which
represent the start and end of a highway. I need to identify the
distance along the highway in 100 meter increments in order to
identify attractions and items of interest along the highway. I
thought that if I created a polyline manually I might be able to
traverse it easily, but you've kindly pointed out the problem. Is it
possible to have the Google Map API generate the 100 meter increments
as marker points along a highway using Gdirections? I could then mouse
over the points to get the mileage.

Thanks,
James

On Aug 30, 9:02 am, Mike Williams <[EMAIL PROTECTED]> wrote:
> Wasn't itjameslovewho wrote:
>
> >Why not get the Google API to calculate the distance? I want to avoid
> >having Google calculate the distance since that would involve numerous
> >calls to the API and be sluggish. Am I wrong in thinking this?
>
> If you mean making a GDirections call every time the mouse moves, then
> that would be sluggish. There's a GDirections speed limit of about 3 or
> 4 per second.
>
> Looping along the poly doing .getVertex() and .distanceFrom()s should be
> fast enough.
>
> >The approach I I'm thinking about is as follows: I will display the
> >polyline and dump the polyline nodes into an array. When the marker is
> >over the polyline, I determine which nodes of the polyline the marker
> >is between and calculate the distance from the node closest to the
> >starting node using the lat/lon. I will then calculate the distance
> >from the closest node to the starting node and add the values. The
> >result is then displayed.
>
> It's not entirely obvious how to determine which segment of the polyline
> contains the point. Even with routes that don't have U-turns or have
> off-ramps that loop back to cross underneath the main roadway there are
> often situations where the point isn't contained by the two nearest
> vertices. Consider this scenario:
>
>    A
>    |
>    |
>    B---------*-------------------------------------C
>
> The two nearest vertices are A and B, but the * actually lies on segment
> BC.
>
> --http://econym.googlepages.com/index.htm
> The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to