# Identifying series of coordinates.

I have two coordinates(latitude,longitude) which is defining line on the map. The line has direction. Then I have series of other coordinates moving either roughly along this line and towards direction or opposite direction. Also they can cross the line, etc. The important part is that I need to identify only the case when series of points are moving along and towards direction. Those series are coordinates from gps. Let's also define threshold in meters for identifying that point "belongs" to line. This will include gps error and line error.

I am looking for some formula which I could apply to each point, then after applying twice I can identify direction and continue until end of the line. Below is drawing (sorry for finger quality), hopefully demonstrating what I mean.

Green dots are series which are moving towards line direction. They are what we need to identify. Top blue dots are series moving opposite direction. Also want to emphasize that those lines are not really lines and maybe we need to consider their roundness.

-
Do I have to start solving this by converting spherical coordinates into Cartesian? – Pablo Nov 5 '12 at 15:21