[gdal-dev] NITF header writing - not really?

Even Rouault even.rouault at mines-paris.org
Thu Mar 26 14:25:57 EDT 2009


Andrew,

The way how to set NITF fields is documented in 
http://gdal.org/frmt_nitf.html.

But I acknowledge this may be a bit confusing, because even if they are 
reported as metadata items by GDAL, NITF header fields must be set as 
creation options, not metadata. So if you replace -mo by -co and remove the 
NITF_ prefix, it should work as you expect.

gdal_translate -of NITF -co FTITLE=myspecialvalue infile.ntf outfile.ntf

I've updated the doc to make it a bit clearer hopefully.

To explain the behaviour you currently observe with the .aux.xml file : the 
NITF driver doesn't implement the SetMetadata() API, so it just passes it to 
the PAM layer that can read it / write it from the auxiliary XML file.

Best regards.
Even

Le Thursday 26 March 2009 14:22:04 Andrew Loughhead, vous avez écrit :
> Does gdal_translate actually write values specified via -mo into the
> output NITF files?  It seems that metadata fields specified with
> -mo get put into the .aux.xml file, but not into the actual output NITF
> file.  For example:
>
> gdal_translate -of NITF -mo "NITF_FTITLE="myspecialvalue" infile.ntf
> outfile.ntf
>
> That seems to run, so I do gdalinfo on outfile.ntf.  Great, I get:
>   NITF_FTITLE=myspecialvalue
>
> But - when I take my NITF into software able to show headers (say, Erdas
> Imagine), the FTITLE header appears to be blank. On investigation, it
> appears that the run of gdalinfo outfile.ntf is actually just reporting
> the contents of outfile.ntf.aux.xml.  If I remove that file, and run
> gdalinfo outfile.ntf, I get a blank NITF_FTITLE!
>
> A few headers are getting written into the output NITF file, such as
> OSTAID, but even these appear to have hardcoded values, except for
> as put in the .aux.xml file. In the case of OSTAID my custom value
> gets put into outfile.ntf.aux.xml, and reported by gdalinfo. If
> I delete outfile.ntf.aux.xml, and rerun gdalinfo outfile.ntf, the
> value GDAL is reported.
>
> Any ideas or info?
>
> thanks
> Andrew.
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list