[gdal-dev] gdal_translate alters NITF's metadata

Frank Warmerdam warmerdam at pobox.com
Fri Apr 20 12:35:07 EDT 2012


Shawn,

I see the values you get for NITF_ISORCE and NITF_IDATIM
are the default ones in the NITF Create code.  Looking through
the NITFCreateCopy() code in nitfdataset.cpp, it only seems to
copy a few selective metadata items from the source dataset to be
creation options when creating the header of the new one.  ISORCE
and IDATIM are not amoung them.   I'm not sure why it is so selective.

I'd suggest we open up this loop to copy more header values:

/* -------------------------------------------------------------------- */
/*      Copy over other source metadata items as creation options       */
/*      that seem useful.                                               */
/* -------------------------------------------------------------------- */
     char **papszSrcMD = poSrcDS->GetMetadata();
    int iMD;

    for( iMD = 0; papszSrcMD && papszSrcMD[iMD]; iMD++ )
    {
        if( EQUALN(papszSrcMD[iMD],"NITF_BLOCKA",11)
            || EQUALN(papszSrcMD[iMD],"NITF_FHDR",9) )
        {
            char *pszName = NULL;
            const char *pszValue = CPLParseNameValue( papszSrcMD[iMD],
                                                      &pszName );
            if( CSLFetchNameValue( papszFullOptions, pszName+5 ) == NULL )
                papszFullOptions =
                    CSLSetNameValue( papszFullOptions, pszName+5, pszValue );
            CPLFree(pszName);
        }
    }

Perhaps you could prepare a patch and test it and then submit it?

Best regards,
Frank

On Fri, Apr 20, 2012 at 9:20 AM, Shawn Gong <SGONG at mdacorporation.com> wrote:
> Hi list,
>
> I use gdal 1.9.0
>
> I have a NITF image that has 12 bands. The first 8 are I and Q of a quad-pol complex.
> I ran "gdal_translate -of NITF -b 9 -b 12 -b 10 -b 11 pp1.NTF test" to get rid of them and keep the last 4 magnitude bands.
>
> However the NITF tags are altered, e.g. the NITF_ISORCE and NITF_IDATIM
>
> Have you seen this?
> I also see "Warning 1: FHDR=NITF02.1 not supported, switching to NITF02.10."  Can this be the cause?
>
> Thanks,
> Shawn
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
---------------------------------------+--------------------------------------
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 Software Developer


More information about the gdal-dev mailing list