TransWikia.com

Using Virtual Fields in Views in QGIS

Geographic Information Systems Asked by Sev_Zide on March 31, 2021

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?

One Answer

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?

Answered by Sev_Zide on March 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP