Basically I want to take an array of coordinates in long,lat format (qgis exports them that way by default it seems) and compress the coords as lines (two pairs at a time) for storage in a custom app for a navigation device I guess like this:
Line 1 = Point A, Point B -> compress together
Line 2 = Point B, Point C -> compress together
Etc
Then in the xml save the compressed pairs of each line by the location of the first pair of the two pairs (still following?). Basically if Line 1’s point A is within such n such distance to Line 2’s point B then save them in the same array of json data in an xml, else if Point B is not within such n such distance of Point A then save Point B in a new line of Json data. Ideally with the such n such distance being configurable I guess, perhaps also the amount of compression too (e.g for use with a smaller dataset less compression to retain more accuracy)
Then obviously to draw the gpx on the navigation device I would use the same decompression algorithm (but translated into Monkey C which I do know) but due to the fact the large gpx would now be chunked by location it would save the gps devices memory.
Example coords data (extracted from a gpx via qgis) 141.289,-2.703,141.182,-2.666,141.067,-2.654,141.017,-2.629,140.836,-2.625,140.733,-2.658,140.683,-2.641,140.663,-2.6,141.289,-2.703,141.562,-2.814,141.586,-2.835,141.793,-2.926,141.854,-2.984,141.991,-2.984,142.032,-3.008,142.04,-3.041,142.069,-3.078,142.131,-3.083,142.189,-3.111,142.329,-3.144,142.387,-3.19,142.543,-3.272,142.815,-3.338,142.873,-3.363,143.108,-3.392,143.141,-3.408,143.228,-3.408,143.447,-3.458,141.289,-2.703,141.182,-2.666,141.067,-2.654,141.017,-2.629,140.836,-2.625,140.733,-2.658,140.683,-2.641,140.663,-2.6,141.289,-2.703,141.562,-2.814,141.586,-2.835,141.793,-2.926,141.854,-2.984,141.991,-2.984,142.032,-3.008,142.04,-3.041,142.069,-3.078,142.131,-3.083,142.189,-3.111,142.329,-3.144,142.387,-3.19,142.543,-3.272,142.815,-3.338,142.873,-3.363,143.108,-3.392,143.141,-3.408,143.228,-3.408,143.447,-3.458
Desired outcome example (Note the array of coords I have presented would oresult in a larger amount of data then the example data I’ve provided below.):
<JsonData<id=“0m_2” [234579462255,63528290278,63729294736]>/JsonData>
<JsonData<id=“0m_3” [8495794622,63528290246,25382947482]>/JsonData>
Each number is two pairs of coords sorted