helper function used to check that the input projection (passed as UTM zone, EPSG code, PROJ4 string or CRS object) is a valid string or CRS.
check_proj4string(projection, abort = FALSE, verbose = TRUE) # S3 method for default check_proj4string(projection, abort = FALSE, verbose = TRUE) # S3 method for numeric check_proj4string(projection, abort = FALSE, verbose = TRUE) # S3 method for character check_proj4string(projection, abort = FALSE, verbose = TRUE) # S3 method for CRS check_proj4string(projection, abort = FALSE, verbose = TRUE)
projection |
|
---|---|
abort |
|
character
proj4string of the object or file
DETAILS
check_proj4string("+init=epsg:32632")#> [1] "+init=epsg:32632 +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"check_proj4string("32631")#> [1] "+init=epsg:32631 +proj=utm +zone=31 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"check_proj4string(32633)#> [1] "+init=epsg:32633 +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"check_proj4string(30)#> [1] "+init=epsg:32630 +proj=utm +zone=30 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"check_proj4string("example of invalid string")#> Warning: check_proj4string --> Invalid projection detected, #> returning `NA`!#> [1] NA#> [1] "+init=epsg:32632 +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"library(raster) in_rast <- read_rast(system.file("extdata/OLI_test", "oli_multi_1000_b2.tif", package = "sprawl.data")) check_proj4string(in_rast@crs)#> [1] "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"