2

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.sstatic.net/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.

3
  • 1
    Did you check "Extend lines" tool in "Processing toolbox > Vector geometry"? Commented Apr 19, 2022 at 0:02
  • 1
    You did you make the layer editable before trying to edit it? Commented Apr 19, 2022 at 0:06
  • Thanks for the reply. I recorded me trying to drag the line over. Perhaps you can tell me where I should click or how to go about doing this. Much appreciated! youtu.be/gaxy-Jy6M6M
    – Matt Greer
    Commented Apr 19, 2022 at 20:20

1 Answer 1

2

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.

6
  • OK, I followed your instructions. When I got to #5, I attempted to click on the line to extend. I got the error message just under the toolbar "Trim/Extend feature: Couldn't trim or extend the feature." I appreciate the link to the documentation. I am reading that now to see what I might have missed/done wrong.
    – Matt Greer
    Commented Apr 20, 2022 at 16:32
  • 1
    Other than the simple checks (editing on, layer selected, snapping on for the layer), the only hint I see in the code that might cause the "couldn't trim or extend the feature" error is that perhaps the line doesn't intersect if you are dealing with 3D geometries. Do your geometries have Z values?
    – hgb
    Commented Apr 20, 2022 at 19:37
  • So, these are shapefiles imported from ESRI of a pipeline network. As far as I can tell, the z values are zero. In the vertex editor, I see x, y, and z. z's are all zeros.
    – Matt Greer
    Commented Apr 20, 2022 at 21:26
  • I swear, I'd be more than willing to have a zoom session and let y'all look at this...
    – Matt Greer
    Commented Apr 20, 2022 at 21:26
  • No need. I believe what you are reporting. Perhaps a bug in the QGIS trim/extend handling of geometries with Z values, even if all zeroes? Could you create a copy of the layer without the Z values and try to trim/extend those? gis.stackexchange.com/a/414380/110158
    – hgb
    Commented Apr 20, 2022 at 21:54

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.