NITF -- Advanced Driver Information

The NITF (National Imagery Transmission Format) driver in GDAL includes a number of advanced, and somewhat esoteric options not suitable for the general end user documentation for the driver. This information is collected here, and is primarily aimed at developers and advanced users.

CGM Segments

NITF files that have CGM data (that is segment type GR - graphics, or SY with an STYPE value of 'C') will make that information available as metadata in the CGM domain. The returned metadata will look something like:
  SEGMENT_COUNT=1
  SEGMENT_0_SLOC_ROW=25
  SEGMENT_0_SLOC_COL=25
  SEGMENT_0_SDLVL=2
  SEGMENT_0_SALVL=1
  SEGMENT_0_CCS_ROW=00025
  SEGMENT_0_CCS_COL=00025
  SEGMENT_0_DATA=\0!\0...
The SLOC_ROW and SLOC_COL values are the placement of the CGM object relative to the base (SALVL) image. The CCS_ROW/COL values are relative to the common coordinate system. The _SDLVL is the display level. The DATA is the raw CGM data with "backslash quotable" escaping applied. All occurances of ASCII zero will be translated to '\0', and all backslashes and double quotes will be backslashed escaped. The CPLUnescapeString() function can be used to unescape the data into binary format using scheme CPLES_BackslashQuotable.

While GDAL does not support parsing or rendering CGM data, at least one user has found the UniConverter library useful for this purpose.

Multi-Image NITF Files

NITF files with more than one image segment (IM) will present the image segments as subdatasets. Opening a multiple NITF file by filename will provide access to the first image segment. The subdataset metadata for a 3 image NITF file might look like:

Subdatasets:
  SUBDATASET_1_NAME=NITF_IM:0:multi_image_jpeg_2.0.ntf
  SUBDATASET_1_DESC=Image 1 of multi_image_jpeg_2.0.ntf
  SUBDATASET_2_NAME=NITF_IM:1:multi_image_jpeg_2.0.ntf
  SUBDATASET_2_DESC=Image 2 of multi_image_jpeg_2.0.ntf
  SUBDATASET_3_NAME=NITF_IM:2:multi_image_jpeg_2.0.ntf
  SUBDATASET_3_DESC=Image 3 of multi_image_jpeg_2.0.ntf
In this case opening "multi_image_jpeg_2.0.ntf" directly will give access to "NITF_IM:0:multi_image_jpeg_2.0.ntf". To open the others use the corresponding subdataset names. The Subdataset mechanism is generic GDAL concept discussed in the GDAL Data Model document.

Text Segments

NITF files that have text segments (that is segment type TX) will make that information available as metadata in the TEXT domain. The returned metadata will look something like:
  DATA_0=This is test text file 01.

  DATA_1=This is test text file 02.

  DATA_2=This is test text file 03.

  DATA_3=This is test text file 04.

  DATA_4=This is test text file 05.
Currently no TEXT segment header data is preserved. The argument to DATA_n is the raw text of the n'th (zero based) text segment with no escaping of any kind applied.

The CreateCopy() method on the NITF driver also supports creating text segments on the output file as long as the input file has metadata in the TEXT domain as defined above.

TREs

NITF files with registered (or unregistered?) extensions on the file header, or the referenced image header will make them available in a raw form in metadata via the TRE domain. The TRE domain will hold one metadata item per TRE which will have the name of the TRE as the name, and the data of the TRE as the contents. The data contents will be "backslash escaped" like CGM data above.

Metadata (TRE):
  GEOPSB=MAPM  World Geodetic System 1984                                       
               WGE World Geodetic System 1984                                   
                   WE Geodetic                                                  
                      GEODMean Sea                                              
                          MSL 000000000000000                                   
                                                0000
  PRJPSB=Polar Stereographic                                                    
         PG2-00090.00000250000039.99999884000000000000000000000000000000
  MAPLOB=M  0598005958-000003067885.8-000002163353.8