[gdal-dev] Rotate unreferenced tiff file by -90 degrees

Frank Warmerdam warmerdam at pobox.com
Thu Mar 17 09:34:24 EDT 2011


On 11-03-17 05:09 AM, Wesley Roberts wrote:
> Dear gdal'ers
>
> I am working with TRMM rainfall data from an HDF5 file (converted from hdf4
> to hdf5). I am able to use gdal_translate to extract the gridded data from
> the HDF file using the following command.
>
> gdal_translate -of GTiff
> "HDF5:"3A25.071201.6A.h5"://DATA_GRANULE/PlanetaryGrid2/e_surfRainMean2"
> test.tif
>
> Gdal_translate works a treat and writes out the test.tif file perfectly,
> however, the file is unreferenced and needs to be rotated by -90 degrees. Is
> it possible to do this using gdal_translate or do I need to make use of
> gdalwarp as well? My tiff world file needs to look something like this
>
> 0.500000 0.0000000 0.0000000 -0.500000 -179.750000 36.750000
>
> Am I correct in assuming that a suitable proj4 statement might do the trick,
> wrt assigning projection info and defining rotation? If so can someone point
> me towards a document explaining the various proj4 declaration parameters,
> or give me some advice on how to go about getting the data properly
> referenced.

Wesley,

I think the easiest approach is to prepare a worldfile representing the
current georeferencing in east-up or west-up orientation.  Then use
gdalwarp to transform it to north up.

   gdalwarp input.tif output.tif

For "east up" I think the world file might look something like:

0.0
0.5
0.5
0.0
top-left-x
top-left-y

You might need to fiddle around with the orientation a bit to get it
right.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list