[gdal-dev] new landsat-8 metadata format
Daniel Testa
danieltesta at suremptec.com.ar
Fri May 16 13:58:42 PDT 2014
Hi Even,
> There's no real need of a new API for that (although it might be cleaner
to
> have a dedicated one at some point). I'd note that your proposed API would
> only work for a single subdataset, not a vector of them.
Sorry, my bad. Should have been:
GDALDataset** pporSubDatasets;
virtual GDALDataset** GetSubDatasets();
> Anyway, the subdatasets mechanism already exist in many drivers and
should do
> what you need. You can read the "SUBDATASETS domain" section of
> http://www.gdal.org/gdal_datamodel.html and have a look at the code of the
> mentionned drivers to see how they do that.
I've read the "SUBDATASETS domain" section and took a look at the HDF5
format, in particular, but I don't think that that would work for me. Maybe
I'm not looking at the right place though.
The scenario:
LC82300942013289LGN00_B1.tif
LC82300942013289LGN00_B2.tif
LC82300942013289LGN00_B3.tif
LC82300942013289LGN00_B4.tif
LC82300942013289LGN00_B5.tif
LC82300942013289LGN00_B6.tif
LC82300942013289LGN00_B7.tif
LC82300942013289LGN00_B8.tif
LC82300942013289LGN00_B9.tif
LC82300942013289LGN00_B10.tif
LC82300942013289LGN00_B11.tif
LC82300942013289LGN00_BQA.tif
LC82300942013289LGN00_MTL.txt
I'd like to open LC82300942013289LGN00_MTL.txt and get 4 datasets:
Dataset 1:
LC82300942013289LGN00_B1.tif
LC82300942013289LGN00_B2.tif
LC82300942013289LGN00_B3.tif
LC82300942013289LGN00_B4.tif
LC82300942013289LGN00_B5.tif
LC82300942013289LGN00_B6.tif
LC82300942013289LGN00_B7.tif
LC82300942013289LGN00_B9.tif
Dataset 2:
LC82300942013289LGN00_B8.tif
Dataset 3:
LC82300942013289LGN00_B10.tif
LC82300942013289LGN00_B11.tif
Dataset 4:
LC82300942013289LGN00_BQA.tif
Maybe GetSubDatasets is not the most appropiate name for this purpose (I
thought about that, but at that moment I couldn't think of a better name).
Maybe GetAssociatedDatasets would be better.
Using it:
GDALDataset* poDataset = (GDALDataset *)GDALOpen(...);
poDataset->GetRasterBand(...); // would return a band from those in Dataset
1 above.
GDALDataset** pporAssocDatasets = poDataset->GetAssociatedDatasets();
pporAssocDatasets[0]->GetRasterBand(...); // would return a band from those
in Dataset 2 above.
pporAssocDatasets[1]->GetRasterBand(...); // would retun a band from those
in Dataset 3 above.
pporAssocDatasets[2]->GetRasterBand(...); // would return a band from those
in Dataset 4 above.
> Another question I have is : how close or far would be Landsat8 support
from
> the existing code of the FAST driver. I see that FAST relies on "raw"
bands,
> whereas you mention .tif for Landsat 8 + the change of metadata format.
So it
> might be more appropriate to have a new driver if technically there is
little
> common points between the drivers.
Yes, it might be better to add a new driver.
Hope this will give you a better idea of what I'd like to accomplish.
Thanks.
On Fri, May 16, 2014 at 2:56 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:
> Daniel,
>
> There's no real need of a new API for that (although it might be cleaner to
> have a dedicated one at some point). I'd note that your proposed API would
> only work for a single subdataset, not a vector of them.
>
> Anyway, the subdatasets mechanism already exist in many drivers and should
> do
> what you need. You can read the "SUBDATASETS domain" section of
> http://www.gdal.org/gdal_datamodel.html and have a look at the code of the
> mentionned drivers to see how they do that.
>
> Another question I have is : how close or far would be Landsat8 support
> from
> the existing code of the FAST driver. I see that FAST relies on "raw"
> bands,
> whereas you mention .tif for Landsat 8 + the change of metadata format. So
> it
> might be more appropriate to have a new driver if technically there is
> little
> common points between the drivers.
>
> Best regards,
>
> Even
>
> > Hi, I'm writing to you because I need support for the new Landsat-8
> > metadata format (_MTL.txt file)
> >
> > I took a look at the latest version, 1.11.0, and I couldn't find anything
> > on the matter. So, I was thinking I could add support for the new format
> by
> > myself.
> >
> > There are 3 groups of bands: panchromatic, multispectral and thermal. One
> > .tif file for each band and then the MTL file with all the info. I'd like
> > to open the MTL file, using GDAL, and have access to all of them. So,
> what
> > I was thinking was that I could add a public method (virtual) to the
> > GDALDataset class, lets say GetSubDatasets, that would allow a dataset to
> > return associated subdatasets. Then, in the FASTDataset class, if I
> detect
> > that I'm trying to open a MTL file, I could make the FASTDataset::Open
> > method return a Dataset (as it does now) containing only the
> multispectral
> > bands and then with the overridden GetSubDatasets method I could get a
> > vector with the other 2 datasets: one with the panchromatic band and
> > another one with the thermal bands.
> >
> > What do you think?
> >
> > Any idea, suggestion or comment is very welcome :)
> >
> > Sample:
> >
> > class CPL_DLL GDALDataset : public GDALMajorObject
> > {
> > [...]
> > public:
> > virtual GDALDataset* GetSubDatasets() { return NULL; }
> > [...]
> > }
> >
> > class FASTDataset : public GDALPamDataset
> > {
> > [...]
> > private:
> > GDALDataset* porSubDatasets;
> > [...]
> > public:
> > virtual GDALDataset* GetSubDatasets();
> > [...]
> > }
> >
> > GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
> > {
> > /**
> >
> > IF mtl
> > LOAD main dataset
> > LOAD subdatasets
> > RETURN main dataset
> >
> > **/
> >
> > int i;
> >
> > if(poOpenInfo->nHeaderBytes < 1024)
> > return NULL;
> >
> > [...]
> > }
> >
> > Thanks in advance.
> >
> > Regards,
> > Daniel.
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140516/28db3e5c/attachment-0001.html>
More information about the gdal-dev
mailing list