Question

I have one place I want to check that place is present between route of Source and Destination using Google Directions API.

for example: A - source B - destination and C - is the place.

Now i want to check that C is present or not in A to B route.

Thanks.

Was it helpful?

Solution

A directionsRoute contains a overview_path-property, whih defines a simplified path for the route.

You may use this path to create a polyline and then use google.maps.geometry.poly.isLocationOnEdge() to check if the place is on the route.

As the overview_path is simplified, you can use the path-property of the steps to create a more detailed route(polyline) and get a more accurate result.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top