: [rstat, rinfo, bands] = gdalread (fname)
: [rstat, rinfo, bands] = gdalread (fname, info)

Get raster data and info or (optionally) just info from a GIS raster file. For normal raster data reading it is better to use rasterread.m as that takes care of postprocessing gdalread output.

fname is the name (or full path name) of a raster file to be read.

info is any non-null value. If present, only raster info is returned. This option can be useful if only raster information is required and reading the raster data can be skipped.

rstat is set to zero if reading was successful, -1 otherwise.

rinfo is a scalar struct containing information about the raster data: datatype_index (a numerical GDAL datatype index); datatype_name (GDAL type name); BitDepth; geotransformation (1x6 double vector); projection (a string containing projection information); Width (nr. of raster data columns); Height (nr. of raster data rows); FileType; and nbands (the number of raster bands in the file).

bands is a struct array containing raster data for each band in the file. If only raster info was requested, bands is empty. When data is read, each band is a struct element containing: bbox (bounding box: [xmin ymin; xmax ymax]), data (a matrix with the actual raster data); min (minimum raster data value); max (maximum raster data value); has_ndv (indicates whether the band as a special value indicating pixels that shouldn’t be processed); ndv_val (the special value for improper pixels), and colortable. If the band has a colortable, field “colortable” contains an Mx4 array of colortable entries (see GDAL reference), otherwise this field is empty. Note that the actual raster data array (field “data” is rotated 90 degrees clockwise.

See also: rasterread,rot90.

Package: mapping