Index: gdal_pam.h =================================================================== --- gdal_pam.h (revision 23088) +++ gdal_pam.h (working copy) @@ -73,6 +73,7 @@ #define GPF_DISABLED 0x04 // do not try any PAM stuff. #define GPF_AUXMODE 0x08 // store info in .aux (HFA) file. #define GPF_NOSAVE 0x10 // do not try to save pam info. +#define GPF_NOSAVEMETADATA 0x20 // do not try to save metadata - use if metadata is supported internally /* ==================================================================== */ /* GDALDatasetPamInfo */ Index: gdalpamdataset.cpp =================================================================== --- gdalpamdataset.cpp (revision 23088) +++ gdalpamdataset.cpp (working copy) @@ -203,15 +203,18 @@ /* -------------------------------------------------------------------- */ /* Metadata. */ /* -------------------------------------------------------------------- */ - CPLXMLNode *psMD; - psMD = oMDMD.Serialize(); - if( psMD != NULL ) - { - if( psMD->psChild == NULL && psMD->psNext == NULL ) - CPLDestroyXMLNode( psMD ); - else - CPLAddXMLChild( psDSTree, psMD ); + if ( ! ( nPamFlags & GPF_NOSAVEMETADATA ) ) { + CPLXMLNode *psMD; + + psMD = oMDMD.Serialize(); + if( psMD != NULL ) + { + if( psMD->psChild == NULL && psMD->psNext == NULL ) + CPLDestroyXMLNode( psMD ); + else + CPLAddXMLChild( psDSTree, psMD ); + } } /* -------------------------------------------------------------------- */