I need your suggestion. I am creating a web application where I need to find if particular city\'s exist along my path. I am using google API to get direction along path,but it
The name of a city isn't very accurate, you'll need a LatLng for the city.
Based on a LatLng the method isLocationOnEdge()
of the geometry-library allows you to determine if the LatLng(city) lies on (or is near) the polyline defined for a route:
google.maps.geometry.poly
.isLocationOnEdge(LatLngOfCity,
new google.maps.Polyline({path:google.maps.geometry.encoding.decodePath(response.routes[0].overview_polyline.points)}),
0000000001));
response
has to be a directionsResult, the last parameter is a tolerance
http://jsfiddle.net/doktormolle/DXCH8/