beacen.

GPX internals field answer 035

What happens when one GPX contains several routes or tracks?

The short answer

GPX 1.1 allows one file to contain multiple route and track elements. They may be alternatives, stages, recordings or unrelated lines, and the format does not automatically define their relationship. Importers must choose how to present supported elements. Inspect names, starts, finishes and geometry before selecting or deliberately combining anything.

One container, several lines

GPX 1.1 permits any number of route and track elements.

Inside one <gpx> root, the official schema allows zero or more waypoints, followed by zero or more routes and zero or more tracks. Each route has its own ordered route points. Each track has its own name, optional details and one or more track segments.

This makes GPX a container as well as a line format. A single file can hold alternative planned routes, separate days of a trip, several recorded attempts or a planned route beside an observed track.

The document does not automatically declare those lines to be consecutive, alternatives or parts of one journey. Names, descriptions, numbers and source context must carry that meaning, and all of those labels are optional.

Import choices

Receiving software has to decide what the user meant to import.

The GPX schema defines the elements, but it does not impose one user-interface policy for a multi-line file. Software may expose every route and track separately, ask for a choice, import only supported element types, or produce a combined display.

  • Several routesThey may be alternatives, stages or unrelated plans. Document order alone does not tell the reader which interpretation is correct.
  • Several tracksEach is a distinct ordered path. A break between tracks is stronger than a segment break inside one track.
  • A route and a trackThey may represent a plan and its recording, but GPX does not bind them together or declare which one is authoritative.
  • Unnamed elementsValid files can omit names, making a visual inspection essential before choosing a line.

Compatibility should be tested in the destination rather than inferred from the fact that both files use the .gpx suffix.

False continuity

Combining elements can invent travel between unrelated endpoints.

If two tracks are concatenated, the final point of the first and the first point of the second become neighbours in the new sequence. A renderer or distance calculation may then treat the straight gap between them as part of one course. Nothing in the original file asserted that connection.

Joining alternative routes is worse: it can create a line that travels one option, jumps to another and then doubles back. Reordering elements by name or proximity also changes the document's evidence.

If several lines genuinely form stages, assemble a new navigation copy deliberately. Decide the stage order, review each connection and preserve boundaries where continuity is unknown.

Several lines in one file are a collection until their relationship is established.

Before import

Inventory the elements, then choose the exact line you need.

  1. List

    Count routes, tracks and segments.

    Record their names, numbers, start points and finish points rather than relying on the file name.

  2. Preview

    Display every element in a viewer that distinguishes them.

    Look for alternatives, repeated geometry, unexpected stages and widely separated lines.

  3. Select

    Export the intended line to a separate copy if necessary.

    Retain its original order and segment boundaries unless you have a clear reason to edit them.

  4. Name

    Give the selected line an unambiguous title.

    Include the stage or direction when that prevents confusion at the destination.

  5. Verify

    Review the final import.

    Check that the chosen line, not a first or fallback element, appears in your route Library.

Sources & scope

What this answer is based on.

The schema permits repeated route and track elements but does not prescribe a receiving app's selection interface or declare relationships between separate elements.