Skip to main content

Module gpx

Module gpx 

Source
Expand description

GPX tracks, routes and waypoints: one row per trkpt, rtept or wpt.

GPX is XML, read here by a small scanner of its own rather than an XML crate. The one in the tree is optional (it comes with the cloud feature), and its streaming reader buffers each event whole, so a text node of gigabytes is gigabytes. GPX needs a sliver of XML: elements, attributes, text, the five entities and character references. Everything else (comments, CDATA, processing instructions, a DOCTYPE) is passed over, and entities a DOCTYPE declares are never expanded.

Every length is bounded by the reader: markup (a tag with its attributes, a comment) is at most MAX_MARKUP bytes, text is kept to MAX_TEXT per value, elements nest at most MAX_DEPTH deep, and a file adds at most MAX_FIELDS columns. Text between tags is never buffered past what is kept, however long.

Structs§

FieldColumn
What one field column held, to type it once the file is read.
GpxReader
A GPX file read a piece at a time.
Stats
What a read counted.

Constants§

BATCH_ROWS
Rows held before they are handed over as a batch.
BATCH_TEXT
Text held before rows are handed over, however few: a point may carry a few hundred fields of MAX_TEXT each.
CORE
The columns every GPX table has, in order. Fields found in the file follow.
MAX_DEPTH
How deep elements may nest. GPX’s own structure is five deep.
MAX_FIELDS
The most columns a file’s extension and other fields may add.
MAX_MARKUP
The longest tag, comment or other markup read whole.
MAX_TEXT
The most of one value kept. A waypoint’s description is a sentence.

Functions§

looks_like
Whether the first bytes of a file are GPX: XML whose first element is gpx.
parse_time
A time as GPX writes it, ISO 8601 (2024-05-01T12:00:00Z, with fractions or an offset), as milliseconds since the epoch. One with no offset is UTC.