I am keen to compute a windowing function on values in QGIS. I was not able to find a lag/lead function. I think this could be emulated using @rownumber
and $currentfeature
, but I am not expert in using these.
I need to find a value for an attribute for a current feature. This seems to be possible using attribute($currentfeature,"fieldname")
. I am unsure how to specify something like the previous feature, equivalent to treating the list of values for an attribute in a feature collection (pseudocode):
fc[@rownumber]["fieldname"]
I could then do fc[@rownumber-offset]["fieldname"]
, assuming it evaluates to NULL for the first entry. Is there any way to do this? I am sure people computing say acceleration on trajecotry data would deal with this.
- kudos: if the answer hints at treatment of the sorting in formats that do not support this well (shapefile).