Test whether a SpatRaster or SpatVector has a longitude/latitude coordinate reference system (CRS), or perhaps has one. That is, when the CRS is unknown ("") but the x coordinates are within -181 and 181 and the y coordinates are within -90.1 and 90.1. For a SpatRaster you can also test if it has a longitude/latitude CRS and it is "global" (covers all longitudes).
A warning is given if the CRS is missing or if it is specified as longitude/latitude but the coordinates do not match that.
Usage
# S4 method for SpatRaster
is.lonlat(x, perhaps=FALSE, warn=TRUE, global=FALSE)
# S4 method for SpatVector
is.lonlat(x, perhaps=FALSE, warn=TRUE)
# S4 method for character
is.lonlat(x, perhaps=FALSE, warn=TRUE)
Value
logical or NA
Arguments
x
SpatRaster or SpatVector
perhaps
logical. If TRUE and the CRS is unknown, the method returns TRUE if the coordinates are plausible for longitude/latitude
warn
logical. If TRUE, a warning is given if the CRS is unknown but assumed to be lon/lat and perhaps=TRUE
global
logical. If TRUE, the method tests if the raster covers all longitudes (from -180 to 180 degrees) such that the extreme columns are in fact adjacent