QGIS – Understanding ‘Current Feature’ in Field Calculator and Expression Builder

expressionfield-calculatorqgis

I am curious about field calculator and expression builder language in QGIS.
For example, $area returns the area of the 'current feature'. Does 'current feature' refer to all features of a shapefile that is loaded in the workspace?

Best Answer

The current feature is the one you're doing the calculation for. If you e.g. selected a single feature on the layer and choose to only updated selected features, the area is only calculated for that feature. If you run the calculation for the whole layer, the area is calculated for each feature and attached as an attribute to that feature. Meaning, the value in the column area of feature 5 is the actual area of said feature, and not the area of e.g. feature 23.

Different from that, some expressions, e.g. sum(), calculate something with is not only represented by a single feature.