QGIS – How to Calculate Average Elevation Within Radius and Apply to Grid Cell

buffergrids-graticulesqgisstatisticszonal statistics

I have two layers in QGIS: a raster layer containing elevation, and a grid cell layer (polygon) containing 1km by 1km squares.

I am trying to create a new layer where the elevation of each 1km by 1km grid cell area is the averaged elevation from a 15km radius around itself.

I have tried to use the zonal statistics tool to calculate the mean elevation of each cell based on the elevation in the raster layer. But this method doesn't give a way of making the average include the 15km radius around the cell, only the cell itself.

I have also tried to create 15km radius circle buffers around the centre of each grid cell, but I am not sure how to calculate the area of each buffer circle and then apply it to the grid cell.

Best Answer

If I understand the question correctly, here's one approach that should work.

  1. Convert the raster to points using Raster pixels to points
  2. Buffer the points by 15km using Buffer
  3. Calculate zonal statistics (mean) using Zonal Statistics using the buffer from (2) and the elevation raster
  4. Convert the zonal statistics (which will be polygons, like the buffers) back to points using Centroids
  5. Rasterize the points using GDAL Rasterize (vector to raster)

For this last step, you will need to set the vertical and horizontal resolutions to the size of the original grid (1000m) and the output extent to the extent of the original grid.

enter image description here

Related Question