Main Content

georasterinfo

Information about geospatial raster data file

Description

example

info = georasterinfo(filename) returns a RasterInfo object for the geographic or projected raster data file specified by filename. Supported file formats include Esri Binary Grid, Esri GridFloat, GeoTIFF, and DTED. For a full list of supported formats, see Supported Formats and Extensions.

Examples

collapse all

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

info = georasterinfo('boston.tif')
info = 
  RasterInfo with properties:

                     Filename: "C:\Users\jbenham\OneDrive - MathWorks\Documents\MATLAB\ExampleManager\jbenham.Bdoc21a\map-ex85759085\boston.tif"
             FileModifiedDate: 13-May-2011 22:28:45
                     FileSize: 38729900
                   FileFormat: "GeoTIFF"
                   RasterSize: [2881 4481]
                     NumBands: 3
                 NativeFormat: "uint8"
         MissingDataIndicator: []
                   Categories: []
                    ColorType: "truecolor"
                     Colormap: []
              RasterReference: [1×1 map.rasterref.MapCellsReference]
    CoordinateReferenceSystem: [1×1 projcrs]
                     Metadata: [1×1 struct]

Access individual properties of the RasterInfo object using dot notation.

info.NativeFormat
ans = 
"uint8"

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.

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 and Extensions.

Data Types: char | string

More About

collapse all

Supported Formats and Extensions

The readgeoraster and georasterinfo functions support these file formats and extensions. In some cases, you can read supported file formats using extensions other than the ones listed.

File FormatExtension

GeoTIFF

.tif or .tiff

Esri Binary Grid

.adf

Esri ASCII Grid

.asc or .grd

Esri GridFloat

.flt

DTED

.dt0, .dt1, or .dt2

SDTS

.DDF

USGS DEM

.dem

ER Mapper ERS

.ers

ENVI

.dat

ERDAS IMAGINE

.img

Vertical Mapper Numeric Grid

.grd

Vertical Mapper Classified Grid

.grc

SRTM Height

.hgt

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.

Introduced in R2020a