Skip to contents

It tries repairing input vector data. Vector validity violation usually appears in polygon data with self-crossing or hole orders. This function will pass the input_vector object to sf::st_make_valid (if input_vector is sf) or terra::makeValid (if input_vector is SpatVector). May take some time depending on the geometry complexity.

Usage

vect_valid_repair(input_vector)

Arguments

input_vector

One of sf or vect class. Target points of computation.

Value

A repaired sf or SpatVector object depending on the class of input_vector.

Note

This function works with GEOS (>=3.8).

Author

Insang Song

Examples

if (FALSE) {
library(terra)
library(sf)
ncpath <- system.file("gpkg/nc.gpkg", package = "sf")
nc <- terra::vect(ncpath)

nc_valid <- vect_valid_repair(nc)
}