#' Wrapper around httr::GET
#'
#' Adds cle header to httr::GET request
#'
#' @param url character
#'
#' @return response object
request_skitour <- function(url) {
skitour_api_key <- Sys.getenv("SKITOUR_API_KEY") # should be set as an env var
if (skitour_api_key == "") {
stop("SKITOUR_API_KEY env var is empty. It should be set to a valid API key. See: https://skitour.fr/api/")
}
# request using header `cle`
httr::GET(url, httr::add_headers(cle = skitour_api_key))
}
#' Jitter routes coordinates
#'
#' Jitter routes coordinates to avoid overlapping when displayed on the map
#'
#' @return tibble
#'
#' @export
jitter_df <- function(df) {
sf::st_jitter(df, factor = 0.0005)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.