Skip to contents

For each polygon in an sf object, computes the line segment joining the midpoints of the longer pair of opposite edges (the “half‐plot line”).

Usage

line_on_halfplot(shapefile)

Arguments

shapefile

An sf object of polygons. Each geometry must be closed (first and last coordinate coincide) so that st_coordinates(...) yields a repeating start point.

Value

A SpatVector (from the terra package) of line geometries representing the half‐plot midlines.

Examples


if(interactive()){
library(pliman)
shp <- shapefile_input( paste0(image_pliman(), "/soy_shape.rds"))
mosaic <- mosaic_input( paste0(image_pliman(), "/soy_dsm.tif"))
mosaic_plot(mosaic)
half <- line_on_halfplot(shp)
shapefile_plot(half, add = TRUE, col = "blue")

}