elevation_get()
uses the
cc_elevation()
function from the ceramic
package 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
and in the
slopes
vignette.
elevation_get(routes, ..., output_format = "raster")
routes | Routes, the gradients of which are to be calculated.
The object must be of class |
---|---|
... | Options passed to |
output_format | What format to return the data in?
Accepts |
A raster object with cell values representing elevations in the
bounding box of the input routes
object.
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.
# Time-consuming examples that require an internet connection and API key: # \donttest{ library(sf) library(raster) routes = cyclestreets_route e = elevation_get(routes)#> Preparing to download: 6 tiles at zoom = 14 from #> https://api.mapbox.com/v4/mapbox.terrain-rgb/#> Error in curl::curl_download(url = api_query, outfile): HTTP error 401.#> Error in eval(expr, envir, enclos): object 'e' not found#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'crs': object 'e' not founde#> Error in eval(expr, envir, enclos): object 'e' not found#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'e' not found#> Error in plot.xy(xy.coords(x, y), type = type, ...): plot.new has not been called yet# }