Reputation: 11
I use the Direction API to plot and save a route between A and B. My application receives a coordinated car gps, I would like to identify if the car is off course previously traced. Anyone have any idea how to do this?
Upvotes: 1
Views: 1074
Reputation: 117334
You may create a polyline based on the route and use google.maps.geometry.poly.isLocationOnEdge
to check if the current coordinate is placed on/near the polyline.
For an approximate result create the polyline using the overview_path
of the route, for higher accuracy use the lat_lngs
of the steps
of the route
Upvotes: 2