[gdal-dev] HDF4 python add band

Even Rouault even.rouault at mines-paris.org
Sun Apr 27 02:20:19 PDT 2014


Luca,

very few drivers (and formats) support AddBand (the only ones are MEM and 
VRT), mostly because it would imply in most cases to completely rewrite the 
structure of what is already on disk.

Currently, with current code, your only option is to specify the right number 
of bands at Create() time if you create a new HDF4Image from scratch.
Or if you've an existing HDF4Image that would fit into memory, you could 
CreateCopy() it in a MEM dataset, AddBand() to the MEM dataset and fill it, and 
then CreateCopy() to a new HDF4Image.

But actually looking at the driver, I think it should be possible to implement 
AddBand() by a call to SDcreate(). At least in the case the dataset is a 
"GDAL_HDF4" one (i.e. created by GDAL initially).

Even

> Hi everybody,
> 
> I'm working with HDF4Image and Python bindings, I would like to add
> new band after create the layer.
> 
> When I try to use AddBand function it return:
> 
> ERROR 6: "FILENAME" Dataset does not support the AddBand() method.
> 
> It should be possible to make possible to use AddBand() also for this
> format? Or there some other way to insert new band in HDF4Image
> format?
> 
> Thanks

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list