accessory function to check if an object passed to the function
corresponds to a *Spatial
Object, a sf
object, a R raster
object, a
file corresponding to a vector, or a file corresponding to a raster.
NOTE: to check only for vector or raster types, the associated functions
get_vectype
and get_rastype
can be used, with the same syntax.
get_spatype(in_object, abort = TRUE)
in_object | either a |
---|---|
abort |
|
character ("spobject" | "sfobject" | "rastobject | "
vectfile" | rastfile " | sprawlext), or NA
if the input does not
belong to any spatial category and abort == FALSE
library(sprawl.data) # input is a raster file in_rast <- system.file("extdata/MODIS_test", "EVIts_test.tif", package = "sprawl.data") get_spatype(in_rast)#> [1] "rastfile"#> [1] "rastfile"# input is a shapefile in_vect <- system.file("extdata/shapes","lc_polys.shp", package = "sprawl.data") get_spatype(in_vect)#> [1] "vectfile"#> [1] "spobject"#> [1] "sfobject"#> [1] "sprawlext"