2

I'm attempting to perform a 'Join Attribute by Location (Summary)' between two polygon layers where I calculate the sum of a given field in the join layer using the 'Intersect' predicate. The process however seems extremely slow and it actually seems to be slowing down with time to the point of it being unusable.

The input layer has a feature count of 1,907,160 and the join layer has a feature count of 6,042,342. A sample visualization is given below (input layer are the brown rectangles):

Polygon layers to be joined

Both layers have spatial indexes created. Wondering if there's a way to speed up the process. I've also added the current log file below:

Log

1 Answer 1

1

Probably joining and creating the sum at once is too much for such large layers. Split up the process: 1) join 2) sum.

An alternative would be using this expression - however, I fear that you will hit the same limits:

array_sum(overlay_intersects ('building', value))

So first select the grid cells that have an intersection from the other layer (I call it buildings) with Select by expression and this expression: overlay_intersects ('building'). Try running Join Attribute by Location (Summary) for the selected features only.

Otherwise, create a new field called list that returns a list of the values from the overlapping polygons: overlay_intersects ('building', value) and use datatype: Decimal (real) list. In the last step, create another field to create the sum: array_sum(list).

However, consider that if a building overlaps more then one cell, its value will be calculated several times for each cell as can be seen in this screenshot:

enter image description here

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.