I first thought this question was basically same as another recent question Points layer distance from the start of line layer in QGIS.
However, there is an added complexity in this one, that OP requires distance between (not a distance from the start point).
So I needed QGIS 3.0 get_feature_by_id()
function to calculate the difference between records.
(1) Calculate the distance of each point along the line, from the start point of the line.
Please see Points layer distance from the start of line layer in QGIS
(2) Calculate distance between points, based on the distance
taken from previous step (1).
Again, open the attribute table of Points
layer, which has distance
field.
Create a new field interval
by the below expression:
attribute(get_feature_by_id('Points', $id+1), 'distance')
- attribute(get_feature_by_id('Points', $id), 'distance')
This expression calculates the difference between points by (value at next row
minus value at current row
).
NB: The $id
is unrelated to id
field shown in the picture. Sorry if it is confusing.