From 3d324fea1d2daa6204be8cb66b3bbe0256897dc3 Mon Sep 17 00:00:00 2001 From: Robin Lovelace Date: Wed, 18 Aug 2021 22:50:29 +0100 Subject: [PATCH] Improve docs for elevation_get() --- R/slope_get.R | 14 ++++++++++++-- man/elevation_get.Rd | 18 +++++++++++++----- man/slope_raster.Rd | 2 +- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/R/slope_get.R b/R/slope_get.R index 5c1afcc..c6f0961 100644 --- a/R/slope_get.R +++ b/R/slope_get.R @@ -1,11 +1,21 @@ #' Get elevation data from hosted maptile services #' +#' `elevation_get()` uses the `[ceramic::cc_elevation()]` function to get +#' DEM data in raster format anywhere worldwide. +#' It requires an API that can be added by following guidance in the package's +#' [README](https://github.com/ITSLeeds/slopes#installation-for-dem-downloads). +#' +#' +#' Note: if you use the `cc_elevation()` function directly to get DEM data, +#' you can cache the data, as described in the package's +#' [README](https://github.com/hypertidy/ceramic#local-caching-of-tiles). +#' #' @param file Where to save the resulting data if specified (not implemented) #' @param ... Options passed to `cc_elevation()` #' @inheritParams slope_raster #' @export #' @examples -#' # Time-consuming examples that require an internet connectioin and API key: +#' # Time-consuming examples that require an internet connection and API key: #' \donttest{ #' library(sf) #' library(raster) @@ -16,7 +26,7 @@ #' plot(e) #' plot(sf::st_geometry(routes), add = TRUE) #' } -elevation_get = function(routes, file = NULL, ...) { +elevation_get = function(routes, ...) { if(requireNamespace("ceramic")) { mid_ext = sf_mid_ext_lonlat(routes) bw = max(c(mid_ext$width, mid_ext$height)) / 1 # buffer width diff --git a/man/elevation_get.Rd b/man/elevation_get.Rd index 424e212..ad5384e 100644 --- a/man/elevation_get.Rd +++ b/man/elevation_get.Rd @@ -4,21 +4,29 @@ \alias{elevation_get} \title{Get elevation data from hosted maptile services} \usage{ -elevation_get(routes, file = NULL, ...) +elevation_get(routes, ...) } \arguments{ \item{routes}{Routes, the gradients of which are to be calculated. The object must be of class \code{sf} with \code{LINESTRING} geometries.} -\item{file}{Where to save the resulting data if specified (not implemented)} - \item{...}{Options passed to \code{cc_elevation()}} + +\item{file}{Where to save the resulting data if specified (not implemented)} } \description{ -Get elevation data from hosted maptile services +\code{elevation_get()} uses the \verb{[ceramic::cc_elevation()]} function to get +DEM data in raster format anywhere worldwide. +It requires an API that can be added by following guidance in the package's +\href{https://github.com/ITSLeeds/slopes#installation-for-dem-downloads}{README}. +} +\details{ +Note: if you use the \code{cc_elevation()} function directly to get DEM data, +you can cache the data, as described in the package's +\href{https://github.com/hypertidy/ceramic#local-caching-of-tiles}{README}. } \examples{ -# Time-consuming examples that require an internet connectioin and API key: +# Time-consuming examples that require an internet connection and API key: \donttest{ library(sf) library(raster) diff --git a/man/slope_raster.Rd b/man/slope_raster.Rd index 23f3084..a88dd3e 100644 --- a/man/slope_raster.Rd +++ b/man/slope_raster.Rd @@ -6,7 +6,7 @@ \usage{ slope_raster( routes, - dem = NULL, + dem, lonlat = sf::st_is_longlat(routes), method = "bilinear", fun = slope_matrix_weighted,