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

Julien Michel julien.michel at cnes.fr
Wed Jul 6 01:41:29 PDT 2016

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 ;-)
Sorry, it is my first time coding into gdal, I need to wrap my head 
around it. I will try again ;)
>> As far as I can tell from the code, datasets
>> never directly declare new domains by hacking GetMetadataDomainList().
>> Calling SetMetadataItem() with a new domain is enough to create it (that
>> is what I did). But I surely miss something here.
> We definitely don't want to call SetMetadata() / SetMetadataItem() in generic
> code, as it could have a lot of undesired side effects, like pushing metadata
> to PAM (.aux.xml files) or to the own metadata storage of the driver. IMHO, the
> derived subdataset reporting must rather be done in a "passive" way with
> GetMetadata().
Pushing metadata to PAM actually happens with the current code. I had a 
hard time figuring out why my changes to the derived datasets name did 
not reflect in gdalinfo, before I remember this little xml file ;) I 
understand this is not a desired behaviour.
> Probably because at the time of SetBand(), the dataset name hasn't been set
> yet on the dataset object. It is generally done at the very end of the Open()
> method, and that's the case of the Sentinel2 driver, and most all other
> drivers that are generally copied&pasted from the same skeleton. So the
> SetBand() way seems to be a dead end, unless we edit all drivers (probably not
> all drivers, just in drivers that can have complex data types) to initialize
> their description earlier.
Ok I will try the other way, and keep you posted.




More information about the gdal-dev mailing list