# Causal downsampling of a small buffer of GPS positions

Not sure this is the right place to ask, but I hope so.

# Context

A GPS receptor is installed in a moving vehicle, and saves the measured positions with a resolution of at most $r_0$ to a small (a few dozen positions) buffer. The buffer is small due to memory limitations.

The buffer is kept as empty as possible while the vehicle is connected to a network. However, the network coverage has several gaps large enough to allow the buffer to be filled. As a result, positions measured after the buffer is filled are currently thrown away.

This causes our main use case, which is to display and analyse routes, to present large jumps between the edges of a network shadow zone. It would be better if the positions in or close to the shadow zone are saved in a smaller resolution than not at all.

# Specifics

So the current approach is to downsample the buffer when it's full, in ordere to make more room for new positions. Since the sampling rate across the buffer is not constant, we just find the chunk which has the highest resolution and cut an element of it.

Since this happens in real-time, the downsampling is causal (we only know the past points), and thus selecting the best point in this buffer is not looking trivial (to me at least).

Question: are there general methods for this problem or should I continue via the ad hoc approach?

• What sort of analysis are you doing on the signal afterwards? Do you have anything that actually relies upon there being a constant sample rate? If it works for you, the ad hoc approach that you described seems reasonable. One other idea: I'm not sure how you're storing your positions, but if you're just storing a vector of $[x, y, z, t]$ for each data point, you might be able to come up with something more compact by exploiting the fact that positions aren't likely to change fast. By doing so, you could effectively compress your data somewhat so you can store more positions in memory at once. – Jason R Nov 23 '15 at 14:57
• Main use case is showing vehicle trips on a map. The sampling rate is not important at all (and isn't even very exact to begin with). The storage is basically what you said but with accuracy data (number of satellites, etc). Some basic optimizations are already being done to reduce the number of points stored, but it still comes down to needing downsampling. My main doubt with the ad hoc approach I described is which point to pop out. – Rafael Almeida Nov 24 '15 at 14:14