I'm trying to summarize some information in a map layout in QGIS controlled by an atlas. I have parks, and connected to that I have objects within these park (points, lines and polygons).

I want a list of all objects in the park (the specific one in the atlas window) on my layout and also some summary-statistics (e.g. the entire area of all polygon objects in my park).

So far, I've created a virtual layer combining all objects per park and use that virtual layer as a relational child to the park to display those objects with my atlas function. The same I did with a 'summary-virtual-table'.

Now the problem: if the area of one of the polygon-objects change, I'd usually work with a virtual field, so changes in the geometry automatically reflect in the 'area' column. But virtual fields can't be used in virtual layers, as far as I understand. So, with static fields I'd need to recalculate the area every time something changes and then also recreate the virtual layer.

Is there another way to deal with this, I might not be aware of?

  • 1
    I'm not 100% sure what you're trying to do, in particular, why do you need PostgreSQL(?) views vs just using relations and joins within QGIS itself. However, could you bypass your problem using QGIS expressions in your layout? In particular, aggregate functions (see docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/…). Probably not as elegant but may get you what you need faster than debugging how different relational flavours interact in QGIS' data architecture.
    – Houska
    Mar 1, 2021 at 14:57
  • Thank you for the hint. I didn't think of aggregate functions and they do allow me to calculate some summary statistics for the objects in the atlas. What i could not figure out yet, is how to get a nice table, summing it all up for only the types found in the current atlas feature. That is what I wanted the view or virtual layer for. Also, i'm afraid that the aggregate functions don't work with virtual fields(?).
    – Zev_Zide
    Mar 2, 2021 at 8:16

1 Answer 1


So, the answer was much closer than expected. For automatically updating fields of e.g. area just go to layerproperties -> Attributes Form -> choose your attribute (e.g. area) and set a default value (e.g. $area) and 'apply default value on update'. These values can now be used in any aggregate function or can be used in virtual layers. unlike virtual fields, where it seems not to be possible.

How to set a default value for attributes in shapefiles in QGIS?

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.