Gpx file format, what use of segment?
Asked Answered
B

2

6

Gpx file is an XML document used to track spatio-temporal information. It look like:

<gpx>
    <trk>
       <segment>
           <trkpt lat="...", lon="..."></trkpt>
       </segment>
    </trk>
</gpx>

Except gpx super-tag, every tag can be replaced more and more. The question is: What use of segment tag? Why trkpt tag can't be collected directly inside parent trk tag? What concept behind the organization of trkpt in set of segment? I've search for this on official gpx website, http://www.topografix.com/gpx.asp, but i've found nothing! :(

Best Regards MC

Bortz answered 29/10, 2011 at 14:51 Comment(1)
In example, my tracker app is going into auto-pause when you don't move. Then it uses a weaker GPS accuracy and if it resumes tracking, it will begin a new segment. Any good software can later tell you, for how long you were really moving (in contrast to the time interval between the first and the very last trackpoint). I have looked up several GPX trackings of GPS devices and they don't use segments (Sigma, Teasi and Garmin). They store the duration of movement somehow else.Booker
B
15

Where you wrote <segment> you probably mean <trkseg>

One track can contain multiple segments. All points inside a segment are drawn as one continous line. There should however not be a line between segments. The example given for this on the gpx site is:

A Track Segment holds a list of Track Points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.

Another example could be a track that contains multiple stages in different areas or where there is some (unspecified) travel between the end of one stage and the start of the other.

Baluchistan answered 30/10, 2011 at 19:47 Comment(0)
R
3

The problem with the trkseg element, is that it has no default associated meta-data or subnodes, e.g. name, which is the least you'd want to meaningfully be able to work with it.

According to the GPX 1.1 spec, the element is openly extensible, so you can add you own subelements, like name, but the problem then is that you have no guarantee that this info will be read by any other piece of software.

This would suggest that it's probably a better idea to merge all trkseg's into 1 trkseg, and then work with a single trkseg - i.e. rather work at the trk level, and then use the trk element for storing info.

On the other hand, you might want to bear in mind that some popular GPS devices, e.g my Garmin eTrex 20, and anecdotally the e 30, don't display more than one track at a time on the map, which would suggest that in order to view e.g. an entire trail network on the handheld device, you should rather use a single trk, and multiple trkseg's.

Finally, you might want to be working with routes rather than tracks, depending on the situation.

Rewire answered 29/5, 2015 at 8:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.