So I have been capturing bus GPS locations for a while now, and I am became interested in snapping them to their corresponding polyline (route). While at first this seemed like an easy enough task I began to realise how complex this task is, particularly in situations where the route doubles back on itself and a simple snap to closest isn't always accurate.
Now I assume that I am not the first person in the world of GIS to want to do something like this, I was wondering if you have come across any algorithms, scripts, functions, programs or whatever that could help me with this task. I am currently using PostGIS and QGiS but am open to any suggestions.