Learn R Programming

terra (version 0.8-6)

fill: Remove holes from polygons

Description

Remove the holes in SpatVector polygons

Usage

# S4 method for SpatVector
fill(x, ...)

Arguments

x

SpatVector

...

additional arguments. None implemented

Value

character

Examples

Run this code
# NOT RUN {
x <- rbind(c(-10,0), c(140,60), c(160,0), c(140,-55))
hole <- rbind(c(80,0), c(105,13), c(120,2), c(105,-13))

z <- rbind(cbind(object=1, part=1, x, hole=0), 
		   cbind(object=1, part=1, hole, hole=1))
colnames(z)[3:4] <- c('x', 'y')
z <- data.frame(z)
p <- vect(z, "polygons")
p

f <- fill(p)

plot(f, col="light blue", lwd=8, border="blue")
lines(p, lwd=2, col="red")
# }

Run the code above in your browser using DataLab