powered by
Convert a spatial extent to polygons.
ext2spy(x, crs = "EPSG:4326", as_sf = TRUE)
Depending on 'as_sf', either a c(sf, data.frame) or SpatVector
c(sf, data.frame)
SpatVector
object.
A SpatExtent object, or any object from which such an object can be extracted, e.g. SpatRaster.
SpatExtent
SpatRaster
Coordinate reference system set via terra::crs().
terra::crs()
logical. If TRUE (default), the returned object is of class sf rather than Spatial*.
logical
TRUE
sf
Spatial*
Florian Detsch
terra::ext().
terra::ext()
ext = terra::ext(c(25, 70, -5, 30)) ext2spy(ext) # 'sf' (default) ext2spy(ext, as_sf = FALSE) # 'Spatial*'
Run the code above in your browser using DataLab