5

I have a polygon which represents a water catchment. I also have a polygon that represents a national boundary. I would like to cut out a line that represents only the part of the catchment boundary that goes across the country. In GIS terms, this means I would like to cut out a line from a polygon between two points that I define. I would like the right hand part of the green polygon extracted as a line.

enter image description here

Can anyone direct me to a tool that would allow me to do this simply please? I haven't managed to find a toolbox or tool or plugin that seems to do this.

Taras
  • 32,823
  • 4
  • 66
  • 137
Michael Hammond
  • 345
  • 1
  • 8

2 Answers2

4

If you have a country- and a catchment-polygon, you can use QGIS expressions with Geometry generator or Geometry by expression to create the part of the catchment's boundary inside the country. Use this expression (replace 'country' with the name of your country-layer):

intersection (
    boundary ($geometry), 
    geometry (
        get_feature_by_id (
            'country', 
            1
)))

Screenshot: the expression in action, here with Geometry generator. It creates the red line (blue catchment; orange: country): enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
4

Manually, you can do it with the tools of the snapping tools bar. First, you have to activate snapping and choosing "advanced configuration" like below The option "Enable tracing" will made the job with only two (or many three) mouse-clik. enter image description here

enter image description here

Christophe P.
  • 2,175
  • 11
  • 22
  • Thanks for this. However, I am struggling somewhat to get the line to trace all the points in between. I am snapping at various vertices, but it doesn't automatically create the line for all the vertices in between. Does that make sense? – Michael Hammond Jul 13 '21 at 09:57
  • Normally, yes it must automatically create the line for all the vertices in between. In the exemple I made only one click to define the start point and one click for the end of the line. The tools enable tracing follow the border. Do you have activated/checked the two polygons in the "projet snapping Settings" and then choose "vertex, Segment"? – Christophe P. Jul 13 '21 at 11:31
  • 2
    @MichaelHammond snapping tends to get tricky when there are too many vertices available - try deactivating unnecessary layers and/or zooming in. – Erik Jul 13 '21 at 13:50
  • Thanks, this solved my problem. Thanks for the help – Michael Hammond Jul 13 '21 at 14:44