[GIS] Combining points and their values within the same cell in QGIS

fields-attributespoint-in-polygonqgisshapefilesummarizing

I have two shapafiles: points and vector grid. I need to combine points which are in the same cell(or cross cell) and sum their values. How can I do this in QGIS?

Best Answer

Since QGIS 3.18 using the array_sum() function, you can use the following expression on the grid layer to calculate the sum of the value attribute from all points that are within a grid-cell automatically:

array_sum(overlay_contains('points', value))

Screenshot: the expression (together with to_int to get integer values) calculates the blue value for each grid cell: sum of the values of all red points within this cell:

enter image description here