8

I have a problem that is similar to Get Points in a selected polygon.

I have a polygon layer (with +200 features) that represents a road (subdivided by every 100m) and a point layer of a GPS survey driving through the road.

I want to clip all the points of a selected feature from the polygon layer. My problem is that I have +200 features and I need to do this to every feature.

Is there an easier way to do this than manually selecting 200 features individually and exporting the selection?

9

There is a direct and very easy way to do this. In the Clip tool, press the green cyclic arrows button next to the Overlay layer dropdown menu. That instructs to iterate the operation over the features of the layer.

You'll get seperate layers for each polygon.

enter image description here

For more details check the "Iterative execution of algorithms" article from the QGIS Training Manual.

1
  • Nice and neat :)
    – Taras
    Sep 28 at 11:14
8

You can do this in two steps using QGIS.

(1) First, use the tool the "Join Attributes by Location" to create a new field in your points layer that describes which polygon each point falls into:

Join Attributes by Location

(2) Next, run the "Split Vector Layer" tool to write separate shapefiles for each unique value in the new field created by the previous step:

Split Vector Layer

Before: Before

After: After

2

You may also try the SAGA's "Clip Points with Polygons" module with ticked 'Iterate over this layer'.

window

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.