valid: Make an invalid geometry valid

Description Usage Arguments Details Value Examples

Description

Make an invalid geometry valid

Usage

1
2
3

Arguments

x

object of class sfg, sfg or sf

Details

st_make_valid uses the lwgeom_makevalid method also used by the PostGIS command ST_makevalid.

Value

Object of the same class as x

Examples

1
2
3
4
5
6
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))
y = lwgeom::st_make_valid(x)
st_is_valid(y)
y %>% st_cast()

lwgeom documentation built on Jan. 31, 2020, 5:07 p.m.