I have a vector layer which includes the acreage of the different features, I want to calculate the sum acreage of all polygons with
Parcel size >400 acres
Parcel size <100acres
Parcel size >100acres
Parcel size > 1000acres
I have a vector layer which includes the acreage of the different features, I want to calculate the sum acreage of all polygons with
Parcel size >400 acres
Parcel size <100acres
Parcel size >100acres
Parcel size > 1000acres
You can categorise your features using a field calculator expression such as this (in this case the output field is called size_range
):
case
when acres <= 100 then 'lte_100'
when acres > 100 and acres <= 400 then 'gt_100_and_lte_400'
when acres > 400 and acres <= 1000 then 'gt_400_and_lte_1000'
when acres > 1000 then 'gt_1000'
end
And then use the Statistics by categories tool:
Use aggregate function array_agg()
with a filter, where area
is the attribute field where the parcel size of each polygon is stored:
array_sum (array_agg (area, filter:="area" < 100))
To get all four values at once as an array, use this expression:
array_foreach(
array ('<100','>100','>400','>1000'),
eval ('array_sum (array_agg (area, filter:= area' || @element || '))')
)
The expression, added with a round()
function, shows the four sums in the preview: