Skip to main content
Question

GPX import ignores trkseg XML tags thus violating GPX specification and counting wrong distance

  • November 7, 2023
  • 7 replies
  • 74 views

Forum|alt.badge.img+7

It looks like Strava's GPX importer completly ignores "trkseg" XML tag. In attached file there are two segments.

GPX file contains one track (trk XML tag). This track can have one or more segments (trkseg XML tag). Segment have points (trkpt XML tag). Distance should be counted as distance between all points inside one (and every) segment but not between segments.

Example:
Let's have one track with two segments.

First segment: point A, point B, point C
Second segment: point D, point E

Distance should be counted as:
track_distance = distance(A, B) + distance(B, C) + distance(D, E)

You count it as:
track_distance = distance(A, B) + distance(B, C) + distance(C, D) + distance(D, E)
(which is wrong, distance between C and D must not be in total distance)

Distance between last segment point and first point of next segment must not be counted in whole distance.

According to GPX specification:

https://www.topografix.com/GPX/1/1/#type_trksegType
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.

Last Track Point of Segment is not logically connected to next Track Segment. You are violating specification and counting completely wrong summary distance.

7 replies

Bryant
Community Manager
Forum|alt.badge.img+26
  • Community Manager
  • November 13, 2023

Thanks for submitting your idea. It has been reviewed by our moderation team and is now open to voting.


Forum|alt.badge.img+16
  • Hub Trailblazer
  • November 25, 2023

This shouldn't be in section Ideas, it is a bug and must be fixed!


Forum|alt.badge.img+7
  • Author
  • Hub Rookie
  • November 25, 2023

Yep, try to explain it to support. I did many times. Their reply:

With GPX files, our system calculates the distance between each GPS point for your overall distance. I understand that would like distance between these “segments” excluded, but this is currently not possible.

This is the the way our system currently works. If you would like it to work differently, I recommend submitting your feedback directly to our Community Hub.


Jan_Mantau
Superuser
Forum|alt.badge.img+27
  • Superuser
  • November 25, 2023

For me it reads like a bug too if it violates standards. I don't know much about gpx internals, are pauses (manual pauses or auto pauses) as well recorded with these tags? That would explain why so many complain that Strava includes elevations and distances that happens during pauses, like when using lifts or ferries.


Forum|alt.badge.img+7
  • Author
  • Hub Rookie
  • November 25, 2023

yes, manual or auto pauses should create new segments in GPX.


Forum|alt.badge.img
  • Hub Starter
  • January 30, 2024

Obvious errors as desired characteristics... Strava is so bad, I definitely won't pay any money for it. 


Forum|alt.badge.img+1
  • Hub Rookie
  • May 14, 2025

It is May 2025, and Strava still does not recognise <trkseg> </trkseg> tags in a recorded gpx file created by my OsmAnd app. Oddly enough, the FIT file produced by my Karoo 2 head unit (which contain separated segments), those segments are recognised by Strava.