QGIS – How to Extend a Line to Intersect Another Line

extendqgisshapefile

I've received shapefiles for import into a pipeline modeling program. One of the issues I have is that after the shapefiles are imported, close examination shows that pipelines that should have connected in the software do not. I used QGIS to take a closer look and it appears that these issues stem from the lines not connecting in the shapefile.

Here's a close-up of one of those instances: https://i.stack.imgur.com/Yr73I.jpg

I've found some references on the web on how to extend that horizontal line to connect to the vertical line but no matter what I do I can't seem to be able to follow these references. Either I don't know the button or action they're referring to, or their interface is different than mine and I can't follow, etc. etc. etc. Of course, the crux of the problem is I am very much a novice with this software.

This video shows exactly what to do, but, I can't repeat the actions. Like, I click on something and nothing happens. I think I've found the right button/option to use and again, nothing happens. I'm quite lost!

Other references I've found but have been unable to follow/understand:

For reference, I'm using QGIS v3.22.0-Biatowieża.

Best Answer

Documentation for Trim/Extend tool is here.

The tool asks you to select a limit (a segment) with respect to which another segment will be extended or trimmed.

Important points:

  1. Turn on segment snapping.
  2. Turn on editing for the layer.
  3. Select the trim/extend tool.
  4. Important click on the line segment you want to extend to first ("target segment" or, in the documentation, the "limit" segment). The line segment you are going to extend to will turn red.
  5. Then click on the line that is to be extended. It will snap to the target segment (or as close as possible if an extension of the extend segment won't actually intersect the target segment).

In the video you linked, you were going wrong at step 4. Do not start by selecting the line you want to extend.

I also found selecting the line you want to extend to ("the limit") before the segment to be extended counter-intuitive. I needed to read the documentation before getting this to work.