st_prepair repairs single polygons according to the international standards ISO 19107
using a constrained triangulation approach.
st_prepair(x, algorithm = c("oddeven", "setdiff"), min_area = 0)
| x | object of class |
|---|---|
| algorithm | character; algorithm used to repair the polygon. oddeven (default) or setdiff. More on these two algorithm details. |
| min_area | numeric; all polygons with areas smaller than |
an object of class sf, sfc or sfg depending on whether
the input is respectively sf, sfc or sfg
st_prepair supports two algorithms:
oddeven: an extension of the odd-even algorithm to handle GIS polygons containing inner rings and degeneracies;
setdiff: one where we follow a point set difference rule for the rings (outer - inner).
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., Tijssen T. (2005). About Invalid, Valid and Clean Polygons. In: Developments in Spatial Data Handling. Springer, Berlin, Heidelberg
sf::st_make_valid for another approach to fix broken polygons
if (FALSE) { library(sf) p1 <- st_as_sfc("POLYGON((0 0, 0 10, 10 0, 10 10, 0 0))") st_is_valid(p1) st_prepair(p1) st_is_valid(st_prepair(p1)) }