shapefile_measures {pliman} | R Documentation |
shapefile_measures()
calculates key geometric measures such as the number
of points, area, perimeter, width, height, and centroid coordinates for a
given shapefile (polygon) object.
shapefile_measures(shapefile)
shapefile |
An |
This function processes a single or multi-polygon sf
object and computes
geometric properties. It calculates distances between points, extracts the
centroid coordinates, and computes the area and perimeter of the polygons.
The width and height are derived from sequential distances between points.
A modified sf
object with added columns for:
xcoord
: The x-coordinate of the centroid.
ycoord
: The y-coordinate of the centroid.
area
: The area of the polygon (in square units).
perimeter
: The perimeter of the polygon (in linear units).
width
: The calculated width based on sequential distances between points.
height
: The calculated height based on sequential distances between points.
if (interactive() && requireNamespace("EBImage")) {
library(pliman)
path_shp <- paste0(image_pliman(), "/soy_shape.rds")
shp <- shapefile_input(path_shp)
shapefile_measures(shp)
}