Main Content

geomulticube

Read multispectral image with geospatial information

Since R2025a

    Description

    mcube = geomulticube(file) reads multispectral image data with geospatial information from the specified file file and stores the geospatial information in the Metadata property of the multicube object.

    example

    mcube = geomulticube(file,wavelength) specifies the wavelength for each spectral band in the input data, and sets the Wavelength property of the output multicube object.

    mcube = geomulticube(image,wavelength) creates a multicube object from the multispectral data cube image and the specified center wavelength values wavelength.

    mcube = geomulticube(image,wavelength,metadata) creates a multicube object from the multispectral data cube image, specified center wavelength values wavelength, and metadata metadata. You can use this syntax to modify the Metadata property of a multicube object.

    mcube = geomulticube(image) creates a multicube object from the multispectral data cube image without wavelengths. The Wavelength property of the returned multicube object mcube is empty.

    mcube = geomulticube(___,BlockSize=blockSize) specifies the block size to use when loading the multispectral data cube, in addition to any combination of input arguments from previous syntaxes.

    Note

    This function requires a Mapping Toolbox™ license.

    Note

    This function requires the Hyperspectral Imaging Library for Image Processing Toolbox™. You can install the Hyperspectral Imaging Library for Image Processing Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

    The Hyperspectral Imaging Library for Image Processing Toolbox requires desktop MATLAB®, as MATLAB Online™ and MATLAB Mobile™ do not support the library.

    Examples

    collapse all

    Download Landsat 8 multispectral data.

    zipfile = "LC08_L1TP_113082_20211206_20211215_02_T1.zip";
    landsat8Data_url = "https://ssd.mathworks.com/supportfiles/image/data/" + zipfile;
    hyper.internal.downloadLandsatDataset(landsat8Data_url,zipfile)
    filepath = fullfile("LC08_L1TP_113082_20211206_20211215_02_T1","LC08_L1TP_113082_20211206_20211215_02_T1_MTL.txt");

    Read the multispectral data with geospatial data into the workspace.

    mcube = geomulticube(filepath);

    Extract the geospatial information in the metadata of the multicube object. For more information about geospatial information, see the Reference Objects section of Georeferenced Raster Data (Mapping Toolbox).

    R = mcube.Metadata.RasterReference
    R = 
      11×1 MapPostingsReference array with properties:
    
        RasterInterpretation
        XIntrinsicLimits
        YIntrinsicLimits
        SampleSpacingInWorldX
        SampleSpacingInWorldY
        XWorldLimits
        YWorldLimits
        RasterSize
        ColumnsStartFrom
        RowsStartFrom
        RasterExtentInWorldX
        RasterExtentInWorldY
        TransformationType
        CoordinateSystemType
        ProjectedCRS
    
    

    Estimate and visualize the RGB image of the multispectral data.

    rgbImg = colorize(mcube);
    figure
    imshow(rgbImg)

    Create a polygonal region of interest in geographic coordinates.

    xlimits = R.XWorldLimits;
    ylimits = R.YWorldLimits;
    dataRegion = mappolyshape(xlimits([1 1 2 2 1]),ylimits([1 2 2 1 1]));
    dataRegion.ProjectedCRS = R.ProjectedCRS;

    Plot the polygonal region of interest using satellite imagery.

    figure
    geoplot(dataRegion, ...
      LineWidth=2, ...
      EdgeColor="yellow", ...
      FaceColor="red", ...
      FaceAlpha=0.2)
    hold on
    geobasemap satellite

    Input Arguments

    collapse all

    Input filename, specified as a character vector or string scalar. The input filename can refer to an image file or header file, and must be one of these file formats. The geomulticube function does not support ASTER data.

    File FormatExtensionsAdditional Requirements
    GeoTIFF metadata files from EO satellites.txtFilename must end with the suffix "MTL". For example, geotiffEO1_MTL.txt.

    Multipage TIFF files

    .tif

    File must be a multipage TIFF file containing a volume or time series image stack.

    Sentinel-2 data

    .safe

    File must be a Sentinel-2 L1C file or Sentinel-2 L2A file with the name manifest.safe.

    Data Types: char | string

    Center wavelength values of the spectral bands, specified as a C-element numeric vector. C is the spectral dimension, defined as the number of spectral bands of the input multispectral data.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Multispectral image data cube, specified as an M-by-N-by-C numeric array. M and N are the number of rows and columns in the multispectral data, respectively. C is the number of spectral bands in the multispectral data.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Metadata of the multispectral data, specified as a structure array. This argument sets the Metadata property of the multicube object. To include geospatial information in the multicube object, the metadata structure must contain the geospatial information in the field RasterReference.

    Data Types: struct

    Size of the data blocks, specified as a 2-element vector of positive integers. The first and second elements of the vector correspond to the number of rows and columns in each block, respectively. This argument sets the BlockSize property of the multicube object.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    Multispectral data with geospatial information, returned as a multicube object.

    Version History

    Introduced in R2025a