I would like to create a virtual layer that creates polygons and make some raster zonal statistics in the geometry of these polygons. The aim is to use the polygons geometry to analyze pixel values of the raster band 1 value.
The original layer polygon is named source_polygons The raster that should be analyzed is named source_raster
The virtual layer should create polygons from source_polygons and add some rows:
- min : the minimum pixel value inside the geometry of source_polygons from source_raster band 1
- max : the maximal pixel value inside the geometry of source_polygons from source_raster band 1
- average : the average of pixel values inside the geometry of source_polygons from source_raster band 1
EDIT: I first tried to use virtual field, in order to do raster statistic into my polygons geometry, but I only found 2 options:
- raster_value : which retrieve 1 value for 1 point (and my need a to retrieve values of several pixels into a polygon)
- raster_statistic : which perfom statistic for the whole raster, and doesn't matter of the geometry of my polygons : it results the same result value in fields of my entities.
I wonder if it possible to perform raster zonal analyze using virtual layer?