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

Julien Michel julien.michel at cnes.fr
Wed Jul 6 06:15:51 PDT 2016


You were right (what a surprise !). I pushed the new 
GetMetadataDomainList() / GetMetadata() methods to gdaldataset, as well 
as the fix for geotiff (and some other fixes).

Now works like a charm even with subdatasets.

Regards,

Julien


Le 06/07/2016 à 11:49, Even Rouault a écrit :
> 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


-- 
Julien MICHEL
CNES - DCT/SI/AP - BPI 1219
18, avenue Edouard Belin
31401 Toulouse Cedex 09 - France
Tel: +33 561 282 894 - Fax: +33 561 283 109



More information about the gdal-dev mailing list