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.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.

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
Matt Greer
  • 53
  • 5

1 Answers1

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.

hgb
  • 1,174
  • 7
  • 11
  • 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 Apr 20 '22 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 Apr 20 '22 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 Apr 20 '22 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 Apr 20 '22 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? https://gis.stackexchange.com/a/414380/110158 – hgb Apr 20 '22 at 21:54
  • Your solution works! Only one issue that I don't know how to resolve (I'll start another post for this), according to the Topology Checker Panel (and confirmed by a 3rd party program into which I'm importing the shapefile) the line that was extended has a 'dangling end'. I have to figure out how to resolve that. I'll start a new thread. In the meantime, thank you for your help! – Matt Greer Oct 12 '23 at 15:29