helper function used to extract the proj4string of "R" spatial objects or of raster or vector files

get_proj4string(in_obj)

# S3 method for default
get_proj4string(in_obj)

# S3 method for character
get_proj4string(in_obj)

# S3 method for Raster
get_proj4string(in_obj)

# S3 method for sf
get_proj4string(in_obj)

# S3 method for sfc
get_proj4string(in_obj)

# S3 method for Spatial
get_proj4string(in_obj)

# S3 method for Spatial
get_proj4string(in_obj)

Arguments

in_obj

character corresponding to the name of a R object, or a filename (full path)

Value

character proj4string of the object or file

Details

DETAILS

Examples

library(raster) in_rast <- system.file("extdata/MODIS_test", "EVIts_test.tif", package = "sprawl.data") get_proj4string(in_rast)
#> [1] "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"
in_rast <- raster::raster(in_rast) get_proj4string(in_rast)
#> [1] "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"
in_vect <- system.file("extdata/shapes","lc_polys.shp", package = "sprawl.data") get_proj4string(in_vect)
#> [1] "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
in_vect <- read_vect(in_vect) get_proj4string(in_vect)
#> [1] "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"