Create elevation profiles from activity data
Usage
get_elev_prof(act_data, ...)
# S3 method for class 'list'
get_elev_prof(
act_data,
acts = 1,
id = NULL,
key,
total = FALSE,
expand = 10,
units = "metric",
fill = "darkblue",
...
)
# S3 method for class 'actframe'
get_elev_prof(
act_data,
key,
total = FALSE,
expand = 10,
fill = "darkblue",
...
)
# S3 method for class 'strframe'
get_elev_prof(act_data, total = FALSE, expand = 10, fill = "darkblue", ...)Arguments
- act_data
an activities list object returned by
get_activity_listor adata.framereturned bycompile_activities- ...
arguments passed to or from other methods
- acts
numeric value indicating which elements of
act_datato plot, defaults to most recent- id
optional character vector to specify the id(s) of the activity/activities to plot,
actsis ignored if provided- key
chr string of Google API key for elevation data, passed to
google_elevation, see details- total
logical indicating if elevations are plotted as cumulative climbed by distance
- expand
a numeric multiplier for expanding the number of lat/lon points on straight lines. This can create a smoother elevation profile. Set
expand = 1to suppress this behavior.- units
chr string indicating plot units as either metric or imperial, this has no effect if input data are already compiled with
compile_activities- fill
chr string of fill color for profile
Details
The Google API key is easy to obtain, follow instructions here: https://developers.google.com/maps/documentation/elevation/#api_key
Examples
if (FALSE) { # \dontrun{
# get my activities
stoken <- httr::config(token = strava_oauth(app_name, app_client_id, app_secret, cache = TRUE))
my_acts <- get_activity_list(stoken)
# your unique key
mykey <- 'Get Google API key'
get_elev_prof(my_acts, acts = 1:2, key = mykey)
# compile first, change units
my_acts <- compile_activities(my_acts, acts = c(1:2), units = 'imperial')
get_elev_prof(my_acts, key = mykey)
} # }