is.lonlat | R Documentation |
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.
## S4 method for signature 'SpatRaster'
is.lonlat(x, perhaps=FALSE, warn=TRUE, global=FALSE)
## S4 method for signature 'SpatVector'
is.lonlat(x, perhaps=FALSE, warn=TRUE)
## S4 method for signature 'character'
is.lonlat(x, perhaps=FALSE, warn=TRUE)
x |
SpatRaster or SpatVector |
perhaps |
logical. If |
warn |
logical. If |
global |
logical. If |
logical or NA
r <- rast()
is.lonlat(r)
is.lonlat(r, global=TRUE)
crs(r) <- ""
is.lonlat(r)
is.lonlat(r, perhaps=TRUE, warn=FALSE)
crs(r) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84"
is.lonlat(r)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.