I have a line layer and a polygon layer. Both files have the same SRS. I want in a new shape file only the lines covered by the polygons.

I tried in QGIS the Vector -> Geoprocessing -> Clip tool but I only get an empty shapefile.

How do I do this with QGIS?

enter image description here


4 Answers 4


Use the Vector -> Geoprocessing -> Clip tool

Input is your roads layer, clip layer is the polygon layer.

enter image description here

Put the line's layer in "input vector layer" and the polygon's layer in "Clip layer"


This gave me endless hours of frustration, and the above answers (even the ones in the comments) didn't work for me either, but I found my own solution that did the trick.

It turns out that to do an intersection or a clip between two layers, they must be saved on disk with the same CRS. So even if they look like they overlap in QGIS, it may be doing it's own "On the Fly" transformation to align them.

To fix this, do this for each layer:

  1. Right click, Save as...
  2. Set the format to ESRI Shapefile, pick a file name, and pick a CRS that you will use for all the layers. Click OK to save, and load that file.
  3. Repeat for the other layer, selecting the same CRS.
  4. Use the clip tool with the new layers. This should do the trick.

If you want to see if the 'On the Fly' transformation is what's causing you trouble, do this:

  1. Go to the Project menu, and click Project properties...
  2. Go to the CRS tab
  3. Uncheck Enable 'on the fly' CRS transformation and click Apply, OK

If your CRS's weren't the same, the layers should no longer overlap. You can see the position of either layer by right-clicking the layer and going to Zoom to Layer. When you load the two files with identical CRS, they should align perfectly.


Use the intersect feature. Vector > Geoprocessing Tools > Intersect.

  • Input layer is your line
  • Intersect layer is your polygon
  • browse a document folder and save (preferred filename) in the Output Shapefile.

To do this using 2 layers:

Depending on how you want to perform the overlay, you can use Clip or Difference tools from the Vector Overlay toolbox.
The difference tool deletes the geometry of the Overlay Layer from the geometry of the Input Layer. The clip tool deletes the geometry of the Input Layer that is outside the Overlay Layer. enter image description here

To do this while editing:

If you want to add a hole to a polygon while you're editing, you can use the Advanced Digitizing Panel to add a hole. You can also use that panel to reshape polygons (cut off parts). There is also the Split Features tool for splitting polygons. enter image description here

There is also a plugin called Clipper that allows you to clip features using another selected geometry.

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.