View source: R/spatial_manipulation.R
repair_geometry | R Documentation |
Using functions from sf, check the geometry of a set of polygons. If the geometry invalid, it attempts to buffer the polygons with sf::st_buffer(dist = 0)
. If the geometry is corrupt or fine, it does nothing.
repair_geometry(
polygons,
verbose = FALSE,
force = FALSE,
use_spherical_geometry = TRUE
)
polygons |
Spatial polygons (either sf or spatial polygons data frame). The polygons to be checked. Note that the function will halt if the geometry is corrupt and not return a value. |
verbose |
Logical. If |
force |
Logical. If |
use_spherical_geometry |
Logical. USE AT YOUR OWN RISK. Controls if sf uses spherical geometry or not. For particularly wonky sf objects, this may be necessary to effect any kind of repair but can have unintended consequences for the resulting geometry. If |
The spatial polygons data frame polygons1
. This will be unchanged if the geometry was valid or repaired if it was invalid.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.