extentToVect {enmSdmX} | R Documentation |
Convert extent to a spatial polygon
Description
This function returns a SpatVector
or sf
polygon representing an extent. The input can be a SpatExtent
or sf
object, or an object from which a SpatExtent
(extent) can be obtained.
Usage
extentToVect(x, ...)
Arguments
x |
A |
... |
Arguments to supply to |
Value
A SpatVector
(usual) or, if the input is an sf
object, an sf
polygon object.
See Also
Examples
data(mad0)
madExtent <- extentToVect(mad0)
plot(madExtent, border='blue', lty='dotted')
plot(mad0[1], add=TRUE)
# NB This is the same as:
library(terra)
madExtent <- ext(mad0)
madExtent <- as.polygons(madExtent, crs = crs(mad0))
[Package enmSdmX version 1.1.6 Index]