[talk-au] Running stats against GPX files ...

James Livingston doctau at mac.com
Thu Jun 25 10:06:00 BST 2009


On 25/06/2009, at 6:53 PM, James Livingston wrote:
> If you are that concerned about space, you'd definitely want to use  
> some form of delta encoding, and probably variable-length encoding  
> too. Why spend a whole four bytes storing the latitude? Presumably  
> it's going to be fairly close to the previous point in the track,  
> not 10000km away. Same for time, it'll definitely be after the  
> previous timestamp and not by much.

Because I'm a bit bored, I thought about the above. Assume you want an  
accuracy of 1m and 1s:

If the first byte is -128 then what follows is a  "key point" which is  
stored in it's fully glory, using say the 13 byte encoding mentioned  
earlier. This happens when:
* it's the first point in the track
* the point is more than 255 seconds after the last one
* the point is more than 127m away from the last one, either in lat,  
lon or vertically
* the DOP has changed

If the first byte is not -128, then it is the change in altitude since  
the last point. The second byte is the change in latitude the third  
byte is the change in longitude, and the fourth is the number of  
seconds since the last point.


There you go, most points now take up 4 bytes :)


> If you want to get really fancy, you can start compressing straight- 
> ish sections with something similar to video I an B/P frame, storing  
> it as a fraction of the way between the two key points, and an  
> offset from the line joining them. But you're probably not that  
> keen :)

But I'm not that bored.


-- 
James




More information about the Talk-au mailing list