Main Content


Information about geospatial raster data file

Since R2020a



info = georasterinfo(filename) creates a RasterInfo object for a geographic or projected raster data file with a format such as GeoTIFF, Esri Binary Grid, GRIB, or DTED. For a full list of supported formats, see Supported Formats.


collapse all

Get information about a geospatial raster data file by creating a RasterInfo object.

info = georasterinfo('boston.tif');

Access individual properties of the RasterInfo object using dot notation.

ans = 

Get information about a DTED file by creating a RasterInfo object. Get metadata specific to DTED files by accessing the Metadata property of the RasterInfo object.

info = georasterinfo('n39_w106_3arc_v2.dt1');
md = info.Metadata
md = struct with fields:
                  AREA_OR_POINT: "Point"
           DTED_CompilationDate: "0002"
               DTED_DataEdition: "02"
          DTED_DigitizingSystem: "SRTM      "
        DTED_HorizontalAccuracy: "0013"
           DTED_HorizontalDatum: "WGS84"
           DTED_MaintenanceDate: "0000"
    DTED_MaintenanceDescription: "0000"
            DTED_MatchMergeDate: "0000"
         DTED_MatchMergeVersion: "A"
            DTED_NimaDesignator: "DTED1"
            DTED_OriginLatitude: "0390000N"
           DTED_OriginLongitude: "1060000W"
      DTED_PartialCellIndicator: "00"
                  DTED_Producer: "USCNIMA "
     DTED_RelHorizontalAccuracy: "NA  "
       DTED_RelVerticalAccuracy: "0006"
          DTED_SecurityCode_DSI: "U"
          DTED_SecurityCode_UHL: "U  "
             DTED_UniqueRef_DSI: "G19 107        "
             DTED_UniqueRef_UHL: "G19 107     "
      DTED_VerticalAccuracy_ACC: "0006"
      DTED_VerticalAccuracy_UHL: "0006"
             DTED_VerticalDatum: "E96"

Find the coordinates of the lower-left corner of the data by accessing the DTED_OriginLatitude and DTED_OriginLongitude fields of the metadata structure. The coordinates are stored as strings. Convert the strings to angles.

latS = md.DTED_OriginLatitude;
lonS = md.DTED_OriginLongitude;
latA = str2angle(latS) 
latA = 39
lonA = str2angle(lonS)
lonA = -106

The DTED file used in this example is courtesy of the US Geological Survey.

Since R2023b

Get information about a GRIB file [1][2] by creating a RasterInfo object. Get the metadata for the GRIB file by accessing the Metadata property of the RasterInfo object.

info = georasterinfo("seaice.grib");
md = info.Metadata
md=7×8 table
                Description                          Comment             Unit     Element    ShortName       ReferenceTime             ValidTime          ForecastSeconds
    ____________________________________    _________________________    _____    _______    _________    ____________________    ____________________    _______________

    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2010 12:00:00    01-Sep-2010 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2012 12:00:00    01-Sep-2012 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2014 12:00:00    01-Sep-2014 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2016 12:00:00    01-Sep-2016 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2018 12:00:00    01-Sep-2018 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2020 12:00:00    01-Sep-2020 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2022 12:00:00    01-Sep-2022 12:00:00         0 sec     

RasterInfo objects store GRIB metadata using a table, where each row of the table corresponds to a band of data in the file. View the comment, reference time, and forecast duration for the third data band.

md3 = md(3,:);
ans = 
"Sea ice cover (0-1) [-]"
ans = datetime
   01-Sep-2014 12:00:00

ans = duration
   0 sec

[1] Hersbach, H., B. Bell, P. Berrisford, G. Biavati, A. Horányi, J. Muñoz Sabater, J. Nicolas, et al. "ERA5 Hourly Data on Single Levels from 1940 to Present." Copernicus Climate Change Service (C3S) Climate Data Store (CDS), 2023. Accessed May 22, 2023.

[2] Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.

Input Arguments

collapse all

Name of the raster data file, specified as a character vector or string scalar. The form of filename depends on the location of your file.

  • If the file is in your current folder or in a folder on the MATLAB® path, then specify the name of the file, such as 'myFile.dem'.

  • If the file is not in the current folder or in a folder on the MATLAB path, then specify the full or relative path name, such as 'C:\myfolder\myFile.tif' or 'dataDir\myFile.dat'.

For a list of supported file formats, see Supported Formats.

Data Types: char | string

More About

collapse all

Supported Formats

The readgeoraster and georasterinfo functions support these file formats.

  • GeoTIFF (.tif or .tiff)

  • Esri Binary Grid (.adf)

  • Esri ASCII Grid (.asc or .grd)

  • Esri GridFloat (.flt)

  • GRIB (.grb, .grib, .grib2) (since R2023b)

  • DTED (.dt0, .dt1, or .dt2)

  • SDTS (.DDF)

  • USGS DEM (.dem)

  • SRTM Height (.hgt)

  • Vertical Mapper Numeric Grid (.grd)

  • Vertical Mapper Classified Grid (.grc)

  • ER Mapper ERS (.ers)

  • ENVI (.dat)

  • ERDAS IMAGINE (.img)

  • Geospatially referenced JPEG 2000 (.jp2) (since R2023b)

The extension of a file does not always indicate its file format. If you do not know the format of your file, ask your data provider. In some cases, you can read files in supported formats when they have no extensions or have extensions other than the ones listed.

Some file formats consist of a data file and multiple supporting files. For example, Esri GridFloat files may have supporting header files (.hdr). When you read a data file with supporting files using readgeoraster or georasterinfo, specify the extension of the data file.

File formats may be referred to using different names. For example, the Esri GridFloat format may also be referred to as Esri .hdr Labelled or ITT ESRI .hdr RAW Raster. The Esri Binary Grid format may also be referred to as ArcGrid Binary, Esri ArcGIS Binary Grid, or Esri ArcInfo Grid.

Version History

Introduced in R2020a

expand all