Tuesday, 12 February 2019

QGIS clipping lines with polygon grid


I have created a uniform (nominally square) gird of polygons using the grid tool. I have a road network layer that consists of lines. What I would like to do is iterate over the grid polygons and clip the road network within each square. I can certainly clip the road network out using a single polygon but I would like to automate the process :-) (160+ polygons in the grid!).


Happy to use QGIS 2.14 or 2.18!



Answer



You need to use clip tool, from Processing toolbox -> QGIS geoalgorithms -> Vector overlay tools -> Clip, as follows:


enter image description here


Select the roads as input layer and grid as clipping layer, and select the green arrow beside the clipping grid


enter image description here



The output will be clipped roads based on each grid polygon.


enter image description here


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...