[gdal-dev] python: possible to get Dataset from Band

Even Rouault even.rouault at mines-paris.org
Tue Nov 9 17:48:14 EST 2010

Le mardi 09 novembre 2010 23:34:35, Gregory, Matthew a écrit :
> Hi all,
> An easy question and apologies if it's been asked before.
> Is there a way to get the owning gdal.Dataset from a gdal.Band within
> Python?  I'm not seeing GetDataset() as in C/C++ within the Python
> bindings.

No, there's no direct way of doing it with an API call. But as you can only 
get a Band from a Dataset, you can easily do something like :

band = ds.GetRasterBand(xxx)
band.ds = ds

and then use band.ds to get access to the dataset...

More information about the gdal-dev mailing list