I have a polygon and transect lines which passes inside the polygon. enter image description here

Here I want to select the lines which touch the drainage and divide. The transect lines split at the river intersection.

enter image description here

Since all the transect lines lies inside the polygon the intersection selection selects most of the unwanted features. Is there any tool that I can use to automatically perform to get similar results?

  • I would like to think of it as the line that touches the river and boundary of a watershed. Considering longest will give me error while applying this elsewhere. Commented Apr 24, 2021 at 6:31
  • In the second figure, I have selected the lines which I needed(yellow). I am not considering the length of the line. Thank you Commented Apr 24, 2021 at 7:05

1 Answer 1


If you want to create this sort of thing, then there is a way. I am assuming you have already broken the transects at the river. Looks like you have.

enter image description here

  1. Convert the watershed polygon to a line. This creates a polyline boundary. You can use Vector - Geometry - Polygons to Lines

  2. Vector - Geoprocessing Tools - Buffer the boundary by a small amount so that the transects definitely cross the boundary. This creates a polygon watershed boundary. If you are using lat/long , a 'small amount is about 0.001 degrees or so. Zooming in, you can see that the transect terminates in the buffer.

    enter image description here

  3. Make sure there is a unique field (eg integer field called "MY_ID") in the buffered watershed boundary (important :-). If you only have one watershed boundary, you can set MY_ID=0 in the attribute table.

  4. Select your transects layer (which has already been broken at the river)

  5. Go to Vector - Data Management Tools - Join Attributes by Location and bring up the dialog:

    enter image description here

  • The base layer contains the transects.
  • The join layer has the buffered watershed boundary.
  • select intersection for the join

==> execute!

  1. A layer called Joined Layer is created. Open its Attribute Table. You can see that there is a new attribute field based on the MY_ID field you created in the buffered watershed boundary polygon layer. Half of the values have information. Half are NULL. You can :
  • Style this new layer to highlight the non_NULL joined transects
  • set it via layer query.
  • delete the others.

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.