I have a attribute table that looks like this. I want to calculate the difference in time and distance between consecutive rows.
fid car_id lng lat time
1 57 4.932413 52.372022 2018-03-04 06:21:12
2 57 4.932533 52.372323 2018-03-04 06:21:41
3 57 4.932553 52.372994 2018-03-04 06:22:22
4 57 4.932663 52.372312 2018-03-04 06:23:15
5 57 4.932333 52.372582 2018-03-04 06:24:17
6 57 4.932213 52.372693 2018-03-04 06:24:53
7 26 4.932223 52.372343 2018-03-04 06:25:11
8 26 4.932413 52.372372 2018-03-04 06:25:48
9 26 4.932103 52.372952 2018-03-04 06:26:16
10 26 4.932223 52.372912 2018-03-04 06:26:30
Eventually I would like to have something like this with distance difference in meters and difference in time in seconds. Any advice on how to do this in QGIS?
fid car_id lng lat time distance_diff time_diff
1 57 4.932413 52.372022 2018-03-04 06:21:12 0 0
2 57 4.932533 52.372323 2018-03-04 06:21:41 47 20
3 57 4.932553 52.372994 2018-03-04 06:22:22 29 41
4 57 4.932663 52.372312 2018-03-04 06:23:15 58 53
5 57 4.932333 52.372582 2018-03-04 06:24:17 46 62
6 57 4.932213 52.372693 2018-03-04 06:24:53 56 36
7 26 4.932223 52.372343 2018-03-04 06:25:11 38 18
8 26 4.932413 52.372372 2018-03-04 06:25:48 60 37
9 26 4.932103 52.372952 2018-03-04 06:26:16 21 28
10 26 4.932223 52.372912 2018-03-04 06:26:30 31 14
