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.