sf layers with expected geometry typeThis internal helper verifies that all provided objects:
are of class sf (optional, controlled by check_class);
contain valid geometries (sf::st_is_valid());
contain no empty geometries (!sf::st_is_empty());
have a geometry type among the allowed ones (if specified).
geo_object_check(
...,
check_class = TRUE,
check_valid = TRUE,
check_empty = TRUE,
allowed_geom_classes = "POLYGON"
)Invisibly returns NULL. Throws an error if any object fails validation.
One or several spatial objects to test.
Logical. Whether to check that each object inherits from
class sf. Default is TRUE.
Logical. Whether to check that geometries are valid.
Default is TRUE.
Logical. Whether to check that geometries are not empty.
Default is TRUE.
Character vector of allowed geometry types
(e.g., "POLYGON", "LINE", "POINT"). If NULL, the geometry type
is not checked. Default is "POLYGON".
The function raises an informative error message if any condition fails.
It is intended for internal validation of sf inputs before performing
geometric operations or API queries.
Geometry type validation is performed via geo_object_type(), which ensures
type consistency across geometries.
geo_object_type()