R/intersectionWarningHandler.R

Defines functions intersectionWarningHandler

Documented in intersectionWarningHandler

#' Warning handler for sf::st_intersection
#'
#' @param warningMessage the warning message produced by \code{sf::st_intersection}
#'
#' @return nothing is returned.
#' @export
#'
#' @examples
#'#   dat <- data.frame(dat = c("5", "10", "-", "helloWorld"))
#'#   withCallingHandlers(
#'#     as.numeric(as.character(dat$dat)), warning = intersectionWarningHandler)

intersectionWarningHandler <- function(warningMessage) {
  if( any( grepl( "attribute variables are assumed to be spatially constant throughout all geometries", warningMessage) ) ) invokeRestart( "muffleWarning" )
}
troyhill/fireHydro documentation built on Feb. 2, 2023, 12:09 p.m.