Search code examples
floating-pointgpscompressioncoordinatesgpx

Is there any algorithm suitable for compression of GPS waypoints?


I am looking for any algorithm for lossy compression of GPS track waypoints with coordinates in EPSG:4326 CRS (this usual degrees like (75.223423,-10.123123))

For short, after wiping out meta information and simplification with Ramer–Douglas–Peucker algorithm, I have an ordered sequence of waypoint coordinates, each waypoint takes 16 bytes (2 x 8-byte double).

Using the knowledge that waypoints are ordered, and the distance between waypoints in most cases is less than 0.01° (~1 km at equator), I made an assumption, that there may be some kind of lossy compression algorithm for such sequences.

Could you help me find it out, please.

UPD: According to real tracks (~800 analyzed), the distance in degrees between points is shown below. P95 is 95th percentile of all distances.

LON    
    avg: 0,000334560520818109
    p95: 0,001239999999999240 # ~138 meters
    max: 0,307273900000000000
LAT    
    avg: 0,000221987685948093
    p95: 0,000839999999996621
    max: 0,309625799999999000

Solution

  • I found an existing solution: There is TinyWKB or TWKB or Tiny Well-known Binary data format suits my needs.

    • It stores geometry primitives (it has LineString support for my current needs).
    • It stores data using deltas.
    • It supports precision for floating points (+2 to -2).
    • It supports ID-data for geometries.
    • It can be written using .Net module for NetTopologySuite.

    TinyWKB is developed from WKT -> WKB -> TWKB to store geometry primitives (Points, LineStrings, Polygons, MultiPoints, MultiLineStrings, MultiPolygons, GeometryCollections)