[Gdal-dev] Metadata preservation (or lack thereof) in NITF driver

Frank Warmerdam warmerdam at pobox.com
Tue Jul 24 12:26:20 EDT 2007


Ozy Sjahputera wrote:
> I was using :
> 
> gdal_translate -of nitf src.ntf dst.ntf
> 
> The input file, src.ntf, contains some metadata items such as the RPC 
> parameters (important to have if you want to do orthorectification). 
> However, the result of gdal_translate above, dst.ntf, does not contain 
> any of the RPC parameters.
> I wrote a simple program to do something similar:
>      GDALDataset *srcDs = (GDALDataset*) GDALOpen( srcfname.c_str(), 
> GA_ReadOnly);
>    char **papszCreateOptions = NULL;
>    papszCreateOptions = srcDs->GetMetadata();
>    GDALDriver *hDriver = (GDALDriver*) GDALGetDriverByName( "nitf" );
>    GDALDataset *dstDs = hDriver->CreateCopy(dstfname.c_str(), srcDs, 
> TRUE, papszCreateOptions, NULL, NULL);
> 
> Note that I specifically fetched the source image metadata and passed it 
> to CreateCopy.  I also specified bStrict = TRUE since I want the copy to 
> be equivalent (just to prove a point). Even with this code the output 
> image still does not contain any RPC parameter.

Ozy,

The NITF driver just doesn't support writing RPC info.

The bStrict flag is not well adhered to by drivers.  You should pass it
as a hint to drivers rather than expecting them to truely be "strict".

I have recently incorporated the ability to write BLOCKA stuff from
metadata in the NITF driver, but generally speaking the NITF driver
writes only a fairly simple subset of possible NITF information though
the reader tries to be more general.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list