check_polygon: Check and validate a polygon defined by vertices

View source: R/check_polygon.R

check_polygonR Documentation

Check and validate a polygon defined by vertices

Description

This function converts a data.frame of polygon vertices into an sf POLYGON and checks its validity. If the polygon is invalid, it attempts to fix it.

Usage

check_polygon(core_polygon_df, trees_inv, sensors = NULL, verbose = TRUE)

Arguments

core_polygon_df

A data.frame with columns x and y defining polygon vertices

trees_inv

A data.frame with one row per tree. See check_inventory for the required structure and validated columns.

sensors

Optional data.frame defining position and height of the sensor within the stand. See check_sensors for the required structure and validated columns.

verbose

Logical. If TRUE, warnings are printed

Value

A data.frame of polygon vertices (x, y):

  • unchanged if valid

  • modified if fixed (with a warning)

Examples

data_prenovel <- SamsaRaLight::data_prenovel

# Validate polygon
check_polygon(data_prenovel$core_polygon, data_prenovel$trees)


SamsaRaLight documentation built on April 16, 2026, 5:08 p.m.