Learn R Programming

pliman (version 3.1.0)

line_on_halfplot: Extract mid‐lines from half‐plots

Description

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)

Value

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

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.

Examples

Run this code

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")

}

Run the code above in your browser using DataLab