ENVINITFMetadata

This function returns an IDL dictionary of NITF metadata from a specified NITF raster. The top-level dictionary is a collection of IDL lists and dictionaries that contain the various segments of metadata: header, image, text, and data extension segments (DESes).

The collection of NITF metadata is a superset of the NITF metadata that is displayed in the NITF Metadata Viewer (accessed from the Data Manager or Layer Manager).

See ENVINITF and its methods. These are the preferred methods for accessing NITF metadata.

Example

This example prints the number of bands in each image segment of a NITF raster. Copy and paste the example into a new window in the IDL Editor. Save the file as NitfMetadataExample.pro, then compile and run the program.

PRO NitfMetadataExample

COMPILE_OPT IDL2

 

; Start the application

e = ENVI(/HEADLESS)

 

; Select a NITF raster

file = FILEPATH('MultiSegmentExample.ntf', $

  ROOT_DIR=e.ROOT_DIR, SUBDIR=['data','NITFExamples'])

raster = e.OpenRaster(file)

 

; Get the metadata

metadata = ENVINITFMetadata(raster)

numImages = N_ELEMENTS(metadata.Image)

 

FOR i=0, numImages-1 DO BEGIN

  Print, metadata.Image[i].NBANDS

ENDFOR

END

IDL prints:

1

1

1

1

This file has four image segments, each with one band.

Syntax

Result = ENVINITFMetadata(InputRaster, KEYWORDS=value)

Return Value

This function returns an IDL dictionary of NITF metadata:

Arguments

InputRaster

Specify an ENVIRaster in NITF format. You can only open one NITF file at a time using the ENVI::OpenRaster method. If the NITF file has multiple image segments, then the ENVI::OpenRaster method returns an array of ENVIRasters, which you can pass into ENVIRasterMetadata. You can also specify a subset of this array, as the following example shows:

file = FILEPATH('MultiSegmentExample.ntf', $

  ROOT_DIR=e.ROOT_DIR, SUBDIR=['data','NITFExamples'])

raster = e.OpenRaster(file)

metadata = ENVINITFMetadata([raster[0], raster[2], raster[3]])

If the NITF file only has one image segment, then ENVI::OpenRaster returns a single ENVIRaster, which you can pass into ENVIRasterMetadata.

Keywords

ALL

Set this keyword to return the metadata from all available NITF segments: header, image, text, and DES.

ERROR

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

HEADER

Set this keyword to only return header segment metadata.

NO_DATA

Set this keyword to return metadata without any DATA_* values. This reduces the size of the returned metadata collection. The DATA_* values are optional, so use the IDL HASH HasKey method to determine if any DATA_* keys are present, for example:

IF (metadata.HasKey('DATA_LUT') THEN BEGIN

  Print, metadata.Image[0].Band[1].DATA_LUT

ENDIF

Version History

ENVI 5.3.1

Introduced

API Version

4.2

See Also

ENVINITF, ENVINITFCSMRasterSpatialRef, Open NITF and MIE4NITF Files