1

I have SPOT NDVI images. I want to convert NDVI hdf to tiff. I have used the following code to get the information of hdf file:

gdalinfo 20060501_NDVI.HDF

I get the following output

Driver: HDF4Image/HDF4 Dataset
Files: 20060501_NDVI.HDF
Size is 8849, 5601
Coordinate System is `'
Metadata:
 valid_range=0, 255
Corner Coordinates:
  Upper Left  (    0.0,    0.0)
  Lower Left  (    0.0, 5601.0)
  Upper Right ( 8849.0,    0.0)
  Lower Right ( 8849.0, 5601.0)
  Center      ( 4424.5, 2800.5)
  Band 1 Block=8849x113 Type=Byte, ColorInterp=Gray

As I do not get any information about the SUBDATA SETS in the gdalinfo command I use the following code to convert HDF to TIFF

gdal_translate -of GTiff 'HDF4Image:"20060501_NDVI.HDF":*NDVI'

But I get the output as

FAILURE: No target dataset specified.

As no DATASET is specified, I unable to specify any target dataset. Please let me know how to resolve this. Also I would like to resample the image to 250m resolution by using nearest neighbour (default) method.

2

Using gdal_translate you have to set at least two arguments:

src_dataset - yours SPOT NDVI HDF file

dst_dataset - output TIFF filename, for example spot_ndvi_250m.tif (you're missing this one, that's why you've got an "No target dataset specified" error.

Then in order to resample your image into 250m pixel using Nearest Neighbour you should add another two options:

-tr xres yres - where xres and yres are resampled pixel size (in georeferenced units)

-r nearest - flag to select resamplinf algorithm (in fact nearest naighbour is gdal's default method).

(Assuming your SPOT data are georeferenced in meter wise projection) try using command:

gdal_translate -of GTiff -tr 250 250 -r nearest 'HDF4Image:"20060501_NDVI.HDF":*NDVI' 20060501_NDVI.tif
  • Jzol : Thanks for the code and details. I tried this code but the problem is in "*NDVI". I get the output as "20060501_NDVI.HDF":*NDVI' does not exist in the file system. I am assuming that " * " will act as a wildcard for selecting any NDVI dataset in the hdf. Also the details in the gdalinfo command does not give information about Co-ordinate reference system and hence "-tr 250 250 -r nearest" command does not work as it may not be georeferenced in meter. – Karthik K Mar 3 '15 at 11:54
  • Since I do not know exactly how your HDF dataset look like i recommend to try GRASS's module i.in.spotvgt which should handle it in nice way. There's even a workflow to export at the end of this help: grass.osgeo.org/grass64/manuals/i.in.spotvgt.html – jzol Mar 3 '15 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.