extentToVect | R Documentation |
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.
extentToVect(x, ...)
x |
A |
... |
Arguments to supply to |
A SpatVector
(usual) or, if the input is an sf
object, an sf
polygon object.
plotExtent
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.