Replace the geometry of a polygon with its centroid point
Source:R/Spat_Polygon_Centroid.R
Polygon_Centroid.Rd
This function replaces the geometry of a simple feature (sf
) polygon object
with the geometry of its centroid point. It can optionally rename the
geometry column of the modified sf
object.
Arguments
- x
A simple feature (
sf
) object; the polygon whose geometry is to be replaced with its centroid. Cannot beNULL
.- Rename
A logical value indicating whether to rename the geometry column of the sf object. Defaults to
FALSE
.- NewName
A string specifying the new name for the geometry column if Rename is
TRUE
. If Rename isFALSE
, this parameter is ignored.
Value
The modified sf object with its geometry replaced by the centroid of
the original polygon geometry. If Rename is TRUE
, the geometry column
will also be renamed as specified by NewName.