Thanks for that explanation, it is indeed very simple to calculate the 
percentage between two stations [I've actually made something similar, but 
then giving the time in hours :P ]

You are talking about combining the paths, now, Oh wait...
I just realised that the data which is loaded into a path is just an array 
of gps locations!
I never looked at the data like that before! This opens up completely new 
possibilities!
And ofcourse that makes it very easy to find the first and last point on 
the route!

At the moment I load my paths from a database [which basically is a table 
with the names of the pieces between stations, fully in javascript so I 
echo them and they work instantly as a polyline.
I never realised I was using an array of coordinates to make those 
polylines.


*Back to your function:*
Let's see if I get this correctly:
You have an array with all the required points for the route from one 
station to another. [path_points]
Then you calculate the traveled distance [distanceAC]
and seek what point on the polyline [from path_points] should have been 
passed to be where you are now.

*But there I lose it:*
How do you determine where the vehicle is?
As far as I understand, you have a polyline which is VERY detailed and has 
got hundreds of points with equal spaces between them, where you put the 
vehicle, to indicate its position?
Or does this line:
position = google.maps.geometry.spherical.interpolate(p1, p2, (distanceAC - 
cumulatedDistanceToC)/d12);
allow the vehicle to be placed between two points? [as they are all just 
straight lines between the coordinates]

*also*: what is path_length? is that just the length of the route from one 
station to another? [i don't fully understand that, because you say: 
compute the length]

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/KT64YLQ1E2UJ.
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-js-api-v3?hl=en.

Reply via email to