TransWikia.com

In QGIS my expression aggregation in attribute forms slow works

Geographic Information Systems Asked by Andrey Sirbu on June 24, 2021

There are two layers: Parcels and Parking.
In parking has attribute: parcels_objects, this is lists of parcels intersect of parking.
When I create a parking object, I want to calculate all parcels containing parking lots and write a list of their numbers to the parcels_objects parking field attribute.
To do this, in the attribute forms for the parcels_objects field, I created an aggregate expression in default value:

aggregate(
    layer:='Parcels',
    aggregate:='concatenate', 
    expression:="parcel_number", 
    concatenator:=', ', 
    filter:=intersects($geometry,geometry(@parent))
)

This expression works, but it is very slow because (6 seconds before opening the attribute form) there are 50,000 objects in the parcel layer.

Spatial index was created in both tables:

CREATE INDEX parcels_sx ON public.parcels USING gist (geom);
CREATE INDEX parking_sx ON public.parking USING gist (geom);

Dividing workflows into 2 different ones will speed up the assignment of the parcels_objects attribute, for example:

  1. create objects first
  2. call the process of assigning parcel numbers

But the idea is that the business process of entering information was continuous, for example:

  1. the graphic object is created
  2. all the attribute data for the current object are filled in (some attributes are filled in automatically) with the possibility of correction.

The virtual field in my case is not entirely suitable, since I want to calculate the parcels_objects with each edit.

Form opening slowdown occurs when the option is checked: Apply default value on update:
aggregate in the attribute forms
How can you make this expression run faster?

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