Calculating mean value of polygons based on attributes of point layer in QGIS

calculate-valuesmeanpoint-in-polygonqgis

I am working with QGIS to compute the annual burned area of my study area in Chile. I have two different layers.

  • One polygon layer which is a 1km x 1km grid of my study area. The only information this layer contains is a unique "id" for every grid cell.
  • The second layer is a point layer of fires. It contains information about the size, direction and duration of the fire. Every point is one fire. Multiple points (fires) can lie within a grid cell.

I now want to compute the average size of fires in each grid cell. How can that be accomplished?

Best Answer

This is an example trying to mimic your situation. Please modify layernames and field names according to your project.

enter image description here

Above figure shows two layers: Fire point layer with size field, and Grid layer with id field only.

Start Field Calculator on the Grid layer, and give this expression:

array_mean(overlay_contains('Fire', expression:= "size"))

enter image description here

It will return averaged fire size. (It returns null where you do not have any fire).

enter image description here