valid {terra}R Documentation

Check or fix polygon validity

Description

Check the validity of polygons or attempt to fix it

Usage

## S4 method for signature 'SpatVector'
is.valid(x, messages=FALSE, as.points=FALSE)

## S4 method for signature 'SpatVector'
makeValid(x)

Arguments

x

SpatVector

messages

logical. If TRUE the error messages are returned

as.points

logical. If TRUE, it is attempted to return locations where polygons are invalid as a SpatVector or points

Value

logical

Examples

Run examples

w <- vect("POLYGON ((0 -5, 10 0, 10 -10, 0 -5))")
is.valid(w)

w <- vect("POLYGON ((0 -5, 10 0, 10 -10, 4 -2, 0 -5))")
is.valid(w)
is.valid(w, TRUE)

plot(w)
points(cbind(4.54, -2.72), cex=2, col="red")


[Package terra version 1.5-34 Index]