Aliases: valid st_is_valid st_is_valid.sfc st_is_valid.sf st_is_valid.sfg st_make_valid st_make_valid.sfg st_make_valid.sfc
Keywords:
### ** Examples p1 = st_as_sfc("POLYGON((0 0, 0 10, 10 0, 10 10, 0 0))") st_is_valid(p1)
[1] FALSE
st_is_valid(st_sfc(st_point(0:1), p1[[1]]), reason = TRUE)
[1] "Valid Geometry" "Self-intersection[5 5]"
library(sf) x = st_sfc(st_polygon(list(rbind(c(0,0),c(0.5,0),c(0.5,0.5),c(0.5,0),c(1,0),c(1,1),c(0,1),c(0,0))))) suppressWarnings(st_is_valid(x))
[1] FALSE
y = st_make_valid(x) st_is_valid(y)
[1] TRUE
y %>% st_cast()
Geometry set for 1 feature Geometry type: POLYGON Dimension: XY Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1 CRS: NA