convHull,GVector-method | R Documentation |
Create a minimum convex hull around a spatial vector.
## S4 method for signature 'GVector'
convHull(x, by = "")
x |
A |
by |
Character: If |
A GVector
.
terra::convHull()
, sf::st_convex_hull()
, module v.hull
in GRASS
if (grassStarted()) {
# Setup
library(sf)
# Points vector of specimens of species in the plant genus Dypsis
madDypsis <- fastData("madDypsis")
# Convert sf to a GVector:
dypsis <- fast(madDypsis)
### Convex hull for all plant specimens together:
ch <- convHull(dypsis)
### Convex hull for each species:
head(dypsis) # See the "rightsHolder" column?
chHolder <- convHull(dypsis, by = "rightsHolder")
### Plot:
plot(dypsis)
plot(ch, add = TRUE)
n <- length(chHolder)
for (i in 1:n) {
plot(chHolder[[i]], border = i, add = TRUE)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.