17

In QGIS I want to create perpendicular Lines on another Line (River). The Lines should be created on points on the Line and should have a length of 40 Meters. I want to create the red lines in the picture below (for the complete River).

This is what I mean

11
  • 2
    Is this a display issue, or do you need the line geometry?
    – Erik
    Commented Nov 27, 2020 at 9:06
  • 2
    I need the geometry. Commented Nov 27, 2020 at 10:08
  • 3
    The points are distributed on the line with a constant distance? Then I suggest you use GRASS GIS plug-in ''v.transects" , grass.osgeo.org/grass78/manuals/addons/v.transects.html
    – MarcM
    Commented Nov 27, 2020 at 10:47
  • 1
    Updated my answer to create geometries
    – Babel
    Commented Nov 27, 2020 at 12:03
  • 2
    @MarcM: v.transects is not available in QGIS, at least not in my installation QGIS 3.16.0 with GRASS 7.8.4. on Win10. So it can't be done from QGIS
    – Babel
    Commented Nov 27, 2020 at 12:09

4 Answers 4

23

Edited answer: My first solution (see below) was for visualisation purposes only. But as you mentioned afterwards, you need the actual geometry. So this here is how to do it:

Go to Menu Processing / Toolbox / Create points along input lines to create points on the line in a set distance - as I can see in your screenshot, the points should have a distance of 100 meters along the line, so set the distance to 100. This creates a new pointslayer interpolated points with an attribute angle that you can use to create perpendicular lines.

As you need it as an actual geometry, use Menu Processing / Toolbox / Gemoetry by expression and set the layer interpolated points as input, geometry type as line and introduce the following expression

extend(
   make_line(
      $geometry,
       project (
          $geometry, 
          40, 
          radians("angle"-90))
        ),
   40,
   0
)

This will add an additional lines layer with the perpendicular lines:

enter image description here

This here is the first solution that does not create new geometries, but is good for visualisation purposes:

Add an additional symbol layer to your line and define it as simple marker, selecting the symbol and size as shown in the screenshot:

enter image description here

In this example, I have created a marker on every vertex. If you need a marker in a regular distance along the line, just make the settings accordingly as shown in the second screenshot (the settings in the red box; the arrow shows where to check for the first solution, every vertex):

enter image description here

8
  • 3
    I think he needs the geometry, not the visuals
    – MarcM
    Commented Nov 27, 2020 at 10:43
  • Thank you so much for this detailed Answer and for your Time! I am sorry that my question was a little bit missleading, I am not pretty good in English. I should have just written to you in German :) Commented Nov 27, 2020 at 12:37
  • At least my german screenshots were not a probem dor you. Consider accepting this answer if it was useful
    – Babel
    Commented Nov 27, 2020 at 12:42
  • Hi where is the algorithm 'Create points along input lines'? Commented Mar 9, 2022 at 8:49
  • I followed the steps and used the same query, but the perpendicular lines created are crossing the polygon and extending far beyond it, resulting in a huge line outside the polygon. Could you help me rewrite the query
    – Bruno B
    Commented Sep 18 at 13:34
11

There are many ways to solve your problem and one of them is the next:

Input data: 1) river_line layer 2) interpolated points after 100 m, see figure below

enter image description here

Figure 1

Action 1 - launch the geo tool "Points along geometry" with a point offset of 50 m as shown in the figure below

enter image description here

Figure 2

The result is shown in the figure below

enter image description here Figure 3

Action 2, 3 - launch the "PointToPath" geo tool see the figure below

enter image description here

Figure 4

then run the geo tool "ExplodeLines" see the figure below

enter image description here

Figure 5

Action 4 run the geo tool "Rotate" see the picture below

enter image description here

Figure 6

Rezult see the picture below

enter image description here

Figure 7

Action 5 start geo tool "Buffer" on "river_line" layer with distance of 40 m see illustration below

enter image description here

Figure 8

Rezult in the figure below

enter image description here

Figure 9

Action 6 Cut perpendicular lines with the buffer

The result is shown in the figure below

enter image description here

Figure 10

See the figure below for the intermediate result.

enter image description here

Figure 11

Further, in order to close the beginning and the end, you need to lengthen the line in both directions, leave only the outermost segments, turn them 90 degrees, cut and add to the result see Figure 11.

Good luck in knowing about geodata processing :-)....

If necessary, ask clarifying questions on the subject of your question, I hope that I can clarify them...

2
  • 1
    amazing pure QGIS method. I was trying to find a way to do this because SAGA has been dropped from latest installations and I used to use "Cross Profiles".. thank you!
    – Derek Eden
    Commented Mar 20 at 23:18
  • I'm glad this method has helped you and others..... Commented Mar 21 at 17:08
5

I first used the geotool "Points along geometry" first and then with the points with the geo tool geometry by expresion I selected the new point layer that I created and I used the next expression:

make_line(project(make_point($x,$y),50,radians("angle"+90)),project(make_point($x,$y),50,radians("angle"-90)))

I put 50 as half of the distance of the perpendicular lines, If you need a different distance you have to change that value.

4

A couple of years later, but the function Vector Geometry --> Transects does just that at the points. In my case, I had the points, but needed the azimuth perpendicular to the line that joined them. So, I did points-to-path and then Tansects.

2
  • I knew there was a built-in function I was missing.. couldn't remember the name
    – Derek Eden
    Commented Apr 4 at 18:44
  • I followed the steps and used the same query, but the perpendicular lines created are crossing the polygon and extending far beyond it, resulting in a huge line outside the polygon. Could you help me rewrite the query
    – Bruno B
    Commented Sep 18 at 13:33

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.