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)
in_obj |
|
---|
character
proj4string of the object or file
DETAILS
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"#> [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"#> [1] "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"