Skip to contents

g_is_valid() tests whether a geometry is valid.

Usage

g_is_valid(geom, quiet = FALSE)

Arguments

geom

Either a raw vector of WKB or list of raw vectors, or a character vector containing one or more WKT strings.

quiet

Logical, TRUE to suppress warnings. Defaults to FALSE.

Value

logical vector of the same length as the number of input geometries in geom, containing TRUE for the corresponding geometies that are valid or FALSE for invalid geometries.

Examples

g1 <- "POLYGON ((0 0, 10 10, 10 0, 0 0))"
g2 <- "POLYGON ((0 0, 10 10, 10 0))"
g3 <- "POLYGON ((0 0, 10 10, 10 0, 0 1))"
g_is_valid(c(g1, g2, g3))
#> [1]  TRUE FALSE FALSE