How can I check my car point(coordinate) in route?

64 views
Skip to first unread message

Onder Arslan

unread,
Jan 7, 2018, 6:43:42 PM1/7/18
to Google Maps JavaScript API v3

I am using google maps js v3 api to create a route using direction function. After that I want to check if a certain point is on my route or not.

Thanks.

JKurtock

unread,
Jan 8, 2018, 7:29:17 PM1/8/18
to Google Maps JavaScript API v3
Parse the DirectionsResult object https://developers.google.com/maps/documentation/javascript/directions to get down to the path array(s).  Iterate through that (those) array(s) to see if your certain point is in the array.

You will need to develop logic to decide what is "close enough" to be "on" the route.

and...@google.com

unread,
May 23, 2018, 10:58:48 AM5/23/18
to [deprecated] Google Maps JavaScript API v3. Please use the latest post.
Have a look at isLocationOnEdge(point, poly[, tolerance]) method of geometry library


Please note that this Google Group will be deprecated by end of May 2018. Please use the alternative methods laid out in the header if you still need assistance.

Thanks for your understanding.
Reply all
Reply to author
Forward
0 new messages