enter image description here

i know i can churn out raster statistics with r.report in GRASS GIS and QGIS, but what i want is the statistics of manually-defined categories of pixel ranges.

what i have is a clipped raster (of a single band) with a range of values that has not been classified. i only know how to categorize the pixels by going to the style tab, and what i want is a count of pixels in each category that i have defined.

to elaborate further, i about ~80,000 pixels and a maximum pixel value of ~25. i want to categorize my pixels like this:

(1) no value - pixel value range 0.0 - 1.5 (2) low value - pixel value range 1.6 - 6.5 (3) medium value - pixel value range 6.6 - 15.0 (4) high value - pixel value range 15.1 - 25.0

now i want a count of the number of pixels in each category. how do i produce that statistical report? i tried the "zonal raster statistics" tool but there's something amiss here. (See attached image for an idea of what i get with a simple r.report of my raster)

I am an amateur in GIS!

  • 1
    Perhaps you can first reclassify the raster using Reclassify by table then run r.report on the reclassified output.
    – Kazuhito
    Commented Aug 29, 2019 at 12:11
  • raster layers unique values report will generate table with stats for each unique value of the raster, which you could group and summarize in excel.
    – csk
    Commented Aug 29, 2019 at 16:35
  • "reclassify by table" does not work, i get an error message: "[Errno 13] Permission denied: u'tmp1567126975518' See log for more details" Commented Aug 30, 2019 at 1:03

1 Answer 1


You can use the Raster Calculator in QGIS to classify your raster and then use the GRASS tool r.report as you've used, or I believe r.describe to generate a report for each class. For example the snapshot below shows a Raster Calculator setup for your classes. Depending on your data it's probably best not to leave gaps in the bounds for each class too ... i.e.

Class 1: >= 0 and < 1.5

Class 2: >= 1.5 and < 6.5


See also: QGIS Raster Calculator Help

enter image description here

  • thanks for this! very comprehensive and helpful answer :-) Commented Jun 23, 2020 at 9:25

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.