Skip to contents

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.

Usage

Polygon_Centroid(x = NULL, Rename = FALSE, NewName = NULL)

Arguments

x

A simple feature (sf) object; the polygon whose geometry is to be replaced with its centroid. Cannot be NULL.

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 is FALSE, 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.

References

Click here

Author

Ahmed El-Gabbas