parse_gpx: Parses a GPX file into a tibble.

Description Usage Arguments Value See Also Examples

View source: R/parse.R

Description

This parses a standard GPS Exchange Format XML (GPX) file into an act_tbl.

Usage

1
parse_gpx(filename, detail = c("basic", "latlon", "advanced"), every = NA)

Arguments

filename

The GPX file to parse

detail

How much detail to parse from the GPX. * If "basic", the default, this will load lat / lon / ele / time. * If "latlon", it will only load lat/lon: useful for GPX files exported without time information. * If "advanced", it will load everything from basic, plus hr / cad / atemp: useful for files with HR information.

every

Optional. If provided, determines how frequently points will be sampled from the file, so if 10 is provided, every tenth point will be selected. If omitted or set to 1, every point will be selected. Must be a positive integer.

Value

A act_tbl with one row for each trackpoint in the GPX (modified by every), and with the columns determined by detail.

lat

latitude, a dbl in degrees between -90 and 90

lon

longitude, a dbl in degrees between -180 and 180

ele

elevation, a dbl in meters

time

time, a dttm representing the time of the point

hr

heart rate, an int in beats per minute

cad

cadence, an int in one-foot steps per minute

Additionally, attributes are set on the tibble containing top level data from the GPX. Each of these will be NA when not provided in the file.

filename

the filename this was parsed from. This is always present, and is always the value of the filename argument.

time

time, a dttm representing the time of the GPX

title

title, a chr

desc

description, a chr

type

type, a chr

See Also

https://en.wikipedia.org/wiki/GPS_Exchange_Format

https://www.topografix.com/gpx.asp

Examples

1
2
3
4
5
6
running_file <- system.file(
  "extdata",
  "running_example.gpx.gz",
  package = "activatr"
)
running_df <- parse_gpx(running_file)

activatr documentation built on Jan. 15, 2021, 3:36 p.m.