QGIS – Line Across Polygon Not Cutting the Polygon

linepolygon-creationqgis

I'm trying to divide up polygons in QGIS with a line I've assembled from a variety of constituent parts. The line has been successfully merged into a single object, and as far as I can tell is a continuous single line from end to end. Unfortunately, some of the polygons it's drawn across simply do not respond when using the 'cut with line' tool – nothing happens to them at all.

What could be going on here?

Some of the original parts had gaps between them, but I went in and manually altered all the ones I could find so that each segment of the final line crossed over the previous and next segments. Those crossed segments have resolved into smooth connections as part of the line merge process. The line does extend past the edges of every polygon it's drawn across.

I can provide both the line and the polygon data if that would be helpful.

Best Answer

The line you provided here (I guess you're asking about this one) is very messy as you "assembled from a variety of constituent parts". So after trying different approaches, I found a way to easily create a valid line that you can use to split polygons.

  1. Buffer the line with a (very) small distance (I used a distance of 0.0001 as your layer units are degrees) - be sure to dissolve the buffer: Menu Vector / Geoprocessing Tools / Buffer.

  2. Convert Polygons to lines: Menu Vector / Geometry tools / Polygons to lines

  3. Manually split this line at the two ends with the Split Features tool enter image description here

  4. Delete either the left or the right hand side of the line and merge the remainig parts.

You are left with a valid line you can use to split. You can download the line I created in this way from here.

As we used a buffer, the resulting line is about 10 to 12 meters away from the initial line. If you need more precision, simply use a smaller buffer-size in step 1. Consider to reproject the line first to a projected CRS so that you can buffer using meters as unit.

Using the line to split the US and Canada with the built-in dataset in QGIS, I get this result (western part of Canada and eastern part of US selected/hightlighted in yellow):

enter image description here