Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working with the TRMM 3B31 files on precipitation provided by NASA. When I load them on QGIS selecting the WGS84 projection together with other shape files the maps are displayed vertically, i.e. QGIS interpret as latitude what instead is longitude and vice-versa. I have tried gdal_translate option -a_ullr selecting imposing good coordinates but it doesn't solve the problem: the images are only compressed and stretched to satisfy my requirements but this is clearly not what I would like to have. When you load a .csv file you can choose what has to be the latitude and what the longitude, is there a way to do the same for rasters? Since I have 193 raster it would be great if you can suggest a command that can be performed iteratively.

enter image description here
The image shows a map of India and the first band of the 3B31 file, i.e. surface precipitation. The two black lines are the 40 and -40 parallel. I would like to have them horizontal and hence that the rain data overlaps with India. I hope this is clear

share|improve this question
A test image would be very useful. – user30184 Mar 18 at 12:41
@user30184 gives lots of links. – AndreJ Mar 18 at 13:26
up vote 5 down vote accepted

I tried the 3b31 hdf file from mirador and found the same orientation as you encountered. So I created some GCP to perform a rotation anti-clockwise:

gdal_translate -of VRT HDF4_SDS:UNKNOWN:"3b31.hdf":0 0.vrt
gdal_translate -of VRT -gcp 0 0 -180 -40 -gcp 160 0 -180 40 -gcp 0 720 180 -40 -gcp 160 720 180 40 0.vrt 1.vrt
gdalwarp -r bilinear -t_srs EPSG:4326 1.vrt 0.tif

with this result:

enter image description here

My rotation should follow the Origin=SOUTHWEST metadata tag.

share|improve this answer
This is exactly what I was looking for, though I am not able to use the commands you wrote in the proper way. Can You explain their usage in more details? – Paolo Santini Mar 18 at 16:46
Put them into a text file named rotate.bat in the same folder as the HDF file. Check the source file name, start the OSGEO4W Shell, navigate to the folder with cd... and run the batch. Good old DOS navigation is always useful ;-) – AndreJ Mar 18 at 17:24

I downloaded 3B42RT.2016031806.7.7day.tif and .tfw but I don't see anything odd in the georeferencing.

enter image description here

Gdalinfo report of this image is

gdalinfo 3B42RT.2016031806.7.7day.tif
Driver: GTiff/GeoTIFF
Files: 3B42RT.2016031806.7.7day.tif
Size is 1440, 480
Coordinate System is `'
Origin = (-180.000000000000000,60.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
  TIFFTAG_DATETIME=2016:03:18 10:25:21
  TIFFTAG_SOFTWARE=IDL 7.1.1, ITT Visual Information Solutions
Image Structure Metadata:
Corner Coordinates:
Upper Left  (-180.0000000,  60.0000000)
Lower Left  (-180.0000000, -60.0000000)
Upper Right ( 180.0000000,  60.0000000)
Lower Right ( 180.0000000, -60.0000000)
Center      (   0.0000000,   0.0000000)
Band 1 Block=1440x2 Type=UInt16, ColorInterp=Gray
share|improve this answer
It seems that the 3b42 tif files have correct georeferencing, while the 3b31 hdf files have not. – AndreJ Mar 18 at 14:11
It seems rather that HDF is complicated and not perfectly supported by GDAL – user30184 Mar 18 at 14:38
Exactly some of those you find in Mirador are georeferenciated, choosing the NetCDF properties in the customization window, others are not. – Paolo Santini Mar 18 at 14:42
@user30184 it's up to the data provider to include proper georeferencing metadata tags. You get what you paid for ... – AndreJ Mar 18 at 17:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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