I have a polygon of districts (districts.shp) and a raster of rainfall (rainfall.tiff).

I want to calculate the area of each district that saw rainfall greater than various numbers.

I'd like to produce a table as follows

District    >50mm    >100mm    >150mm
District1    100km2    50km2    20km2
District2    200km2    80km2    10km2

I did use raster calculator to give me rasters of 0s and 1s when this was true. But I think this is cumbersome, and I'm not sure of the next step. I think zonal statistics is one way to go.

  • 1
    The next step (using your 0s and 1s raster) might be zonal stats to get the sum in each polygon. Sum should represent the number of pixels that were 1s in each polygon. And if you know the area of a pixel in your raster, then you can get to your answer. – davemfish May 13 at 15:11

One possible approach would be-

  1. Reclassify your rainfall raster into integer (0, 1, 2, 3, ...)
  2. Calculate statistics or count the cells per each polygon.

For example:

(1) Reclassify by table tool (in Processing Toolbox > Raster analysis)

  • Use your rainfall threshold values (50, 100, 150mm) as maximum value in the Reclassification table.

  • Make sure your maximum value in the last line (> 150mm) is large enough to capture the real max in your rainfall raster.

  • Range boundaries settings would be min < value <= max.
  • Select Byte as output data type.
  • This will produce a new integer raster (default name is Reclassified raster).

enter image description here

(2) Zonal histogram tool (in Processing Toolbox > Raster analysis)

  • This tool will calculate the histogram, and add the Cell Counts for each class (which means each unique cell value) per each polygon
  • HISTO_1 is the number of 1 cells (or, 50 < original value <= 100) found in the polygon.
  • Using the Field Calculator, multiply each histogram (HISTO_1, HISTO_2, ...) by the pixel size to get the total area.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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