repair_geometry: Identify and repair invalid geometry in spatial polygons data...

View source: R/spatial_manipulation.R

repair_geometryR Documentation

Identify and repair invalid geometry in spatial polygons data frames

Description

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.

Usage

repair_geometry(polygons, verbose = FALSE, force = FALSE)

Arguments

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 TRUE then the function will produce informative messages as it executes its steps. Useful for debugging. Defaults to FALSE.

force

Logical. If TRUE then both valid and invalid polygons will be buffered by 0. This shouldn't be necessary, but is a feature for the paranoid.

Value

The spatial polygons data frame polygons1. This will be unchanged if the geometry was valid or repaired if it was invalid.


nstauffer/aim.analysis documentation built on Nov. 2, 2023, 12:52 a.m.