[gdal-dev] Creating derived raster bands using python

Frank Warmerdam warmerdam at pobox.com
Thu Mar 5 09:26:51 EST 2009


Antonio Valentino wrote:
> Hi list,
> I'm trying to create a *Derived* raster band in a virtual dataset.
> 
> All my attempts seems to fail:
> 
>>>> ds.AddBand(options={'subClass': 'VRTDerivedRasterBand'})
> 
> raises an exception while
> 
>>>> ds.AddBand(options='subClass="VRTDerivedRasterBand"')
>>>> ds.AddBand(options=['subClass="VRTDerivedRasterBand"'])

Antonio,

I believe the correct syntax is:

   ds.AddBand(options=['subClass=VRTDerivedRasterBand'])

The options should be a list of name=value pairs.  Your extra double
quotes within the string will make the class name comparison fail
since you are effectively passing "\"VRTDerivedRasterBand\"" in C
terms.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list