1

Can anyone help me to use gdal(gdalwarp specifically) for reprojection? I am using it to reproject MODIS data :

I originally have an hdf file - MCD43A4.A2005001.h08v05.005.2007351192333.hdf which has SDS of size 2400 x 2400 at 500m resolution.

I then reprojected it using :

gdalwarp -t_srs '+proj=latlong' -srcnodata 32767 -dstnodata 32767 HDF4_EOS:EOS_GRID:"MCD43A4.A2005001.h08v05.005.2007351192333.hdf":MOD_Grid_BRDF:Nadir_Reflectance_Band1 band1.tif.

This works fine but as I convert from sinusoidal to lat/long, the image size is now 3177 x 1194. I was wondering if this remains at 500m resolution?

To set the resolution manually I tried using the -tr option of gdalwarp:

gdalwarp -t_srs '+proj=latlong' -tr 500 500 -srcnodata 32767 -dstnodata 32767 HDF4_EOS:EOS_GRID:"MCD43A4.A2005001.h08v05.005.2007351192333.hdf":MOD_Grid_BRDF:Nadir_Reflectance_Band1 band1.tif.

This gives an error : Attempt to create 0 x 0 dataset is illegal, sizes must be greater than 0.

Can anyone please help me out figuring this - whether I need to manually set the resolution(and how to fix the error) or can I use the 3177 x 1194 image?

  • 1
    You are projecting to system which is having degrees as unit and with your target resolution pixel size would be 500 by 500 degrees. – user30184 Jan 7 '16 at 21:03
  • Yes, thanks for pointing that out. However, if I am working with a tile that is not situated near the equator, then how should my calculations change? – user64841 Jan 8 '16 at 2:24
  • 1
    Why not just test if the resolution suits your need? gdalinfo band1.tif will tell you the pixel size of the reprojected file. – Kersten Jan 8 '16 at 9:05

Your Answer

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

Browse other questions tagged or ask your own question.