29

I have two geotiff images that I would like to resample the same resolution.

If I use ArcGIS Desktop this is easy to do but how do I do this using QGIS?

4 Answers 4

42

This is easy in QGIS too, though a little less obvious. There are a couple of ways you can do it:

  • Raster Calculator - simply use the raster calculator and you can set the resolution and extent there and can make them match another raster by selecting the raster band you want to match in the Raster Bands list and then clicking the "Current layer extent" button. The columns and rows fields will let you set the resolution. However, this method gives you no control over the resampling method.
  • Using GDAL_Warp - this tool lets you set the output resolution either by specifying the width and height of the output raster or by specifying the -tr switch (see the documentation). You can get to the GDAL_warp tool by going Raster->Projections->Warp (I did say it wasn't obvious from a resampling point of view!).

    • (v2.x) If you want to use the -tr switch, fill in all the boxes for input raster and output etc (your source and target SRS values will presumably be the same in this case - though don't have to be if you're reprojecting as well). Then click the little pencil icon at the bottom and edit the auto-generated gdal-warp commandline to include your -tr switch. Gdal_wrap lets you specif the algorithm you want to use for the resampling and so is a little less of a blunt instrument than using the raster calculator.
    • (v3.x) The -tr switch is enabled by using the Output file resolution in target georeferenced units box. For example, to downsample a 1m DEM to a 2m DEM, you can enter 2 in that field. However, there is no option to pass two different arguments for non-square pixels. Say your target pixel size is 0.3125,0.25, meaning the xres is 0.3125 and the yres is 0.25. If you now pass the value 0.3125 in that box, it will set -tr 0.3125 0.3125 in the command. To counter this limitation, simply copy the code, paste to the command line, edit the -tr flag and run. For example:

      gdalwarp -t_srs EPSG:4326 -tr 0.3125 0.25 -r near -te 71.40625 24.875 84.21875 34.375 -te_srs EPSG:4326 -of GTiff foo.tiff bar.tiff

      (depending on your instalation and environment variables, you may also need to explicitly state the path to gdalwarp).

2
  • 1
    2nd option only works in QGIS v. 2.x, the editing of GDAL commands is not available in v. 3x issues.qgis.org/issues/15090
    – reima
    Oct 26, 2018 at 11:59
  • 1
    True, sadly! However you could use gdal_warp from the commandline. With QGIS installed you will have access to that, so, while inconvenient, the second option is still available. Jan 30, 2019 at 9:09
5

I normally use the Raster Alignment tool.

It's localized in the raster tab and can be used to set rasters to the same extent too. It can also perform some operations when resampling to a new resolution (such as mean, min and max value, etc.).

Here is a link with some info on it: https://docs.qgis.org/2.18/en/docs/user_manual/working_with_raster/raster_analysis.html?highlight=raster%20alignment#id3

I use the 2.18.13 version. I don't know if the tool is available in older versions.

3
  • 1
    This doesn't seem to be working for resampling - reducing the resolution of a raster. Apr 10, 2018 at 19:09
  • strange, it worked for me last time I used. It can be a little buggy though. Apr 18, 2018 at 3:38
  • I used Warp(reproject) and it worked like a charm with aggregate and other options... Apr 19, 2018 at 19:15
3

In QGIS this can be done by using r.rsamp.interp of the GRASS toolbox. It allows for increasing or decreasing raster resolution.

This tool allows for selecting many Sampling Interpolation Methods (nearest, bilinear, bicubic). Also allows cropping or masking an image during the resampling process with the Extention of Region GRASS. To select the area for cropping it is possible to use a vector, raster, canvas view or just by selecting an area with the mouse.

1
  • thx, this is the only one I found that offers interpolation.
    – Leo
    May 20, 2021 at 6:00
0

Just another method:

  1. Convert reference raster to polygons (raster pixels to polygons tool) or create grid if you don't have one.
  2. Use zonal statistics to calculate mean or other statistics.
  3. Convert back to raster by rasterize.

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.