[Qgis-developer] Re: [gdal-dev] Problems with gdal and hdf files

Even Rouault even.rouault at mines-paris.org
Wed May 2 05:54:58 PDT 2012

> but there is no way to actually select 1 or more specific subdatasets

It is possible to select one subdataset. You must use the name reported in the
lines that contain SUBDATASET_XXX_NAME. For example :

gdal_translate HDF4_EOS:EOS_GRID:"lndsr.L5169054_05420101216.hdf":Grid:band1

> The most important
> QGIS complains:
> Cannot get GDAL raster band:

I think support for selecting subdatasets has been added in QGIS 1.8 (I haven't
tested myself, just a vague feeling of having seen a commit message about that)

> R (raster) complains
> > r <- brick("lndsr.L5169054_05420101216.hdf")
> Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) :
>   Cannot create a RasterLayer object from this file.
> In addition: Warning message:
> In .rasterFromGDAL(x, band = band, objecttype, ...) :
>   GeoTransform values not available; georeferencing will not be correct
> >

You can likely directly provide the subdataset name instead of the dataset name.
Not sure if R exposes a way of getting the subdataset names from the dataset.

More information about the Qgis-developer mailing list