[Gdal-dev] Question about gdal_translate (NITF export)

Frank Warmerdam warmerdam at pobox.com
Fri Apr 16 01:27:39 EDT 2004


Dinardo, George wrote:
> We have started to use the gdal_translate utility as delivered through
> OPENEV.  We want to convert georeferenced SAR imagery data (CEOS) to NITF
> format, but are experiencing some problems. GeoTiff works well. Are there
> examples or help on which options we need to create an NITF format file.

George,

What pixel type is the CEOS data?  I don't know that I have ever tested
producing complex (as in real+imaginary) NITF files with GDAL so I wouldn't
be surprised if that caused problems.  Also, I believe GDAL will currently only
produce output files with nice affine geotransforms.  If you are working with
un-rectified CEOS SAR data you will likely not be able to export the
georeferencing properly to NITF with the existing GDAL NITF driver.

I notice that the NITF driver does *not* report the full set of creation
options available.  In effect many of the "metadata" header fields can be set
via creation options.  I believe all the lines shown below using the "OVR"
macro can be set via creation options.

     PLACE (achHeader+  0, FDHR_FVER,    "NITF02.10"                     );
     OVR( 2,achHeader+  9, CLEVEL,       "05"                            );
     PLACE (achHeader+ 11, STYPE        ,"BF01"                          );
     OVR(10,achHeader+ 15, OSTAID       ,"GDAL"                          );
     OVR(14,achHeader+ 25, FDT          ,"20021216151629"                );
     OVR(80,achHeader+ 39, FTITLE       ,""                              );
     OVR( 1,achHeader+119, FSCLAS       ,"U"                             );
     OVR( 2,achHeader+120, FSCLSY       ,""                              );
     OVR(11,achHeader+122, FSCODE       ,""                              );
     OVR( 2,achHeader+133, FSCTLH       ,""                              );
     OVR(20,achHeader+135, FSREL        ,""                              );
     OVR( 2,achHeader+155, FSDCTP       ,""                              );
     OVR( 8,achHeader+157, FSDCDT       ,""                              );
     OVR( 4,achHeader+165, FSDCXM       ,""                              );
     OVR( 1,achHeader+169, FSDG         ,""                              );
     OVR( 8,achHeader+170, FSDGDT       ,""                              );
     OVR(43,achHeader+178, FSCLTX       ,""                              );
     OVR( 1,achHeader+221, FSCATP       ,""                              );
     OVR(40,achHeader+222, FSCAUT       ,""                              );
     OVR( 1,achHeader+262, FSCRSN       ,""                              );
     OVR( 8,achHeader+263, FSSRDT       ,""                              );
     OVR(15,achHeader+271, FSCTLN       ,""                              );
     OVR( 5,achHeader+286, FSCOP        ,"00000"                         );
     OVR( 5,achHeader+291, FSCPYS       ,"00000"                         );
     PLACE (achHeader+296, ENCRYP       ,"0"                             );
     achHeader[297] = achHeader[298] = achHeader[299] = 0x00; /* FBKGC */
     OVR(24,achHeader+300, ONAME        ,""                              );
     OVR(18,achHeader+324, OPHONE       ,""                              );
     PLACE (achHeader+342, FL           ,"????????????"                  );
     PLACE (achHeader+354, HL           ,"000404"                        );
     PLACE (achHeader+360, NUMI         ,"001"                           );
     PLACE (achHeader+363, LISH1        ,"??????"                        );
     PLACE (achHeader+369, LI1          ,CPLSPrintf("%010d",nImageSize)  );
     PLACE (achHeader+379, NUMS         ,"000"                           );
     PLACE (achHeader+382, NUMX         ,"000"                           );
     PLACE (achHeader+385, NUMT         ,"000"                           );
     PLACE (achHeader+388, NUMDES       ,"000"                           );
     PLACE (achHeader+391, NUMRES       ,"000"                           );
     PLACE (achHeader+394, UDHDL        ,"00000"                         );
     PLACE (achHeader+399, XHDL         ,"00000"                         );

/* -------------------------------------------------------------------- */
/*      Prepare the image header.                                       */
/* -------------------------------------------------------------------- */
     pachIMHDR = achHeader + 404;

     PLACE (pachIMHDR+  0, IM           , "IM"                           );
     OVR(10,pachIMHDR+  2, HD1          , "Missing"                      );
     OVR(14,pachIMHDR+ 12, IDATIM       , "20021216151629"               );
     OVR(17,pachIMHDR+ 26, TGTID        , ""                             );
     OVR(80,pachIMHDR+ 43, IID2         , ""                             );
     OVR( 1,pachIMHDR+123, ISCLAS       , "U"                            );
     OVR( 2,pachIMHDR+124, ISCLSY       , ""                             );
     OVR(11,pachIMHDR+126, ISCODE       , ""                             );
     OVR( 2,pachIMHDR+137, ISCTLH       , ""                             );
     OVR(20,pachIMHDR+139, ISREL        , ""                             );
     OVR( 2,pachIMHDR+159, ISDCTP       , ""                             );
     OVR( 8,pachIMHDR+161, ISDCDT       , ""                             );
     OVR( 4,pachIMHDR+169, ISDCXM       , ""                             );
     OVR( 1,pachIMHDR+173, ISDG         , ""                             );
     OVR( 8,pachIMHDR+174, ISDGDT       , ""                             );
     OVR(43,pachIMHDR+182, ISCLTX       , ""                             );
     OVR( 1,pachIMHDR+225, ISCATP       , ""                             );
     OVR(40,pachIMHDR+226, ISCAUT       , ""                             );
     OVR( 1,pachIMHDR+266, ISCRSN       , ""                             );
     OVR( 8,pachIMHDR+267, ISSRDT       , ""                             );
     OVR(15,pachIMHDR+275, ISCTLN       , ""                             );
     PLACE (pachIMHDR+290, ENCRYP       , "0"                            );
     OVR(42,pachIMHDR+291, ISORCE       , "Unknown"                      );
     PLACE (pachIMHDR+333, NROWS        , CPLSPrintf("%08d", nLines)     );
     PLACE (pachIMHDR+341, NCOLS        , CPLSPrintf("%08d", nPixels)    );
     PLACE (pachIMHDR+349, PVTYPE       , pszPVType                      );
     PLACE (pachIMHDR+352, IREP         , pszIREP                        );
     OVR( 8,pachIMHDR+360, ICAT         , "VIS"                          );
     OVR( 2,pachIMHDR+368, ABPP         , CPLSPrintf("%02d",nBitsPerSample) );
     OVR( 1,pachIMHDR+370, PJUST        , "R"                            );
     OVR( 1,pachIMHDR+371, ICORDS       , " "                            );

The name (as per the NITF specs) to set the options are the third column
above.  For instance, to set ONAME and OPHONE you might do:

   gdal_translate -co "ONAME=Frank Warmerdam" -co OPHONE=9057800450 in.tif out.ntf

Do you have a sample input file you would like to be able to translate?
What problems are you seeing with the output file. I would be willing to
make some improvements to the GDAL NITF writing support if you need it.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list