A simple approach might be to look at the first three points and
calculate how far the second point is from a line between the first and
third. If less than some threshold, delete the second point and repeat
the process with what is now the new first, second and third points. If
you didn't delete a point, retry starting from the second, third and
fourth points point. Repeat.
Something that would simplify this discussion is knowing what 'monitoring
a car's position' means. It would appear that there are several meanings
covering a range of possibilities and of data storage requirements, e.g.:
1) knowing where the car is now without keeping any history.
2) knowing where the car has stopped, when and for how long but not
what route it followed between stopping places.
3) as for (2) but with routes followed between stopping places.
4) storing a complete history of the car's movements.
5) storing every GPS $GPMRC sentence as received.
(1) is simple - just keep the last valid GPS sentence.
(2) is also simple - only store the first point in a string of
sentences reporting the same position plus the elapsed time there.
(3) is what almost every hand-held GPS does when it runs out of memory.
First it combines stationary points, replacing them by one point.
Then it replaces lists of points that fit some straightness
definition with the first and last points. Here I think a good
algorithm would be to deduce the direction between points and
combine those with the same direction +/- a small deviation.
(4) is most simply handled by keeping a small fraction of GPS sentences.
I'm a glider pilot and use a GPS flight recorder for cross country
flights. My glider's speed range is 45-130 mph (74-210 kph) and
recording its position every 4 seconds gives points roughly 25-50m
(75-150 ft) apart.
(5) Method (4) is good enough for everything except crash analysis. If
you need that level of detail you'll either need to record every
sentence (simple) or keep, say, the last 30 secs worth of sentences
in a FIFO queue and apply any of (1) to (4) to data that is older than
that.
Method (5) is simple and cheap these days. $GPMRC sentences are around 70
bytes, so 24 hours at 1 second is a bit under 6 MB, or 2 GB/year of
continuous recording.
I'd seriously suggest to the OP that, if he doesn't know typical movement
patterns for the vehicles he needs to monitor, that he gets an EW Micro-
recorder and uses it to collect some data for analysis. The Microrecorder
can record 30 hours of data at 1 sample/sec: it does not use data
compression, has a built-in GPS and rechargeable battery and looks like a
USB memory stick to a PC. Its a rugged, pocket size unit.