So I have a route in the form of a polyline with some stops predefined on it, now I need to build the logic in my app to predict which stop I'm nearest to based on the location packets received by device which will be there most probably in a vehicle running on the route, also the route is quite complex like U-turns and parallel roads with stops on both sides.
I am thinking about two approaches one is based on geofencing and another is by using projection of the location packet received on polyline and then calculating distance and stuff. Can anyone tell if the approaches I'm thinking of are correct and which one should I go with considering the complex routes, share if there is any other suitable approach too