[gdal-dev] gdal_translate alters NITF's metadata

Even Rouault even.rouault at mines-paris.org
Fri Apr 20 17:36:01 EDT 2012


Le vendredi 20 avril 2012 23:28:05, Shawn Gong a écrit :
> Thanks Frank.
> 
> We also find that NITFCreateCopy() doesn't copy the 4 corner GCPs, only the
> geotransform. We'll take a look at your suggestion and report back.

Support for copying GCPs has been added recently in trunk. See 
http://trac.osgeo.org/gdal/changeset/23997

> 
> Shawn
> ________________________________________
> From: fwarmerdam at gmail.com [fwarmerdam at gmail.com] On Behalf Of Frank
> Warmerdam [warmerdam at pobox.com] Sent: April 20, 2012 12:35 PM
> To: Shawn Gong
> Cc: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] gdal_translate alters NITF's metadata
> 
> 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_______________________________________________ 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