[gdal-dev] Amplitude virtual bands for complex datasets ?
even.rouault at spatialys.com
Wed Jul 6 01:26:50 PDT 2016
> Even, I think the AddBand() method is obviously not the right place to
> do that, but I do not get how tweak the GetMetadata() /
Hum I'm not sure how to better explain. I almost coded it ;-)
> 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
Hum, after all, maybe SetBand() could still do it, but we would need to make
sure to explicitly call GDALDataset::SetMetadataItem(), and not the potential
overridden SetMetadataItem() method of a driver.
> Also, can we discuss syntax (COMPLEX_AMPLITUDE is not very meaningful)
> and behaviour (for now all bands are considered even if they are not
> Last, it does not work for real subdatasets. For instance, for S2 data :
> $ gdalinfo -mdd DERIVED_SUBDATASETS
> Driver: SENTINEL2/Sentinel 2
> Metadata (DERIVED_SUBDATASETS):
> DERIVED_SUBDATASET_1_DESC=Complex amplitude of bands from
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.
Spatialys - Geospatial professional services
More information about the gdal-dev