I have a "Phenomenon" table, listing the location (Province, or admin level 3 in this case) of where a certain phenomenon was observed. I would like to return the centroid geometry from a Provinces polygon layer to this Phenomenon table using a QGIS aggregate function.
I have standardized columns with shared PCodes (admin3Pcode OR adm3Pcode) between Provinces and Phenomenon tables.
I am not getting any output from the following aggregate function and I don't understand why.
aggregate(
layer:= 'adm3_polys',
aggregate:='array_agg',
expression:=geom_to_wkt(centroid(@geometry)),
filter:='adm3Pcode'= attribute(@parent, 'admin3Pcode')
)
filter:="adm3Pcode"= attribute(@parent, 'admin3Pcode')
. Single quote is used to define a constant string, double quoting refers to a field.aggregate( layer:= ''adm3_polys'', aggregate:=collect(centroid($geometry)), expression:=(centroid($geometry)), filter:="admin3Pcode"=attribute(@parent,"admin3Pcode"))