vapour (version 0.5.5)

vapour_raster_info: Raster information

Description

Return the basic structural metadata of a raster source understood by GDAL. Subdatasets may be specified by number, starting at 1. See vapour_sds_names for more.

Usage

vapour_raster_info(x, ..., sds = NULL, min_max = FALSE)

Arguments

x

data source string (i.e. file name or URL or database connection string)

...

currently unused

sds

a subdataset number, if necessary

min_max

logical, control computing min and max values in source ('FALSE' by default)

Subdatasets

Some sources provide multiple data sets, where a dataset is described by a 2- (or more) dimensional grid whose structure is described by the metadata described above. Note that subdataset is a different concept to band or dimension. Sources that may have multiple data sets are HDF4/HDF5 and NetCDF, and they are loosely analogous to the concept of layer in GDAL vector data. Variables are usually seen as distinct data but in GDAL and related 2D-interpretations this concept is leveraged as a 3rd dimension (and higher). In a GeoTIFF a third dimension might be implicit across bands, i.e. to express time varying data and so each band is not properly a variable. Similarly in NetCDF, the data may be any dimensional but there's only an implicit link for other variables that exist in that same dimensional space. When using GDAL you are always traversing this confusing realm.

If subdatasets are present but not specified the first is queried. The choice of subdataset is analogous to the way that the raster package behaves, and uses the argument varname. Variables in NetCDF correspond to subdatasets, but a single data set might have multiple variables in different bands or in dimensions, so this guide does not hold across various systems.

The Geo Transform

From https://gdal.org/user/raster_data_model.html.

The affine transform consists of six coefficients returned by GDALDataset::GetGeoTransform() which map pixel/line coordinates into georeferenced space using the following relationship:

Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)

Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)

They are

GT0, xmin

the x position of the lower left corner of the lower left pixel

GT1, xres

the scale of the x-axis, the width of the pixel in x-units

GT2, yskew

y component of the pixel width

GT3, ymax

the y position of the upper left corner of the upper left pixel

GT4, xskew

x component of the pixel height

GT5, yres

the scale of the y-axis, the height of the pixel in negative y-units

Please note that these coefficients are equivalent to the contents of a world file but that the order is not the same and the world file uses cell centre convention rather than edge. https://en.wikipedia.org/wiki/World_file

Usually the skew components are zero, and so only four coefficients are relevant and correspond to the offset and scale used to position the raster - in combination with the number of rows and columns of data they provide the spatial extent and the pixel size in each direction. Very rarely a an actual affine raster will be use with this rotation specified within the transform coefficients.

Calculation of 'minmax' can take a significant amount of time, so it's not done by default. Use 'minmax = TRUE' to do it. (It does perform well, but may be prohibitive for very large or remote sources.)

Overviews

If there are no overviews this element will simply be a single-element vector of value 0. If there are overviews, the first value will give the number of overviews and their dimensions will be listed as pairs of x,y values.

Details

The structural metadata are

geotransform

the affine transform

dimXY

dimensions x-y, columns*rows

minmax

numeric values of the computed min and max from the first band (optional)

tilesXY

dimensions x-y of internal tiling scheme

projection

text version of map projection parameter string

bands

number of bands in the dataset

proj4

not implemented

nodata_value

not implemented

overviews

the number and size of any available overviews

On access vapour functions will report on the existence of subdatasets while defaulting to the first subdataset found.

See Also

vapour_sds_info

Examples

Run this code
# NOT RUN {
f <- system.file("extdata", "sst.tif", package = "vapour")
vapour_raster_info(f)
# }

Run the code above in your browser using DataLab