| check_valid | R Documentation |
Validates sf geometry, repairs invalid features, unifies
geometry types, and optionally reprojects. Handles GEOMETRYCOLLECTION
artifacts from st_make_valid() by extracting the dominant
geometry type.
check_valid(x, ...)
## S3 method for class 'sf'
check_valid(x, out_prj = sf::st_crs(x), ...)
## S3 method for class 'sfc'
check_valid(x, out_prj = sf::st_crs(x), ...)
x |
sf data.frame, sfc geometry, or NULL. |
... |
additional arguments passed to methods. |
out_prj |
crs. Target CRS for the output, passed to
|
Same class as input: sf data.frame, sfc, or NULL.
library(sf)
p1 <- st_polygon(list(
rbind(c(0, 0), c(10, 0), c(10, 10), c(0, 10), c(0, 0)),
rbind(c(2, 2), c(2, 8), c(8, 8), c(8, 2), c(2, 2))
))
x <- st_sf(geometry = st_sfc(p1, crs = 5070))
result <- check_valid(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.