R/utils.R

Defines functions test_point

test_point <- function(x, id){
  
  if (!inherits(x = x, what = "sf")) {
    stop(paste0(id, " is not an sf object."), 
         call. = FALSE)
  }
  
  type <- sf::st_geometry_type(x, by_geometry = FALSE)
  if (type != "POINT") {
    stop(paste0('"', id, '" geometry should be of type POINT.'), 
         call. = FALSE)    
  }
}
riatelab/potential documentation built on Jan. 2, 2023, 7:15 a.m.