elev() downloads elevation data the Shuttle Radar Topography Mission (SRTM), specifically the hole-filled CGIAR-SRTM (90 m resolution) for latitudes between -60 and 60 or Mapzen's synthesis digital elevation product.

elev(output_dir, location, e_source = "mapzen", verbose = FALSE, ...)

Arguments

output_dir

Character (e.g., "../Desktop/chelsa"). Pathway to where the data will be stored.

location

A "sp", "sf" polygon or point object. See sf::st_polygon to make polygons and sf::st_as_sf to make point objects.

e_source

Character (e.g., mapzen or geodata). Indicating the elevation data source.

verbose

Logical specifying whether to display verbose output when downloading from Mapzen.

...

Additional arguments to download.file().

Value

elev() is called for its side-effects. It invisibly returns a "SpatRaster" object if files were downloaded successfully, and returns NULL otherwise. If the elevation data is sourced from geodata the SpatRaster is downloaded at a spatial resolution of 30 arc seconds (~1 km sq.). If elevation data is from Mapzen then the SpatRaster will be a mosaic. Specifically, Mapzen's SpatRaster is unique as it combines several sources of digital elevation models, including SRTM, the ArcticDEM (covering all areas north of 60°), EUDEM (digital elevation model over Europe; for review, see Mouratidis & Ampatzidis, 2019), and others into a single product. The resolution of this SpatRaster was set to 7, corresponding to 611.5 m ground resolution at 60° latitude 864.8 m at 45° and 1223 m at 0°.

References

Hijmans, R.J., Barbosa, M., Ghosh, A., & Mandel, A. (2023). geodata: Download Geographic Data. R package version 0.5-8. https://CRAN.R-project.org/package=geodataHollister, J. (2022). elevatr: Access Elevation Data from Various APIs. R package version 1.0.0. doi:10.5281/zenodo.5809645https://CRAN.R-project.org/package=elevatrMouratidis, A., & Ampatzidis, D. (2019). European Digital Elevation Model Validation against Extensive Global Navigation Satellite Systems Data and Comparison with SRTM DEM and ASTER GDEM in Central Macedonia (Greece). ISPRS International Journal of Geo-Information 8, 108. doi:10.3390/ijgi8030108

See also

A more convenient function for other climate and elevation data ce_download(). See sf::st_polygon to make polygons and sf::st_as_sf to make point objects.

Author

James L. Tsakalos and Martin R. Smith

Examples

# \donttest{
# Make a small polygon
polygon_py_sm <- sf::st_polygon(
list(cbind(long = c(156, 156, 155, 156),
lat = c(-60, -59, -60, -60)))
)
polygon_py_sm <- sf::st_geometry(polygon_py_sm)
sf::st_crs(polygon_py_sm) <- "epsg:4326"

# Create temporary file
temp_path <- tempfile()

# elevation will be saved in the output_dir (i.e. output directory)
elev(output_dir = temp_path, location = polygon_py_sm)
#> Mosaicing & Projecting

# Reset user options
unlink(file.path(temp_path))

# }