Read elevation data for any region on Earth.
elevation(
extent = c(-180, 180, -90, 90),
...,
dimension = NULL,
projection = NULL,
resample = "bilinear",
source = NULL,
threshold = 0.5
)
a numeric vector of xmin,xmax,ymin,ymax or a terra or raster rast object
arguments passed to 'vapour::vapour_warp_raster'
optional output size in ncol,nrow (x,y)
optional coordinate reference system to use (map projection), longlat is assumed
resampling algorithm for the GDAL warper, "bilinear" by default
a GDAL raster source, to override the inbuild GEBCO + SRTM (in future we might patch in local source)
a size in degrees above which no SRTM data is queried (about )
a matrix, or depending on format of 'extent' a terra rast or raster object with elevation data
Originally using GEBCO 2019 as a background, and SRTM 30m resolution for regions that fit approximately within the size of an SRTM tile (these are 1 degree wide).
Note that data is streamed into memory, so don't make the dimensions of the 'x' target raster too big.
To use these data, please attribute the use of GEBCO to the GEBCO Compilation Group (2021) GEBCO 2021 Grid (doi:10.5285/c6612cbe-50b3-0cff-e053-6c86abc09f8f), and the use of Copernicus GLO30 to European Space Agency, Sinergise (2021). Copernicus Global Digital Elevation Model. Distributed by OpenTopography. https://doi.org/10.5069/G9028PQB.
image(elevation(), useRaster = TRUE)
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"
image(elevation(c(100, 150, -60, -20)), useRaster = TRUE)
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"
elevation(terra::rast())
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"
#> class : SpatRaster
#> dimensions : 180, 360, 1 (nrow, ncol, nlyr)
#> resolution : 1, 1 (x, y)
#> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84
#> source(s) : memory
#> name : lyr.1
#> min value : -7187
#> max value : 5332
elevation(raster::raster())
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"
#> class : RasterLayer
#> dimensions : 180, 360, 64800 (nrow, ncol, ncell)
#> resolution : 1, 1 (x, y)
#> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> source : memory
#> names : layer
#> values : -7187, 5332 (min, max)
#>
elevation(raster::raster(raster::extent(80, 120, -60, -40), res = 0.25, crs = "OGC:CRS84"))
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"
#> class : RasterLayer
#> dimensions : 80, 160, 12800 (nrow, ncol, ncell)
#> resolution : 0.25, 0.25 (x, y)
#> extent : 80, 120, -60, -40 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> source : memory
#> names : layer
#> values : -5075, -1278 (min, max)
#>
# \donttest{
elevation(terra::rast(terra::ext(c(-1, 1, -1, 1) * 15e3), nrows = 256, ncols = 256,
crs = "+proj=laea +lat_0=44.6371 +lon_0=-63.5923"))
#> [1] "SRTM in use, in addition to GEBCO"
#> [1] "/vsicurl/https://gebco2023.s3.valeria.science/gebco_2023_land_cog.tif"
#> [2] "/vsicurl/https://opentopography.s3.sdsc.edu/raster/COP90/COP90_hh.vrt"
#> class : SpatRaster
#> dimensions : 256, 256, 1 (nrow, ncol, nlyr)
#> resolution : 117.1875, 117.1875 (x, y)
#> extent : -15000, 15000, -15000, 15000 (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=laea +lat_0=44.6371 +lon_0=-63.5923 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
#> source(s) : memory
#> name : lyr.1
#> min value : -1
#> max value : 151
# }