[gdal-dev] Amplitude virtual bands for complex datasets ?

Even Rouault even.rouault at spatialys.com
Wed Jul 6 02:49:08 PDT 2016


Le mercredi 06 juillet 2016 11:28:24, Julien Michel a écrit :
> Le 06/07/2016 à 10:26, Even Rouault a écrit :
> >> Even, I think the AddBand() method is obviously not the right place to
> >> 
> >> >do that, but I do not get how tweak the GetMetadata() /
> >> >GetMetadataDomainList().
> > 
> > Hum I'm not sure how to better explain. I almost coded it;-)
> 
> I figured it out (or at least I figured out why it was not working at my
> first attempt) : most drivers in frmts have a gdaldataset subclass,
> which override GetMetadataDomainList() and GetMetadata() ... So the
> gdaldataset implementation never gets called. Seems like another dead
> end ...

Which ones ? They should call the base method as well.

For example, looking randomly in the HDF4 driver, that should be OK:

/************************************************************************/
/*                      GetMetadataDomainList()                         */
/************************************************************************/

char **HDF4Dataset::GetMetadataDomainList()
{
    return BuildMetadataDomainList(GDALPamDataset::GetMetadataDomainList(),
                                   TRUE,
                                   "SUBDATASETS", NULL);
}

/************************************************************************/
/*                            GetMetadata()                             */
/************************************************************************/

char **HDF4Dataset::GetMetadata( const char *pszDomain )

{
    if( pszDomain != NULL && STARTS_WITH_CI(pszDomain, "SUBDATASETS") )
        return papszSubDatasets;

    return GDALDataset::GetMetadata( pszDomain );
}


I cannot exclude that some do not call the base method, If so, they should be 
fixed.
The GeoTIFF one might be an exception to that, for a whole set of good and bad 
reasons, history, etc... does its own thing regarding metadata handling. But 
we might be able to patch it to call the base method when the domain is 
DERIVED_SUBDATASET.

> 
> Julien

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list