Skip to content

Track metadata (name, comment, description, number, type) is never parsed #13

Description

@thomthom

Track declares and exposes name, comment, description, number and type, but ReadGpxXml in src/cpp/fastgpx/fastgpx.cpp only reads <metadata><name>, <trkseg> and <trkpt>. The <trk> children are never visited, so from Python these attributes are always None.

gpx = fastgpx.load("gpx/test/two-points.gpx")
gpx.tracks[0].name   # None, even when <trk><name> is present

The README example prints track.name, so users will expect this to work.

Suggested fix: read <name>, <cmt>, <desc>, <number> and <type> in the <trk> loop. This is a handful of child() lookups per track, so it does not affect the per-point cost. Note that gpx.name returns '' for an empty <name></name> while a missing element gives None; the same convention should apply to tracks.

Found in the code analysis session; see the other code-analysis issues for related findings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions