convhull: Convex hull and minimal rotated rectangle

Description Usage Arguments Value Examples

Description

Get the convex hull or the minimal rotated rectangle of a SpatVector

Usage

1
2
3
4
5
## S4 method for signature 'SpatVector'
convHull(x, by="")

## S4 method for signature 'SpatVector'
minRect(x, by="")

Arguments

x

SpatVector

by

character (variable name), to make convex hulls by group

Value

SpatVector

Examples

1
2
3
4
5
6
7
8
9
p <- vect(system.file("ex/lux.shp", package="terra"))
h <- convHull(p)

hh <- convHull(p, "NAME_1")
rr <- minRect(p, "NAME_1")

plot(rr, lwd=5, border="gray")
plot(hh, "NAME_1", col=rainbow(10, alpha=.5), lwd=3, add=TRUE, plg=list(x="topright"))
lines(aggregate(p, "NAME_1"), col="blue", lty=2, lwd=2)

terra documentation built on Oct. 11, 2021, 9:09 a.m.