Use the following expression to create points at a regular interval along a line. Set the interval distance in line 1 (in my example: 80
). Line 2 is for the option you're looking for, "specify the origin": change 0
to 1
to start the creation of the points from the other side (starting from the line's end point). For this, I used the function reverse()
, together with an if()
clause (line 7).
Use the expression with Geometry Generator (for visual purpose/testing the result in realtime) or Geoemtry by Expression (for actual geometries) - see here for details.
By the way: if you want to add a start offset, in line 6 simply replace 0
by the distance you want the first point to offset. For end offset, in the same line add -100
(or whatever distance) directly after length($geometry) - before the comma.
with_variable ('interval',80, -- distance between points
with_variable ('direction',1, -- set to 1 to reverse line direction (start creating points from the line's opposite end)
collect_geometries (
array_foreach(
generate_series (0, length($geometry),@interval),
line_interpolate_point (
if(@direction=0,$geometry,reverse($geometry)),
@element)
)
)
))
The expression, used here with Geometry Generator; lines start at the left, but points are being created starting from the right because in line 2, tha variable @direction
is set to 1
: