A class agnostic function to return the bounding extent (i.e. bounding box) of a spatial object.
Usage
get_ext(x, ...)
# S3 method for class 'SpatRaster'
get_ext(x, ...)
# S3 method for class 'SpatVector'
get_ext(x, ...)
# S3 method for class 'sf'
get_ext(x, ...)
# S3 method for class 'sfc'
get_ext(x, ...)
# S3 method for class 'stars'
get_ext(x, ...)
# S3 method for class 'stars_proxy'
get_ext(x, ...)
# S3 method for class 'ezgrid'
get_ext(x, ...)
# S3 method for class 'character'
get_ext(x, ...)See also
Other spatial helpers (class agnostic):
get_dim(),
get_proj(),
get_source()
Examples
f <- system.file("ex/elev.tif", package = "terra")
get_ext(f)
#> [1] 5.741667 6.533333 49.441667 50.191667
get_ext(terra::rast(f))
#> xmin xmax ymin ymax
#> 5.741667 6.533333 49.441667 50.191667
f2 <- system.file("ex/lux.shp", package = "terra")
get_ext(f2)
#> [1] 5.744140 6.528252 49.447807 50.181622