I would like to be able to cut polygons such as the one below, in QGIS, at a set distance either side of a specified feature on another layer, in this case a footpath line from OS Mastermap.

In this way I would then effectively have a buffer along the lines that could represent a woodland ride network, for example. In this case it is a very simple linear feature, but they are often much more complex, and can be very time-consuming to cut out. Ideally I need to retain the original polygon as this will be used as well.

Is it possible to cut a polygon in this way, or would I have to create the new polygons as buffers along the line and then cut these from the existing polygon?

Screengrab of polygon to be cut

3 Answers 3


You will need to buffer the selected line (path) at the distance you require and then cut those out of the other polygon using difference.

If it was an operation you needed to do very often then it would be worth writing a python script to carry out both operations together.

  • Thanks iant, I thought that might be the case. I do have to do it pretty regularly but I don't really know where to start with writing script, beyond just basic queries. Would it be fairly straight-forward do you think?
    – JimS-W
    Sep 19, 2017 at 13:07
  • I have been attempting to repeat this operation using the expression difference($geometry, buffer(geom_from_wkt(geomintersects( 'Your_LineLayerName', '$geometry')), 20)) , in QGIS 3.2.1, but it no longer seems to work. It either returns the error "Eval Error: 'QgsGeometry' object has no attribute 'exportToWkt'", or just tells me the layer I am trying to cut with doesn't exist. Any suggestions @Kazuhito? I have installed the refFunctions plugin.
    – JimS-W
    Jul 25, 2018 at 9:33
  • Please ask a new question rather than use a comment
    – Ian Turton
    Jul 25, 2018 at 11:44
  • Will do @Ian Turton. I've found the Enable tracing - > offset function covers most of what I need to do now in any case.
    – JimS-W
    Jul 26, 2018 at 10:38

In this workflow you will need refFunctions plugin, to use geomintersects().

  1. Open attribute table of your Polygon layer.
  2. Activate Field Calculator.
  3. Tick on Update existing field and select <geometry>from the pull-down menu.
  4. Provide this expression: difference($geometry, buffer(geom_from_wkt(geomintersects( 'Your_LineLayerName', '$geometry')), 20))

Please modify Your_LineLayerName which is your (path) layer, and 20 (buffer size) as required.

NB. Since the change is made instantly and irreversible, please be careful and keep a copy of your original Polygon file.

  • 1
    Thanks Kazuhito, that works great, but it seems to cut AND remove the buffered line out of the existing polygon - is it possible to retain it instead as a new polygon?
    – JimS-W
    Sep 20, 2017 at 17:12
  • @JimS-W If you use intersection() instead of difference(), it will give you the buffered part. But I am afraid it does not help you to obtain both geometries (difference and intersection) in single action.
    – Kazuhito
    Sep 20, 2017 at 17:21
  • 1
    That's fine, I should be able to get what I need by combining the 2 in a scratch layer I think. Thanks again
    – JimS-W
    Sep 20, 2017 at 17:34

In newer versions of QGIS (I'm using 3.2.1) it's now possible to do this much more quickly and easily using the 'Offset' function within the Snapping Toolbar (from the drop-down menu next to 'Enable Tracing'):

enter image description here

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.