Opens the raster at path and returns a named list with dimensions,
geotransform, coordinate reference system, and per-band scale/offset
values.
Value
Named list with the following elements:
pathCharacter: the path as supplied.
nrowsInteger: number of rows (Y pixels).
ncolsInteger: number of columns (X pixels).
nbandsInteger: number of raster bands.
geotransformNumeric vector of length 6 (GDAL convention):
[x_origin, pixel_width, rotation_x, y_origin, rotation_y, pixel_height].crsCharacter: WKT coordinate reference system string, or an empty string if not defined.
scaleNumeric vector (one per band): GDAL scale factor (
1.0if not set).offsetNumeric vector (one per band): GDAL offset (
0.0if not set).
Details
Data values are always returned as double (float64) in
memory. If the raster bands carry GDAL scale/offset metadata (e.g. packed
integers), those are reported here and applied automatically by
GdalReader::read_window().
Stops with an informative error if the package was built without GDAL support.
Examples
# \donttest{
if (has_gdal()) {
info <- gdal_info(
system.file("extdata", "tiny.tif", package = "xbioclim")
)
str(info)
}
#> Warning: GDAL Error 4: /tmp/RtmpRzND6Y/file31e66a80e7f7.tif: No such file or directory
#> List of 8
#> $ path : chr "/home/runner/work/_temp/Library/xbioclim/extdata/tiny.tif"
#> $ nrows : int 3
#> $ ncols : int 3
#> $ nbands : int 1
#> $ geotransform: num [1:6] 0 1 0 0 0 1
#> $ crs : chr ""
#> $ scale : num 1
#> $ offset : num 0
# }