7

I have a line and I want to mark regular intervals along the line (every 10 m)

I am able to display these intervals by showing it as a marker line, and choosing "with interval" for the marker placement and selecting meters at scale enter image description here

However, I want to be able to extract coordinates for these intervals. Is there any way to turn the markers from the marker line into vertices or a points layer? I am running QGIS 3.22.13

2 Answers 2

10

You can use the processing alogrithm point along geometry

enter image description here

Or if you want to use the geometry generator, either as a style or as an expression for creating a new layer, you can use the following:

collect_geometries(
 array_foreach( 
   generate_series(0, length($geometry), 10), 
   line_interpolate_point(
      $geometry,
      @element)))

collect_geometries --> make a multi-point from an array of points
array_foreach --> for each 10 meters, as computed in the next line
generate_series(0, length($geometry), 10) --> write a list of distances from 0 to the line length with an increment of 10 (meters)
line_interpolate_point($geometry, @element) --> create a point along the original line, at each computed distance

enter image description here

2
  • This is exactly what I needed, thanks!
    – Nicole
    Dec 15, 2022 at 21:16
  • Don't forget to upvote and mark the answer as correct if it solved your problem (the check mark to the left of the answer). It rewards the answerer and helps future readers of your question locate the solution.
    – Matt
    Dec 15, 2022 at 22:05
7

No need to define a style. You can use Densify by Interval and Extract Vertices tools respectively.

  • Densify by Interval:

    enter image description here

  • Extract Vertices:

    enter image description here

1
  • 1
    Thanks, this is close to what I need but not quite. Densify adds vertices but the interval is maximum 10, not exactly 10, so the distance ends up being ~9.3m between vertices. I need to make the vertices exactly 10 m apart (obviously the last one will be shorter if the line length is not divisible by 10)
    – Nicole
    Dec 15, 2022 at 19:31

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.