i'm using QGIS, and i have a multi polygon which has more then 6000 features with population data in it, so i want to select only 400 features randomly but the selected feature need to have a certain population sum, lets say around 20.000.000 people.

I've been using random selection but it only select 400 features randomly.

is there any other way?

  • 2
    Do u really mean a ( one ? ) multipolygon with 6000 sub-parts ? How many lines do you have in your attribute table ?
    – Snaileater
    Sep 27, 2019 at 8:20
  • yes, i mean its a polygon of a country with borders in it, it has 6000 lines (which is the city). and each city has different number of population.
    – Ed Putra
    Sep 27, 2019 at 8:25
  • So ... you're dealing with two layers ? a country layer with one feature (one polygon) and a cities layer with 6000 polygons ?
    – Snaileater
    Sep 27, 2019 at 8:35
  • One layer only, the cities.
    – Ed Putra
    Sep 27, 2019 at 8:44
  • One layer of a country, which includes 6000 cities - right?
    – Erik
    Sep 27, 2019 at 8:49

1 Answer 1


You can select a subset of your data using your attribute column "population" (let's say population > 20.000.000).

Then you're able to use the toolbox treatement 'random extract' (dont forget to tick selected features only) and choose the "number of selected features" option, i don't think there will be any selection limit ...

That should do the job ?

  • I think the keyword here is "sum" - they asked for the population sum to be >20 million.
    – csk
    Sep 27, 2019 at 16:44
  • you're completely right ... i overlooked that ... or read too quick ...
    – Snaileater
    Sep 27, 2019 at 16:48

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.