R/sp_centroid.R

Defines functions sp_centroid

Documented in sp_centroid

#' Function to find the centroid of a spatial object. 
#'
#' @author Stuart K. Grange
#' 
#' @param sp Spatial object. 
#' 
#' @param features Should the centroids of all features within \code{sp} be
#' calculated? Default is \code{TRUE}. 
#'
#' @export
sp_centroid <- function(sp, features = TRUE) {
  # Suppress retirement message
  suppressMessages(
    rgeos::gCentroid(sp, byid = features)
  )
}
skgrange/gissr documentation built on Feb. 24, 2024, 2:55 p.m.