4

This question already has an answer here:

I have what seems like a simple question, but I haven't been able to find the answer in the QGIS documentation.

I have a raster that is 250 m resolution, and I want to resample it to 1000 m resolution. This means that for every 16 pixels in my original raster, I will have 1 pixel in my new raster. I would like to retain the mode (most frequent value) of the 16 pixels.

Based on the suggestion from Radim here, I am using this approach:

  1. Load raster into QGIS

  2. Right click on layer name, select 'Save as'

  3. Change the resolution in the dialog box from 250 to 1000: Save as dialog box

However, I haven't been able to figure out what technique is used to go from 16 cells (at my original resolution) to 1 cell (at my new resolution). Based on inspecting some specific pixels, it doesn't appear to be either the mean or the mode.

(Note: I would like to use the mode, so if anyone has a better technique, I am all ears)

marked as duplicate by Ian Turton Aug 9 at 12:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    I would use gdalwarp with options -tr 1000 1000 and -r mode gdal.org/gdalwarp.html. Or gdal_translate with the same options -tr 1000 1000 -r mode gdal.org/gdal_translate.html. Perhaps you should make a feature request about adding selection of resampling method to QGIS. – user30184 Sep 2 '16 at 13:50
3

I would probably suggest using the GRASS tool r.resamp.stats which:

"Resamples raster map layers to a coarser grid using aggregation."

Here you can choose an Aggregation method (mode) and set the required cell size. You can access this from:

Processing Toolbox > GRASS commands > Raster (r.*) > r.resamp.stats
  • 1
    Thanks, @Joseph! I actually haven't been able to get this to work due to something that seems unrelated going on with my GRASS, but it seems like it should do the job so I'll go ahead and accept it. I'm still curious if anyone out there knows the answer to the 'Save as' method question, though! – Sam Zipper Sep 12 '16 at 16:50
  • 1
    @SamZipper - Most welcome, hope you get your software up and running! I think if you want to use the Save As... method, you might need to make use of Pyramids which allows you to use a Resampling method such as Mode. – Joseph Sep 13 '16 at 9:27
  • I also would like to know the method used in the 'Save as' option. Anyone knows? – Daniel Jan 9 '17 at 13:16
  • @Daniel - You can always ask a new question and include a link to this question to show you did some research. You should also mention that you're only interested in the Save As... method =) – Joseph Jan 9 '17 at 13:22
  • 1
    @Joseph - OK, posting a new question. Did not do it before because I did not want to create a duplicate – Daniel Jan 9 '17 at 14:02

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