Repair polygon geometries according to the international standards ISO 19107 using a constrained triangulation approach (van Oosterom et al. 2005; Ledoux et al. 2014)
Arguments
- x
sf::st_sf()
,sf::st_sfc()
orsfg
object (containingPOLYGON
orMULTIPOLYGON
geometries).
Details
The function supports two algorithms:
oddeven: an extension of the odd-even algorithm to handle polygons containing inner rings and degeneracies;
setdiff: one where we follow a point set difference rule for the rings (outer - inner).
References
Ledoux H, Arroyo Ohori K, and Meijers M (2014) A triangulation-based approach to automatically repair GIS polygons. Computers & Geosciences 66:121--131.
van Oosterom P, Quak W, and Tijssen T (2005) About Invalid, Valid and Clean Polygons In: Developments in Spatial Data Handling. Springer, Berlin, Heidelberg
See also
See sf::st_make_valid()
for another approach to repair polygon
geometries.
Examples
# \dontrun{
# create an object containing a broken polygon geometry
x <- sf::st_as_sfc("POLYGON((0 0, 0 10, 10 0, 10 10, 0 0))")
# check if this polygon is indeed broken
sf::st_is_valid(x)
#> [1] FALSE
# repair the polygon
y <- st_prepair(x)
#> Linking to GEOS 3.11.1, GDAL 3.6.4, PROJ 9.3.1; sf_use_s2() is TRUE
# check that the repaired polygon has been fixed
print(st_is_valid(y))
#> [1] TRUE
# }