R/use_crs.R

Defines functions use_crs

Documented in use_crs

#' In-use coordinate system
#'
#' Set or return the coordinate system currently in use.
#'
#' If argument `crs` is NULL, the function returns the current value (which may be `NULL``).
#' @param crs provide PROJ string to set the value
#' @export
#' @examples
#' \dontrun{
#' use_crs()
#' use_crs("+proj=laea +datum=WGS84")
#' use_crs()
#' }
use_crs <- function(crs = NULL) {
  if (!is.null(crs)) {
    options(crs.in.use = crs)
    return(crs)
  }
  crs <- getOption("crs.in.use")
  if (is.null(crs)) warning("No crs.in.use")
  crs
}

Try the quadmesh package in your browser

Any scripts or data that you put into this service are public.

quadmesh documentation built on Aug. 31, 2022, 9:10 a.m.