I need to perform a stratified sample in the following context.

I have two layers; the first is a point layer (which consists of dwelling centroids.) The second is a vector layer of polygons with each polygon being an electoral area. There are multiple dwelling points contained within one electoral area. The dwelling point layer has all the inherited information from the electoral area layer.

I need to select 20 points from each of the five electoral areas.

How do I best do this in QGIS? I have tried all of the vector tools. - Am I missing something?


1 Answer 1


Use the Random selection within subsets tool which allows you to select the ID field (containing the unique values for your electoral area) and the number of points:

Random selection within subsets

  • In QGIS 2.18.10 this behaves strangely. I followed the instructions and typed 20. It selected 4 centroids from each of the five electoral areas. Is this how the function is intended to work?
    – STP
    Commented Aug 17, 2017 at 15:06
  • Hmm it shouldn't. I tested this on QGIS 2.18.3 and it worked the way it should...i.e. it selected 20 points from each polygon area I had (there were about 60 points in each area). Seems like it could be a bug.
    – Joseph
    Commented Aug 17, 2017 at 15:09
  • Are you sure the field you selected contained unique values for your 5 polygons?
    – Joseph
    Commented Aug 17, 2017 at 15:11
  • 1
    Thank you. It was my mistake. I had used an incorrect id as the field.
    – STP
    Commented Aug 17, 2017 at 15:46
  • @STP - Most welcome! Glad you got it working :)
    – Joseph
    Commented Aug 18, 2017 at 9:35

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.