6

I would like to create a specific amount of points along a line in QGIS. The lines are in different lengths, but I want them with a maximum of 50 points (divide by 50). The tools i've found in QGIS are able to place points in a specific distance along a line or geometry.

2 Answers 2

9

Try the "Points along geometry" tool by changing the 'Distance' to $length/50.

result

8

You can create points with Geometry generator or Geometry by expression (see here how to do that) using this expression. In line 3, change 20 to set the number of points you want to create per line:

with_variable (
    'no',
    20,
    collect_geometries (
        array_foreach (
            generate_series (0,@no-1,1),
            line_interpolate_point( 
                $geometry, 
                length($geometry) / @no * @element 
                + length($geometry) / @no / 2
))))

Points are distributed evenly along each line with the same distance from start- and end-point of the line. Delete the second last line (from + to 2) to get the first point on the start-point of the line.

Screenshot, showing the variant using Geometry generator - create 20 points per line:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.