Is there a function in QGIS that will tabulate zonal statistics by vector category?

In ArcGIS, this can be done using Zonal Statistics as Table, but it looks like the QGIS Zonal Statistics function simply appends to the attribute table. The question here QGIS equivalent to the ArcMap Zonal Statistics as Table is similar, but is asking about cell counts for raster values, whereas I am interested in average and standard deviation.

  • Can be done with 2-3 lines of code with rasterstats if you are open to a python solution – BERA Sep 13 at 12:09

You can extract the count, mean, standard deviation, minimum, and maximum cell values of a raster layer within vector zonal layer using Orfeo toolbox (OTB) plugin. Although the output will be another vector layer, but you can export it as table as you like, it is easy.

Please note that OTB processing tools are not provided by QGIS installation, only the plugin is in the core of QGIS if you have QGIS version > 3.8. Please have a look at the installation process in the link above.

In OTB toolbox, and under Image Manipulation tools, there is a ZonalStatistics tool that do exactly what you want.

In the following example, the DEM is in a raster format, which I want to extract the mean and standard deviation under each red boundary zone. The output information is stored in the green output vector data.

Here is an illustration of the input and output data

enter image description here

| improve this answer | |

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.