I have a polygon vector layer and a line vector layer in a form of grid (they are both in the .shp format). I need to split polygons by these lines.

I tried digitizing tools but the problem is that it deals only with 1 line at a time and I have more than 52,000 lines. It will take a ridiculously long time to split it manually. How can it be done for all the lines?

I have QGIS 2.18.


2 Answers 2


I would probably do the following:

  1. Run the Lines to polygons tool:

    Vector > Geometry Tools > Lines to polygons

    Or the Polygonize tool (as suggested by @GaborFarkas):

    Processing Toolbox > QGIS Geoalgorithms > Vector geometry tools > Polygonize

  1. Run the Clip tool using the output from Step 1 as the Input layer and your polygon layer as the Clip layer:

    Vector > Geoprocessing Tools > Clip
  • 3
    The Lines to polygons tool just converts geometry types around (the geometry of the feature becomes the outer ring of the resulting poly). Therefore, it only works if every feature in the line layer forms a grid cell. If they are just straight vertical and horizontal lines intersecting each other, the Polygonize tool is the right one for the job. Apr 3, 2017 at 11:05
  • @GaborFarkas - Indeed you are correct! I assumed the lines close to form a grid cell which seemed to have been suggested by the OP :). But the Polygonize is more if an all-round solution so thanks for mentioning!
    – Joseph
    Apr 3, 2017 at 11:12
  • 1
    Thank you both vrey much, Joseph and @Gabor Farkas , it worked. In my grid every feature formed a cell so lines in polygons did it perfectly. .:)
    – NecroSith
    Apr 3, 2017 at 11:35
  • @NecroSith - Most welcome, glad it worked =)
    – Joseph
    Apr 3, 2017 at 11:36

After lines and polygonize as @GaborFarkus suggests run saga's or native split with lines. Lines need to be closed shapes. Can easily make a grid with 'create grid'. Then run sagas convert points to lines using left/left first then then top/top option. Merge those two line layers. Then run polygonize on merged lines. Then run polygons to lines on that. This will make closed-cell lines you can split with.

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.