Can anyone help me with using gdal_translate on an HDF4 dataset that a space?

One SDS in the the HDF is:

HDF4_EOS:EOS_GRID:"MOD13Q1.A2004001.h08v05.005.2007234070731.hdf":MODIS_Grid_16DAY_250m_500m_VI:250m 16 days NDVI

I want to use gdal_translate to extract this as a tif or envi file and I use the following command:

HDF4_EOS:EOS_GRID:"MOD13Q1.A2004001.h08v05.005.2007234070731.hdf":MODIS_Grid_16DAY_250m_500m_VI:250m 16 days NDVI ndvi.envi

This displays a message "too many command options" and displays the general gdal_translate template and "The following format drivers are configured and support output:" list.

Where am I going wrong? I have used the same command another dataset that does not have spaces like that of between "16 days NDVI" and that works perfectly.

1 Answer 1


BTW, your gdal_translate command is incomplete, you don't have the command name or the format argument.

But, you just need to quote the entire string, possibly with escapes. Try just single quotes around it all

'HDF4_EOS:EOS_GRID:"MOD13Q1.A2004001.h08v05.005.2007234070731.hdf":MODIS_Grid_16DAY_250m_500m_VI:250m 16 days NDVI' 
  • Yes, I missed the gdal_translate while asking the question. Sorry about that. I tried out what you suggested: gdal_translate 'HDF4_EOS:EOS_GRID:"MOD13Q1.A2004001.h08v05.005.2007234070731.hdf":MODIS_Grid_16DAY_250m_500m_VI:250m_16_days_NDVI' ndvi.envi. I get an error:GDALOpen failed - 4 `HDF4_EOS:EOS_GRID:"$data":MODIS_Grid_16DAY_250m_500m_VI:250m_16_days_EVI' does not exist in the file system, and is not recognised as a supported dataset name. Could you please suggest a way to go about this?
    – user64841
    Commented Jan 19, 2016 at 2:56
  • Windows and Linux might behave different on this. Try double quotes instead of single, and double double "" where you have double now.
    – AndreJ
    Commented Jan 19, 2016 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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