I'm writing an app that takes advantage of GPS information to determine what road/trail (or "way" in OpenStreetMaps terms) a user is on. Ways in OSM do not include width information, just a series of points connected together, so it isn't a matter of figuring out which poly box a GPS coordinate is in.
The information I have is the list of points that define the trail as it bends (if it was just a straight trail, could be 2 points 1/2 mile apart). These trails are usually separated by tree-lines (say 50-300m apart) and there can be lots of them within a park so accuracy without width information can be tricky in edge cases. Usually the way definition runs down the center of the trail.
It seems like I need to calculate all the individual vectors on a trail, then find the nearest vector. I'm concerned about this being rather intensive to do with every new GPS update (every 1-4 seconds?). I could at least try to fill out the points on each trail (force a point every x meters) ahead of time and then just get nearest point as the GPS updates.
Are there any structures that the point-data could be adapted into up-front to assist in the calculations? Any other known algorithms to solve this problem that are mobile-contraint-friendly? Seems like this should be an already-solved problem.