LocoKit icon indicating copy to clipboard operation
LocoKit copied to clipboard

Open source Arc App's GPX export functionality

Open sobri909 opened this issue 6 years ago • 1 comments

Arc App has internal code for translating sets of LocomotionSamples and TimelineItems into GPX documents. There's no reason why that can't be part of LocoKit, instead of hidden away in Arc App.

It could probably be done nicely on TimelineSegment. Fetch a segment for a date range, then have a method on the segment that returns a GPX document. Although I think Arc App's code is going it the other way around, in that a GPX document can be initialised by passing in a TimelineSegment. There's pros and cons either way, I guess. Both are legit.

Okay so this is what I'm seeing in Arc App's GPX class at the moment:

class GPX {

    let timelineItems: [TimelineItem]

    init(path: ArcPath) {
        self.timelineItems = [path]
    }
    
    init?(timelineItems: [TimelineItem]) {
        if timelineItems.isEmpty {
            return nil
        }
        
        self.timelineItems = timelineItems
    }

    ...

}

So it looks like it's also happy to produce GPX for a single path, which makes sense.

Anyway, this should be trivial to do. Just a matter of finding some spare time to get it done!

sobri909 avatar Jun 15 '18 04:06 sobri909

Should also look into KML export at the same time.

Last time I looked at KML it seemed like it wasn't possible to add timestamps to elements. Which made it basically useless for timeline item exports.

But I've since been told by an Arc App user that it is possible. And looking again at the spec now, it does seem entirely possible to add timestamps. So I don't know what I was on about last time.

https://developers.google.com/kml/documentation/kmlreference

sobri909 avatar Jun 15 '18 06:06 sobri909