Search code examples
gpx

Gpx file format, what use of segment?


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


Solution

  • 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.