jemz
jemz

Reputation: 5143

Detecting waypoints in google maps

I just want to ask if this is possible in google map v3.I created a marker serve as my waypoints in directions and save those coordinates in my database. my concern for this is. Is it possible to detect one of my vehicle which I set for his waypoints and will know if he passes or not in that waypoints that I created ?

just like this example created @geocodezip,with mulitple waypoints

Multiple waypoints

I want to detect the vehicle if he passes or not in that waypoints.

Thank you in advance.

Upvotes: 0

Views: 640

Answers (1)

Dr.Molle
Dr.Molle

Reputation: 117354

Iterate over all legs and all steps of the legs.

For each step create a Polyline-object(must not be visible) and use google.maps.geometry.poly.isLocationOnEdge() to check if the given location(vehicle-position) is placed on the Polyline.

When it does, the vehicle has passed the waypoint specified by the start_location of the current leg(and probably the previous waypoints, when the vehicle was following the given route ).

Upvotes: 2

Related Questions