I am looking to match both the projection and extent of two separate .tif files. The file I want all other .tif files introduced into raster calculations is as follows:

enter image description here

The other raster image covers the globe, however I am only interested in matching the extent of the first image, this second raster image looks like the following:

enter image description here

I attempted to reproject both rasters to the WGS 84 coordinate system (EPSG:4326) through the following GDAL code, however when I placed both rasters into QGIS to verify they were matched up, the second image was in the bottom left hand corner of the first, which verified my suspicion the code did not work as intended.

gdalwarp -t_srs EPSG:4326 -overwrite gfs.tif gfstest.tif

Other info I can provide from this is the layer extent of both images, which I hope can provide some clues: Image 1:-1269.8514999999999873,-1269.8515000003390014 : 5446393.0834999997168779,3495901.1794999996200204

Image 2: -0.1250000000000000,-90.1250000000000000 : 359.8750000000000000,90.1250000000000000

  • Try reprojecting your gfs tif using the Reproject tool in QGIS. I believe it also just calls GDAL, but it's a quick and easy check to make sure you called it properly (with the right inputs/outputs). Also, there is a "Clip raster by extent" tool in QGIS (it's also just a gdal tool) that might do what you want in one command. I'm not sure if the rasters need to be in the same CRS for that tool to work; but if so, just use the reproject tool first. – Jon May 19 '18 at 20:09

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.