Hi Mattia,<br>Surely, someone in this mailing list will provide you a great tip.<br>Anyway, in the meantime, you can try with this command:<br><br>gdal_info -of GTiff -b 1 -b 2 -b 3 -co "PHOTOMETRIC=RGB" hdfsamplefile.hdf
tiftobewritten.tif<br><br>with the following notes:<br>-b 1 -b 2 -b3 allows to select the desired bands (instead of 1, 2, 3, select the bands of your HDF dataset you need)<br>-co "PHOTOMETRIC=RGB" is a create option which allows to set the RGB color interpretation.
<br>hdfsamplefile.hdf is your source HDF file. Note that if your HDF contains several subdatasets and you need some bands of a subdataset you need to provide the subdataset name returned by gdalinfo on the<br>main file.<br>
<br>As an instance, calling gdalinfo on a HDF4, the last part of the information you can obtain could be:<br>...<br> SUBDATASET_48_NAME=HDF4_SDS:UNKNOWN:"c:\Work\data\hdf4\TOVS_DAILY_AM_870330_NG.HDF":157<br> SUBDATASET_48_DESC=[180x360] Data-Set-99 (16-bit integer)
<br> SUBDATASET_49_NAME=HDF4_SDS:UNKNOWN:"c:\Work\data\hdf4\TOVS_DAILY_AM_870330_NG.HDF":160<br> SUBDATASET_49_DESC=[180x360] Data-Set-101 (16-bit integer)<br> SUBDATASET_50_NAME=HDF4_SDS:UNKNOWN:"c:\Work\data\hdf4\TOVS_DAILY_AM_870330_NG.HDF":164
<br> SUBDATASET_50_DESC=[5x180x360] Data-Set-103 (16-bit integer)<br>....<br><br>So, if you need to extract 3 bands from the subdataset #50 (having 5 bands), you need to use <br>HDF4_SDS:UNKNOWN:"c:\Work\data\hdf4\TOVS_DAILY_AM_870330_NG.HDF":164
<br>as sourcedataset of your gdal_translate command.<br><br>In case you encounter an error reporting that is not a recognised format try removing the "C:" prefix in the subdataset name.<br><br>Let me know if this help.
<br>Regards,<br>Daniele<br><br><div class="gmail_quote">On Jan 25, 2008 2:17 PM, mattia <<a href="mailto:mattia.parigiani@gmail.com">mattia.parigiani@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all<br><br>I am pretty new to GDAL and need to carry out a task relating HDF datasets..<br><br>In particular I have HDF data with raster images inside and I would like to extract certain bands from the HDF band set and convert them into a Geotiff or some other RGB format..
<br>I guess this could be done using the gdal_translate utility or by writing some C snippet using the GDAL API... <br>Can anyone help me out on this or give any suggestions... <br>Thanks for your attention<br clear="all">
<br>-- <br><font color="#888888">Mattia
</font><br>_______________________________________________<br>gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">
http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>-------------------------------------------------------<br>Eng. Daniele Romagnoli <br>Software Engineer<br><br>GeoSolutions
S.A.S.<br>Via Carignoni 51<br>55041 Camaiore (LU)<br>Italy<br><br>phone: +39 0584983027<br>fax: +39 0584983027<br>mob: +39 328 0559267<br><br><br><a href="http://www.geo-solutions.it">http://www.geo-solutions.it</a>
<br><br>-------------------------------------------------------<br>