Learn R Programming

terra (version 0.5-2)

isLonLat: Check for longitude/latitude crs

Description

Test whether a SpatRaster or SpatVector has a longitude/latitude coordinate reference system (CRS). couldBeLonLat returns TRUE if the CRS is unknown ("") but the x coordinates are within -181 and 181 and the y coordinates are within -90.1 and 90.1.

Usage

# S4 method for SpatRaster
isLonLat(x, ...)
# S4 method for SpatVector
isLonLat(x, ...)
# S4 method for SpatRaster
isGlobalLonLat(x, ...)
# S4 method for SpatRaster
couldBeLonLat(x, warn=TRUE, ...)
# S4 method for SpatVector
couldBeLonLat(x, warn=TRUE, ...)

Arguments

x

SpatRaster or SpatVector object

warn

logical. If TRUE, a warning is given if the CRS is unknown or when the CRS is longitude/latitude but the coordinates do not match that

...

additional arguments. None implemented

Value

Logical

Examples

Run this code
# NOT RUN {
r <- rast()
isLonLat(r)
crs(r) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84"
isLonLat(r)
# }

Run the code above in your browser using DataLab